wm_drag_handler.cc 1014 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ui/platform_window/wm/wm_drag_handler.h"
  5. #include "ui/base/class_property.h"
  6. #include "ui/platform_window/platform_window.h"
  7. DEFINE_UI_CLASS_PROPERTY_TYPE(ui::WmDragHandler*)
  8. namespace ui {
  9. DEFINE_UI_CLASS_PROPERTY_KEY(WmDragHandler*, kWmDragHandlerKey, nullptr)
  10. WmDragHandler::LocationDelegate::~LocationDelegate() = default;
  11. bool WmDragHandler::ShouldReleaseCaptureForDrag(
  12. ui::OSExchangeData* data) const {
  13. // Chrome normally expects starting drag and drop to release capture.
  14. return true;
  15. }
  16. void SetWmDragHandler(PlatformWindow* platform_window,
  17. WmDragHandler* drag_handler) {
  18. platform_window->SetProperty(kWmDragHandlerKey, drag_handler);
  19. }
  20. WmDragHandler* GetWmDragHandler(const PlatformWindow& platform_window) {
  21. return platform_window.GetProperty(kWmDragHandlerKey);
  22. }
  23. } // namespace ui