Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(778)

Unified Diff: services/ui/ws/window_tree.cc

Issue 2352233002: mus drag and drop: Add API to let the client cancel the drag. (Closed)
Patch Set: Oops. Forgot the client lib side. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,
« services/ui/public/cpp/window_tree_client.cc ('K') | « services/ui/ws/window_tree.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698