OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "mash/wm/user_window_controller_impl.h" | 5 #include "mash/wm/user_window_controller_impl.h" |
6 | 6 |
7 #include "components/mus/public/cpp/property_type_converters.h" | 7 #include "components/mus/public/cpp/property_type_converters.h" |
8 #include "components/mus/public/cpp/window.h" | 8 #include "components/mus/public/cpp/window.h" |
9 #include "components/mus/public/cpp/window_property.h" | 9 #include "components/mus/public/cpp/window_property.h" |
10 #include "components/mus/public/cpp/window_tree_connection.h" | 10 #include "components/mus/public/cpp/window_tree_connection.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 mus::Window* UserWindowControllerImpl::GetUserWindowById(uint32_t id) { | 122 mus::Window* UserWindowControllerImpl::GetUserWindowById(uint32_t id) { |
123 for (mus::Window* window : GetUserWindowContainer()->children()) { | 123 for (mus::Window* window : GetUserWindowContainer()->children()) { |
124 if (window->GetLocalProperty(kUserWindowIdKey) == id) | 124 if (window->GetLocalProperty(kUserWindowIdKey) == id) |
125 return window; | 125 return window; |
126 } | 126 } |
127 return nullptr; | 127 return nullptr; |
128 } | 128 } |
129 | 129 |
130 mus::Window* UserWindowControllerImpl::GetUserWindowContainer() const { | 130 mus::Window* UserWindowControllerImpl::GetUserWindowContainer() const { |
131 return root_controller_->GetWindowForContainer( | 131 return root_controller_->GetWindowForContainer( |
132 mojom::Container::USER_WINDOWS); | 132 mojom::Container::USER_PRIVATE_WINDOWS); |
133 } | 133 } |
134 | 134 |
135 void UserWindowControllerImpl::OnTreeChanging(const TreeChangeParams& params) { | 135 void UserWindowControllerImpl::OnTreeChanging(const TreeChangeParams& params) { |
136 DCHECK(root_controller_); | 136 DCHECK(root_controller_); |
137 if (params.new_parent == GetUserWindowContainer()) { | 137 if (params.new_parent == GetUserWindowContainer()) { |
138 params.target->AddObserver(window_property_observer_.get()); | 138 params.target->AddObserver(window_property_observer_.get()); |
139 AssignIdIfNecessary(params.target); | 139 AssignIdIfNecessary(params.target); |
140 if (user_window_observer_) | 140 if (user_window_observer_) |
141 user_window_observer_->OnUserWindowAdded(GetUserWindow(params.target)); | 141 user_window_observer_->OnUserWindowAdded(GetUserWindow(params.target)); |
142 } else if (params.old_parent == GetUserWindowContainer()) { | 142 } else if (params.old_parent == GetUserWindowContainer()) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 } | 183 } |
184 | 184 |
185 void UserWindowControllerImpl::FocusUserWindow(uint32_t window_id) { | 185 void UserWindowControllerImpl::FocusUserWindow(uint32_t window_id) { |
186 mus::Window* window = GetUserWindowById(window_id); | 186 mus::Window* window = GetUserWindowById(window_id); |
187 if (window) | 187 if (window) |
188 window->SetFocus(); | 188 window->SetFocus(); |
189 } | 189 } |
190 | 190 |
191 } // namespace wm | 191 } // namespace wm |
192 } // namespace mash | 192 } // namespace mash |
OLD | NEW |