drag_utils_aura.cc 1022 B

1234567891011121314151617181920212223242526272829
  1. // Copyright 2014 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/views/drag_utils.h"
  5. #include "ui/aura/client/drag_drop_client.h"
  6. #include "ui/aura/window.h"
  7. #include "ui/aura/window_event_dispatcher.h"
  8. #include "ui/wm/core/coordinate_conversion.h"
  9. namespace views {
  10. void RunShellDrag(gfx::NativeView view,
  11. std::unique_ptr<ui::OSExchangeData> data,
  12. const gfx::Point& location,
  13. int operation,
  14. ui::mojom::DragEventSource source) {
  15. gfx::Point screen_location(location);
  16. wm::ConvertPointToScreen(view, &screen_location);
  17. aura::Window* root_window = view->GetRootWindow();
  18. if (aura::client::GetDragDropClient(root_window)) {
  19. aura::client::GetDragDropClient(root_window)
  20. ->StartDragAndDrop(std::move(data), root_window, view, screen_location,
  21. operation, source);
  22. }
  23. }
  24. } // namespace views