Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "services/ui/ws/window_tree.h" | 5 #include "services/ui/ws/window_tree.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1598 // The window isn't parented. There's nothing to do. | 1598 // The window isn't parented. There's nothing to do. |
| 1599 DVLOG(1) << "DeactivateWindow failed (window unparented)"; | 1599 DVLOG(1) << "DeactivateWindow failed (window unparented)"; |
| 1600 return; | 1600 return; |
| 1601 } | 1601 } |
| 1602 | 1602 |
| 1603 WindowTree* wm_tree = display_root->window_manager_state()->window_tree(); | 1603 WindowTree* wm_tree = display_root->window_manager_state()->window_tree(); |
| 1604 wm_tree->window_manager_internal_->WmDeactivateWindow( | 1604 wm_tree->window_manager_internal_->WmDeactivateWindow( |
| 1605 wm_tree->ClientWindowIdForWindow(window).id); | 1605 wm_tree->ClientWindowIdForWindow(window).id); |
| 1606 } | 1606 } |
| 1607 | 1607 |
| 1608 void WindowTree::StackAtTop(uint32_t change_id, Id window_id) { | |
| 1609 ServerWindow* window = | |
| 1610 GetWindowByClientId(ClientWindowId(window_id)); | |
| 1611 if (!window) { | |
| 1612 DVLOG(1) << "StackAtTop failed (invalid id)"; | |
| 1613 client()->OnChangeCompleted(change_id, false); | |
| 1614 return; | |
| 1615 } | |
| 1616 | |
| 1617 ServerWindow* parent = window->parent(); | |
| 1618 if (!parent) { | |
| 1619 DVLOG(1) << "StackAtTop failed (window unparented)"; | |
| 1620 client()->OnChangeCompleted(change_id, false); | |
| 1621 return; | |
| 1622 } | |
| 1623 | |
| 1624 DCHECK(!parent->children().empty()); | |
| 1625 if (parent->children().back() == window) { | |
| 1626 // Ignore this call; the client didn't know they were already at the top. | |
| 1627 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.
| |
| 1628 client()->OnChangeCompleted(change_id, true); | |
| 1629 return; | |
| 1630 } | |
| 1631 | |
| 1632 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
| |
| 1633 Operation op(this, window_server_, OperationType::REORDER_WINDOW); | |
| 1634 window->Reorder(relative_window, mojom::OrderDirection::ABOVE); | |
| 1635 window_server_->ProcessWindowReorder(window, relative_window, | |
| 1636 mojom::OrderDirection::ABOVE); | |
| 1637 | |
| 1638 client()->OnChangeCompleted(change_id, true); | |
| 1639 } | |
| 1640 | |
| 1608 void WindowTree::GetWindowManagerClient( | 1641 void WindowTree::GetWindowManagerClient( |
| 1609 mojo::AssociatedInterfaceRequest<mojom::WindowManagerClient> internal) { | 1642 mojo::AssociatedInterfaceRequest<mojom::WindowManagerClient> internal) { |
| 1610 if (!access_policy_->CanSetWindowManager() || !window_manager_internal_ || | 1643 if (!access_policy_->CanSetWindowManager() || !window_manager_internal_ || |
| 1611 window_manager_internal_client_binding_) { | 1644 window_manager_internal_client_binding_) { |
| 1612 return; | 1645 return; |
| 1613 } | 1646 } |
| 1614 window_manager_internal_client_binding_.reset( | 1647 window_manager_internal_client_binding_.reset( |
| 1615 new mojo::AssociatedBinding<mojom::WindowManagerClient>( | 1648 new mojo::AssociatedBinding<mojom::WindowManagerClient>( |
| 1616 this, std::move(internal))); | 1649 this, std::move(internal))); |
| 1617 } | 1650 } |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2030 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, | 2063 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, |
| 2031 effect_bitmask, callback); | 2064 effect_bitmask, callback); |
| 2032 } | 2065 } |
| 2033 | 2066 |
| 2034 void WindowTree::PerformOnDragDropDone() { | 2067 void WindowTree::PerformOnDragDropDone() { |
| 2035 client()->OnDragDropDone(); | 2068 client()->OnDragDropDone(); |
| 2036 } | 2069 } |
| 2037 | 2070 |
| 2038 } // namespace ws | 2071 } // namespace ws |
| 2039 } // namespace ui | 2072 } // namespace ui |
| OLD | NEW |