Index: services/ui/ws/event_dispatcher.cc |
diff --git a/services/ui/ws/event_dispatcher.cc b/services/ui/ws/event_dispatcher.cc |
index 06c632338126f2ff3003a0152083913836d6ee5e..2494d427a110e9e9302aa247528bb3aca68a88c5 100644 |
--- a/services/ui/ws/event_dispatcher.cc |
+++ b/services/ui/ws/event_dispatcher.cc |
@@ -8,6 +8,8 @@ |
#include "base/time/time.h" |
#include "services/ui/ws/accelerator.h" |
+#include "services/ui/ws/current_drag_operation.h" |
+#include "services/ui/ws/current_drag_operation_delegate.h" |
#include "services/ui/ws/display.h" |
#include "services/ui/ws/event_dispatcher_delegate.h" |
#include "services/ui/ws/server_window.h" |
@@ -188,6 +190,17 @@ bool EventDispatcher::SetCaptureWindow(ServerWindow* window, |
return true; |
} |
+void EventDispatcher::SetDragDropSourceWindow( |
+ uint32_t change_id, |
+ WindowTree* window_tree, |
+ ServerWindow* capture_window, |
+ mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data, |
+ uint32_t drag_operations) { |
+ current_drag_drop_operation_.reset( |
+ new CurrentDragOperation(this, change_id, window_tree, capture_window, |
+ std::move(mime_data), drag_operations)); |
+} |
+ |
void EventDispatcher::AddSystemModalWindow(ServerWindow* window) { |
modal_window_controller_.AddSystemModalWindow(window); |
} |
@@ -341,6 +354,15 @@ void EventDispatcher::ProcessLocatedEvent(const ui::LocatedEvent& event) { |
mouse_button_down_ = false; |
} |
+ if (current_drag_drop_operation_) { |
+ const PointerTarget target = PointerTargetForEvent(event); |
+ const ClientSpecificId client_id = delegate_->GetEventTargetClientId( |
+ target.window, target.in_nonclient_area); |
+ current_drag_drop_operation_->DispatchLocatedEvent(event, target.window, |
+ client_id); |
+ return; |
+ } |
+ |
if (capture_window_) { |
mouse_cursor_source_window_ = capture_window_; |
DispatchToClient(capture_window_, capture_window_client_id_, event); |
@@ -575,5 +597,9 @@ void EventDispatcher::OnWindowDestroyed(ServerWindow* window) { |
mouse_cursor_source_window_ = nullptr; |
} |
+void EventDispatcher::OnDragOver(bool success) { |
+ current_drag_drop_operation_.reset(); |
+} |
+ |
} // namespace ws |
} // namespace ui |