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

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: A bunch of dvlogs 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
« no previous file with comments | « services/ui/ws/window_tree.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..9d030735e490e6a374e44fa33e33b30871929a61 100644
--- a/services/ui/ws/window_tree.cc
+++ b/services/ui/ws/window_tree.cc
@@ -1546,6 +1546,33 @@ void WindowTree::PerformDragDrop(
std::move(drag_data), drag_operation);
}
+void WindowTree::CancelDragDrop(Id window_id) {
+ ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id));
+ if (!window) {
+ DVLOG(1) << "CancelDragDrop failed (no window)";
+ return;
+ }
+
+ if (window != window_server_->GetCurrentDragLoopWindow()) {
+ DVLOG(1) << "CancelDragDrop failed (not the drag loop window)";
+ return;
+ }
+
+ if (window_server_->GetCurrentDragLoopInitiator() != this) {
+ DVLOG(1) << "CancelDragDrop failed (not the drag initiator)";
+ return;
+ }
+
+ WindowManagerDisplayRoot* display_root = GetWindowManagerDisplayRoot(window);
+ if (!display_root) {
+ DVLOG(1) << "CancelDragDrop failed (no such window manager 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,
@@ -1595,18 +1622,26 @@ void WindowTree::PerformWindowMove(uint32_t change_id,
void WindowTree::CancelWindowMove(Id window_id) {
ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id));
bool success = window && access_policy_->CanInitiateMoveLoop(window);
- if (!success)
+ if (!success) {
+ DVLOG(1) << "CancelWindowMove failed (no window / access denied)";
return;
+ }
- if (window != window_server_->GetCurrentMoveLoopWindow())
+ if (window != window_server_->GetCurrentMoveLoopWindow()) {
+ DVLOG(1) << "CancelWindowMove failed (not the move loop window)";
return;
+ }
- if (window_server_->GetCurrentMoveLoopInitiator() != this)
+ if (window_server_->GetCurrentMoveLoopInitiator() != this) {
+ DVLOG(1) << "CancelWindowMove failed (not the move loop initiator)";
return;
+ }
WindowManagerDisplayRoot* display_root = GetWindowManagerDisplayRoot(window);
- if (!display_root)
+ if (!display_root) {
+ DVLOG(1) << "CancelWindowMove failed (no such window manager display root)";
return;
+ }
WindowManagerState* wms = display_root->window_manager_state();
wms->window_tree()->window_manager_internal_->WmCancelMoveLoop(
« no previous file with comments | « services/ui/ws/window_tree.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698