| 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 = GetWindowByClientId(ClientWindowId(window_id)); |
| 1610 if (!window) { |
| 1611 DVLOG(1) << "StackAtTop failed (invalid id)"; |
| 1612 client()->OnChangeCompleted(change_id, false); |
| 1613 return; |
| 1614 } |
| 1615 |
| 1616 if (!access_policy_->CanStackAtTop(window)) { |
| 1617 DVLOG(1) << "StackAtTop failed (access denied)"; |
| 1618 client()->OnChangeCompleted(change_id, false); |
| 1619 return; |
| 1620 } |
| 1621 |
| 1622 ServerWindow* parent = window->parent(); |
| 1623 if (!parent) { |
| 1624 DVLOG(1) << "StackAtTop failed (window unparented)"; |
| 1625 client()->OnChangeCompleted(change_id, false); |
| 1626 return; |
| 1627 } |
| 1628 |
| 1629 DCHECK(!parent->children().empty()); |
| 1630 if (parent->children().back() == window) { |
| 1631 // Ignore this call; the client didn't know they were already at the top. |
| 1632 DVLOG(3) << "StackAtTop ignored (already at top)"; |
| 1633 client()->OnChangeCompleted(change_id, true); |
| 1634 return; |
| 1635 } |
| 1636 |
| 1637 ServerWindow* relative_window = parent->children().back(); |
| 1638 Operation op(this, window_server_, OperationType::REORDER_WINDOW); |
| 1639 window->Reorder(relative_window, mojom::OrderDirection::ABOVE); |
| 1640 window_server_->ProcessWindowReorder(window, relative_window, |
| 1641 mojom::OrderDirection::ABOVE); |
| 1642 |
| 1643 client()->OnChangeCompleted(change_id, true); |
| 1644 } |
| 1645 |
| 1608 void WindowTree::GetWindowManagerClient( | 1646 void WindowTree::GetWindowManagerClient( |
| 1609 mojo::AssociatedInterfaceRequest<mojom::WindowManagerClient> internal) { | 1647 mojo::AssociatedInterfaceRequest<mojom::WindowManagerClient> internal) { |
| 1610 if (!access_policy_->CanSetWindowManager() || !window_manager_internal_ || | 1648 if (!access_policy_->CanSetWindowManager() || !window_manager_internal_ || |
| 1611 window_manager_internal_client_binding_) { | 1649 window_manager_internal_client_binding_) { |
| 1612 return; | 1650 return; |
| 1613 } | 1651 } |
| 1614 window_manager_internal_client_binding_.reset( | 1652 window_manager_internal_client_binding_.reset( |
| 1615 new mojo::AssociatedBinding<mojom::WindowManagerClient>( | 1653 new mojo::AssociatedBinding<mojom::WindowManagerClient>( |
| 1616 this, std::move(internal))); | 1654 this, std::move(internal))); |
| 1617 } | 1655 } |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2030 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, | 2068 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, |
| 2031 effect_bitmask, callback); | 2069 effect_bitmask, callback); |
| 2032 } | 2070 } |
| 2033 | 2071 |
| 2034 void WindowTree::PerformOnDragDropDone() { | 2072 void WindowTree::PerformOnDragDropDone() { |
| 2035 client()->OnDragDropDone(); | 2073 client()->OnDragDropDone(); |
| 2036 } | 2074 } |
| 2037 | 2075 |
| 2038 } // namespace ws | 2076 } // namespace ws |
| 2039 } // namespace ui | 2077 } // namespace ui |
| OLD | NEW |