Chromium Code Reviews| Index: services/ui/ws/window_tree.cc |
| diff --git a/services/ui/ws/window_tree.cc b/services/ui/ws/window_tree.cc |
| index 6ae34e7503a1dd9ec4ba8a99df503a98e5612ccb..1ff99bb39230c92ed806176c73bd5f87c98602bb 100644 |
| --- a/services/ui/ws/window_tree.cc |
| +++ b/services/ui/ws/window_tree.cc |
| @@ -1546,6 +1546,26 @@ void WindowTree::PerformDragDrop( |
| std::move(drag_data), drag_operation); |
| } |
| +void WindowTree::CancelDragDrop(Id window_id) { |
| + ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id)); |
| + bool success = window && access_policy_->CanInitiateDragLoop(window); |
|
sky
2016/09/21 20:40:56
I wouldn't bother with the success member. That is
|
| + if (!success) |
| + return; |
| + |
| + if (window != window_server_->GetCurrentDragLoopWindow()) |
| + return; |
| + |
| + if (window_server_->GetCurrentDragLoopInitiator() != this) |
| + return; |
| + |
| + WindowManagerDisplayRoot* display_root = GetWindowManagerDisplayRoot(window); |
| + if (!display_root) |
| + return; |
| + |
| + WindowManagerState* wms = display_root->window_manager_state(); |
| + wms->CancelDragDrop(); |
| +} |
| + |
| void WindowTree::PerformWindowMove(uint32_t change_id, |
| Id window_id, |
| ui::mojom::MoveLoopSource source, |