| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 ClientWindowId focused_window_id; | 108 ClientWindowId focused_window_id; |
| 109 if (focused_window) | 109 if (focused_window) |
| 110 IsWindowKnown(focused_window, &focused_window_id); | 110 IsWindowKnown(focused_window, &focused_window_id); |
| 111 | 111 |
| 112 const bool drawn = root->parent() && root->parent()->IsDrawn(); | 112 const bool drawn = root->parent() && root->parent()->IsDrawn(); |
| 113 client()->OnEmbed(id_, WindowToWindowData(to_send.front()), std::move(tree), | 113 client()->OnEmbed(id_, WindowToWindowData(to_send.front()), std::move(tree), |
| 114 display_id, focused_window_id.id, drawn); | 114 display_id, focused_window_id.id, drawn); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void WindowTree::ConfigureWindowManager() { | 117 void WindowTree::ConfigureWindowManager() { |
| 118 // ConfigureWindowManager() should be called early on, before anything |
| 119 // else. |waiting_for_top_level_window_info_| must be null as if |
| 120 // |waiting_for_top_level_window_info_| is non-null it means we're about to |
| 121 // create an associated interface, which doesn't work with pause/resume. |
| 122 // TODO(sky): DCHECK temporary until 626869 is sorted out. |
| 123 DCHECK(!waiting_for_top_level_window_info_); |
| 118 DCHECK(!window_manager_internal_); | 124 DCHECK(!window_manager_internal_); |
| 119 window_manager_internal_ = binding_->GetWindowManager(); | 125 window_manager_internal_ = binding_->GetWindowManager(); |
| 120 window_manager_internal_->OnConnect(id_); | 126 window_manager_internal_->OnConnect(id_); |
| 121 window_manager_state_.reset(new WindowManagerState(this)); | 127 window_manager_state_.reset(new WindowManagerState(this)); |
| 122 } | 128 } |
| 123 | 129 |
| 124 const ServerWindow* WindowTree::GetWindow(const WindowId& id) const { | 130 const ServerWindow* WindowTree::GetWindow(const WindowId& id) const { |
| 125 if (id_ == id.client_id) { | 131 if (id_ == id.client_id) { |
| 126 auto iter = created_window_map_.find(id); | 132 auto iter = created_window_map_.find(id); |
| 127 return iter == created_window_map_.end() ? nullptr : iter->second; | 133 return iter == created_window_map_.end() ? nullptr : iter->second; |
| (...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 } | 1010 } |
| 1005 client()->OnChangeCompleted( | 1011 client()->OnChangeCompleted( |
| 1006 change_id, NewWindow(ClientWindowId(transport_window_id), properties)); | 1012 change_id, NewWindow(ClientWindowId(transport_window_id), properties)); |
| 1007 } | 1013 } |
| 1008 | 1014 |
| 1009 void WindowTree::NewTopLevelWindow( | 1015 void WindowTree::NewTopLevelWindow( |
| 1010 uint32_t change_id, | 1016 uint32_t change_id, |
| 1011 Id transport_window_id, | 1017 Id transport_window_id, |
| 1012 mojo::Map<mojo::String, mojo::Array<uint8_t>> transport_properties) { | 1018 mojo::Map<mojo::String, mojo::Array<uint8_t>> transport_properties) { |
| 1013 DCHECK(!waiting_for_top_level_window_info_); | 1019 DCHECK(!waiting_for_top_level_window_info_); |
| 1020 // TODO(sky): rather than DCHECK, have this kill connection. |
| 1021 DCHECK(!window_manager_internal_); // Not valid for the windowmanager. |
| 1014 const ClientWindowId client_window_id(transport_window_id); | 1022 const ClientWindowId client_window_id(transport_window_id); |
| 1015 // TODO(sky): need a way for client to provide context to figure out display. | 1023 // TODO(sky): need a way for client to provide context to figure out display. |
| 1016 Display* display = display_manager()->displays().empty() | 1024 Display* display = display_manager()->displays().empty() |
| 1017 ? nullptr | 1025 ? nullptr |
| 1018 : *(display_manager()->displays().begin()); | 1026 : *(display_manager()->displays().begin()); |
| 1019 // TODO(sky): move checks to accesspolicy. | 1027 // TODO(sky): move checks to accesspolicy. |
| 1020 WindowManagerDisplayRoot* display_root = | 1028 WindowManagerDisplayRoot* display_root = |
| 1021 display && user_id_ != InvalidUserId() | 1029 display && user_id_ != InvalidUserId() |
| 1022 ? display->GetWindowManagerDisplayRootForUser(user_id_) | 1030 ? display->GetWindowManagerDisplayRootForUser(user_id_) |
| 1023 : nullptr; | 1031 : nullptr; |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1661 } | 1669 } |
| 1662 | 1670 |
| 1663 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( | 1671 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( |
| 1664 const ServerWindow* window) const { | 1672 const ServerWindow* window) const { |
| 1665 WindowTree* tree = window_server_->GetTreeWithRoot(window); | 1673 WindowTree* tree = window_server_->GetTreeWithRoot(window); |
| 1666 return tree && tree != this; | 1674 return tree && tree != this; |
| 1667 } | 1675 } |
| 1668 | 1676 |
| 1669 } // namespace ws | 1677 } // namespace ws |
| 1670 } // namespace ui | 1678 } // namespace ui |
| OLD | NEW |