| 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_ ||
|
|
|