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

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

Issue 2633233003: aura-mus: Implement stacking in DesktopWindowTreeHostMus. (Closed)
Patch Set: Add access policy for CanStackAtTop. Created 3 years, 11 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 e424cf317f94becfbcf48d41513cabe789e1dcec..28cea21d49d0829771c02d16c370534b64fdfb24 100644
--- a/services/ui/ws/window_tree.cc
+++ b/services/ui/ws/window_tree.cc
@@ -1605,6 +1605,44 @@ void WindowTree::DeactivateWindow(Id window_id) {
wm_tree->ClientWindowIdForWindow(window).id);
}
+void WindowTree::StackAtTop(uint32_t change_id, Id window_id) {
+ ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id));
+ if (!window) {
+ DVLOG(1) << "StackAtTop failed (invalid id)";
+ client()->OnChangeCompleted(change_id, false);
+ return;
+ }
+
+ if (!access_policy_->CanStackAtTop(window)) {
+ DVLOG(1) << "StackAtTop failed (access denied)";
+ client()->OnChangeCompleted(change_id, false);
+ return;
+ }
+
+ ServerWindow* parent = window->parent();
+ if (!parent) {
+ DVLOG(1) << "StackAtTop failed (window unparented)";
+ client()->OnChangeCompleted(change_id, false);
+ return;
+ }
+
+ DCHECK(!parent->children().empty());
+ if (parent->children().back() == window) {
+ // Ignore this call; the client didn't know they were already at the top.
+ DVLOG(3) << "StackAtTop ignored (already at top)";
+ client()->OnChangeCompleted(change_id, true);
+ return;
+ }
+
+ ServerWindow* relative_window = parent->children().back();
+ Operation op(this, window_server_, OperationType::REORDER_WINDOW);
+ window->Reorder(relative_window, mojom::OrderDirection::ABOVE);
+ window_server_->ProcessWindowReorder(window, relative_window,
+ mojom::OrderDirection::ABOVE);
+
+ client()->OnChangeCompleted(change_id, true);
+}
+
void WindowTree::GetWindowManagerClient(
mojo::AssociatedInterfaceRequest<mojom::WindowManagerClient> internal) {
if (!access_policy_->CanSetWindowManager() || !window_manager_internal_ ||

Powered by Google App Engine
This is Rietveld 408576698