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 e424cf317f94becfbcf48d41513cabe789e1dcec..427b450a69a48a1bb9a127f724958fb8c1ce06d4 100644 |
| --- a/services/ui/ws/window_tree.cc |
| +++ b/services/ui/ws/window_tree.cc |
| @@ -1605,6 +1605,39 @@ 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; |
| + } |
| + |
| + 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(1) << "StackAtTop ignored (already at top)"; |
|
sky
2017/01/19 22:20:59
As this isn't a failure (response is true), how ab
Elliot Glaysher
2017/01/20 01:03:44
Done.
|
| + client()->OnChangeCompleted(change_id, true); |
| + return; |
| + } |
| + |
| + ServerWindow* relative_window = parent->children().back(); |
|
sky
2017/01/19 22:20:59
Please call through to the accesspolicy. See line
Elliot Glaysher
2017/01/20 01:03:44
I've added an access policy check, though per disc
|
| + 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_ || |