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 "components/mus/ws/window_tree.h" | 5 #include "components/mus/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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 return false; | 227 return false; |
228 } | 228 } |
229 | 229 |
230 bool WindowTree::AddTransientWindow(const ClientWindowId& window_id, | 230 bool WindowTree::AddTransientWindow(const ClientWindowId& window_id, |
231 const ClientWindowId& transient_window_id) { | 231 const ClientWindowId& transient_window_id) { |
232 ServerWindow* window = GetWindowByClientId(window_id); | 232 ServerWindow* window = GetWindowByClientId(window_id); |
233 ServerWindow* transient_window = GetWindowByClientId(transient_window_id); | 233 ServerWindow* transient_window = GetWindowByClientId(transient_window_id); |
234 if (window && transient_window && !transient_window->Contains(window) && | 234 if (window && transient_window && !transient_window->Contains(window) && |
235 access_policy_->CanAddTransientWindow(window, transient_window)) { | 235 access_policy_->CanAddTransientWindow(window, transient_window)) { |
236 Operation op(this, window_server_, OperationType::ADD_TRANSIENT_WINDOW); | 236 Operation op(this, window_server_, OperationType::ADD_TRANSIENT_WINDOW); |
237 return window->AddTransientWindow(transient_window); | 237 window->AddTransientWindow(transient_window); |
| 238 return true; |
238 } | 239 } |
239 return false; | 240 return false; |
240 } | 241 } |
241 | 242 |
242 bool WindowTree::SetModal(const ClientWindowId& window_id) { | 243 bool WindowTree::SetModal(const ClientWindowId& window_id) { |
243 ServerWindow* window = GetWindowByClientId(window_id); | 244 ServerWindow* window = GetWindowByClientId(window_id); |
244 if (window && access_policy_->CanSetModal(window)) { | 245 if (window && access_policy_->CanSetModal(window)) { |
| 246 window->SetModal(); |
245 WindowManagerState* wms = GetWindowManagerState(window); | 247 WindowManagerState* wms = GetWindowManagerState(window); |
246 if (window->transient_parent()) { | |
247 window->SetModal(); | |
248 } else if (user_id_ != InvalidUserId()) { | |
249 if (wms) | |
250 wms->AddSystemModalWindow(window); | |
251 } else { | |
252 return false; | |
253 } | |
254 if (wms) | 248 if (wms) |
255 wms->ReleaseCaptureBlockedByModalWindow(window); | 249 wms->ReleaseCaptureBlockedByModalWindow(window); |
256 return true; | 250 return true; |
257 } | 251 } |
258 return false; | 252 return false; |
259 } | 253 } |
260 | 254 |
261 std::vector<const ServerWindow*> WindowTree::GetWindowTree( | 255 std::vector<const ServerWindow*> WindowTree::GetWindowTree( |
262 const ClientWindowId& window_id) const { | 256 const ClientWindowId& window_id) const { |
263 const ServerWindow* window = GetWindowByClientId(window_id); | 257 const ServerWindow* window = GetWindowByClientId(window_id); |
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1445 } | 1439 } |
1446 | 1440 |
1447 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( | 1441 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( |
1448 const ServerWindow* window) const { | 1442 const ServerWindow* window) const { |
1449 WindowTree* tree = window_server_->GetTreeWithRoot(window); | 1443 WindowTree* tree = window_server_->GetTreeWithRoot(window); |
1450 return tree && tree != this; | 1444 return tree && tree != this; |
1451 } | 1445 } |
1452 | 1446 |
1453 } // namespace ws | 1447 } // namespace ws |
1454 } // namespace mus | 1448 } // namespace mus |
OLD | NEW |