| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/mus/drag_drop_client_mus.h" | 5 #include "ui/views/mus/drag_drop_client_mus.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "services/ui/public/cpp/window.h" | 13 #include "services/ui/public/cpp/window.h" |
| 14 #include "ui/aura/mus/os_exchange_data_provider_mus.h" |
| 14 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
| 15 #include "ui/views/mus/os_exchange_data_provider_mus.h" | |
| 16 | 16 |
| 17 namespace views { | 17 namespace views { |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 DragDropClientMus* current_dragging_client = nullptr; | 20 DragDropClientMus* current_dragging_client = nullptr; |
| 21 | 21 |
| 22 } // namespace | 22 } // namespace |
| 23 | 23 |
| 24 DragDropClientMus::DragDropClientMus(ui::Window* ui_window) | 24 DragDropClientMus::DragDropClientMus(ui::Window* ui_window) |
| 25 : ui_window_(ui_window) {} | 25 : ui_window_(ui_window) {} |
| 26 | 26 |
| 27 DragDropClientMus::~DragDropClientMus() {} | 27 DragDropClientMus::~DragDropClientMus() {} |
| 28 | 28 |
| 29 int DragDropClientMus::StartDragAndDrop( | 29 int DragDropClientMus::StartDragAndDrop( |
| 30 const ui::OSExchangeData& data, | 30 const ui::OSExchangeData& data, |
| 31 aura::Window* root_window, | 31 aura::Window* root_window, |
| 32 aura::Window* source_window, | 32 aura::Window* source_window, |
| 33 const gfx::Point& screen_location, | 33 const gfx::Point& screen_location, |
| 34 int drag_operations, | 34 int drag_operations, |
| 35 ui::DragDropTypes::DragEventSource source) { | 35 ui::DragDropTypes::DragEventSource source) { |
| 36 std::map<std::string, std::vector<uint8_t>> drag_data = | 36 std::map<std::string, std::vector<uint8_t>> drag_data = |
| 37 static_cast<const OSExchangeDataProviderMus&>(data.provider()).GetData(); | 37 static_cast<const aura::OSExchangeDataProviderMus&>(data.provider()) |
| 38 .GetData(); |
| 38 | 39 |
| 39 // TODO(erg): Right now, I'm passing the cursor_location, but maybe I want to | 40 // TODO(erg): Right now, I'm passing the cursor_location, but maybe I want to |
| 40 // pass OSExchangeData::GetDragImageOffset() instead? | 41 // pass OSExchangeData::GetDragImageOffset() instead? |
| 41 | 42 |
| 42 bool success = false; | 43 bool success = false; |
| 43 gfx::Point cursor_location = screen_location; | 44 gfx::Point cursor_location = screen_location; |
| 44 uint32_t action_taken = ui::mojom::kDropEffectNone; | 45 uint32_t action_taken = ui::mojom::kDropEffectNone; |
| 45 current_dragging_client = this; | 46 current_dragging_client = this; |
| 46 ui_window_->PerformDragDrop( | 47 ui_window_->PerformDragDrop( |
| 47 drag_data, drag_operations, cursor_location, | 48 drag_data, drag_operations, cursor_location, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 void DragDropClientMus::OnMoveLoopEnd(bool* out_success, | 84 void DragDropClientMus::OnMoveLoopEnd(bool* out_success, |
| 84 uint32_t* out_action, | 85 uint32_t* out_action, |
| 85 bool in_success, | 86 bool in_success, |
| 86 uint32_t in_action) { | 87 uint32_t in_action) { |
| 87 *out_success = in_success; | 88 *out_success = in_success; |
| 88 *out_action = in_action; | 89 *out_action = in_action; |
| 89 runloop_quit_closure_.Run(); | 90 runloop_quit_closure_.Run(); |
| 90 } | 91 } |
| 91 | 92 |
| 92 } // namespace views | 93 } // namespace views |
| OLD | NEW |