| 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/drop_target_mus.h" | 5 #include "ui/views/mus/drop_target_mus.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "services/ui/public/interfaces/window_tree_constants.mojom.h" | 12 #include "services/ui/public/interfaces/window_tree_constants.mojom.h" |
| 13 #include "ui/aura/client/drag_drop_client.h" | 13 #include "ui/aura/client/drag_drop_client.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/aura/window_tree_host.h" | 16 #include "ui/aura/window_tree_host.h" |
| 16 #include "ui/base/dragdrop/drag_drop_types.h" | 17 #include "ui/base/dragdrop/drag_drop_types.h" |
| 17 #include "ui/base/dragdrop/drop_target_event.h" | 18 #include "ui/base/dragdrop/drop_target_event.h" |
| 18 #include "ui/views/mus/os_exchange_data_provider_mus.h" | |
| 19 #include "ui/wm/public/drag_drop_delegate.h" | 19 #include "ui/wm/public/drag_drop_delegate.h" |
| 20 | 20 |
| 21 namespace views { | 21 namespace views { |
| 22 | 22 |
| 23 static_assert(ui::DragDropTypes::DRAG_NONE == ui::mojom::kDropEffectNone, | 23 static_assert(ui::DragDropTypes::DRAG_NONE == ui::mojom::kDropEffectNone, |
| 24 "Drag constants must be the same"); | 24 "Drag constants must be the same"); |
| 25 static_assert(ui::DragDropTypes::DRAG_MOVE == ui::mojom::kDropEffectMove, | 25 static_assert(ui::DragDropTypes::DRAG_MOVE == ui::mojom::kDropEffectMove, |
| 26 "Drag constants must be the same"); | 26 "Drag constants must be the same"); |
| 27 static_assert(ui::DragDropTypes::DRAG_COPY == ui::mojom::kDropEffectCopy, | 27 static_assert(ui::DragDropTypes::DRAG_COPY == ui::mojom::kDropEffectCopy, |
| 28 "Drag constants must be the same"); | 28 "Drag constants must be the same"); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 target_window_->RemoveObserver(this); | 81 target_window_->RemoveObserver(this); |
| 82 target_window_ = nullptr; | 82 target_window_ = nullptr; |
| 83 } | 83 } |
| 84 | 84 |
| 85 void DropTargetMus::OnDragDropStart( | 85 void DropTargetMus::OnDragDropStart( |
| 86 std::map<std::string, std::vector<uint8_t>> mime_data) { | 86 std::map<std::string, std::vector<uint8_t>> mime_data) { |
| 87 // We store the mime data here because we need to access it during each phase | 87 // We store the mime data here because we need to access it during each phase |
| 88 // of the drag, but we also don't move the data cross-process multiple times. | 88 // of the drag, but we also don't move the data cross-process multiple times. |
| 89 os_exchange_data_ = base::MakeUnique<ui::OSExchangeData>( | 89 os_exchange_data_ = base::MakeUnique<ui::OSExchangeData>( |
| 90 base::MakeUnique<OSExchangeDataProviderMus>(std::move(mime_data))); | 90 base::MakeUnique<aura::OSExchangeDataProviderMus>(std::move(mime_data))); |
| 91 } | 91 } |
| 92 | 92 |
| 93 uint32_t DropTargetMus::OnDragEnter(uint32_t key_state, | 93 uint32_t DropTargetMus::OnDragEnter(uint32_t key_state, |
| 94 const gfx::Point& position, | 94 const gfx::Point& position, |
| 95 uint32_t effect_bitmask) { | 95 uint32_t effect_bitmask) { |
| 96 std::unique_ptr<ui::DropTargetEvent> event; | 96 std::unique_ptr<ui::DropTargetEvent> event; |
| 97 aura::client::DragDropDelegate* delegate = nullptr; | 97 aura::client::DragDropDelegate* delegate = nullptr; |
| 98 // Translate will call OnDragEntered. | 98 // Translate will call OnDragEntered. |
| 99 Translate(key_state, position, effect_bitmask, &event, &delegate); | 99 Translate(key_state, position, effect_bitmask, &event, &delegate); |
| 100 return ui::mojom::kDropEffectNone; | 100 return ui::mojom::kDropEffectNone; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 void DropTargetMus::OnDragDropDone() { | 137 void DropTargetMus::OnDragDropDone() { |
| 138 os_exchange_data_.reset(); | 138 os_exchange_data_.reset(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void DropTargetMus::OnWindowDestroyed(aura::Window* window) { | 141 void DropTargetMus::OnWindowDestroyed(aura::Window* window) { |
| 142 DCHECK_EQ(window, target_window_); | 142 DCHECK_EQ(window, target_window_); |
| 143 target_window_ = nullptr; | 143 target_window_ = nullptr; |
| 144 } | 144 } |
| 145 | 145 |
| 146 } // namespace views | 146 } // namespace views |
| OLD | NEW |