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 window->AddTransientWindow(transient_window); | 237 return window->AddTransientWindow(transient_window); |
238 return true; | |
239 } | 238 } |
240 return false; | 239 return false; |
241 } | 240 } |
242 | 241 |
243 bool WindowTree::SetModal(const ClientWindowId& window_id) { | 242 bool WindowTree::SetModal(const ClientWindowId& window_id) { |
244 ServerWindow* window = GetWindowByClientId(window_id); | 243 ServerWindow* window = GetWindowByClientId(window_id); |
245 if (window && access_policy_->CanSetModal(window)) { | 244 if (window && access_policy_->CanSetModal(window)) { |
246 window->SetModal(); | |
247 WindowManagerState* wms = GetWindowManagerState(window); | 245 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 } |
248 if (wms) | 254 if (wms) |
249 wms->ReleaseCaptureBlockedByModalWindow(window); | 255 wms->ReleaseCaptureBlockedByModalWindow(window); |
250 return true; | 256 return true; |
251 } | 257 } |
252 return false; | 258 return false; |
253 } | 259 } |
254 | 260 |
255 std::vector<const ServerWindow*> WindowTree::GetWindowTree( | 261 std::vector<const ServerWindow*> WindowTree::GetWindowTree( |
256 const ClientWindowId& window_id) const { | 262 const ClientWindowId& window_id) const { |
257 const ServerWindow* window = GetWindowByClientId(window_id); | 263 const ServerWindow* window = GetWindowByClientId(window_id); |
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1439 } | 1445 } |
1440 | 1446 |
1441 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( | 1447 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( |
1442 const ServerWindow* window) const { | 1448 const ServerWindow* window) const { |
1443 WindowTree* tree = window_server_->GetTreeWithRoot(window); | 1449 WindowTree* tree = window_server_->GetTreeWithRoot(window); |
1444 return tree && tree != this; | 1450 return tree && tree != this; |
1445 } | 1451 } |
1446 | 1452 |
1447 } // namespace ws | 1453 } // namespace ws |
1448 } // namespace mus | 1454 } // namespace mus |
OLD | NEW |