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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
231 access_policy_->CanAddTransientWindow(window, transient_window)) { | 231 access_policy_->CanAddTransientWindow(window, transient_window)) { |
232 Operation op(this, window_server_, OperationType::ADD_TRANSIENT_WINDOW); | 232 Operation op(this, window_server_, OperationType::ADD_TRANSIENT_WINDOW); |
233 window->AddTransientWindow(transient_window); | 233 window->AddTransientWindow(transient_window); |
234 return true; | 234 return true; |
235 } | 235 } |
236 return false; | 236 return false; |
237 } | 237 } |
238 | 238 |
239 bool WindowTree::SetModal(const ClientWindowId& window_id) { | 239 bool WindowTree::SetModal(const ClientWindowId& window_id) { |
240 ServerWindow* window = GetWindowByClientId(window_id); | 240 ServerWindow* window = GetWindowByClientId(window_id); |
241 bool success = false; | |
241 if (window && access_policy_->CanSetModal(window)) { | 242 if (window && access_policy_->CanSetModal(window)) { |
242 window->SetModal(); | |
243 WindowManagerState* wms = GetWindowManagerState(window); | 243 WindowManagerState* wms = GetWindowManagerState(window); |
244 if (wms) | 244 if (window->transient_parent()) { |
245 window->SetModal(); | |
246 success = true; | |
247 } else { | |
248 success = user_id_ != InvalidUserId() && wms && | |
249 wms->SetSystemModalWindow(window); | |
sky
2016/04/20 20:14:12
This is problematic because you're assuming there
mohsen
2016/04/21 17:58:43
What would exactly not work in your example? The c
| |
250 } | |
251 if (success) | |
245 wms->ReleaseCaptureBlockedByModalWindow(window); | 252 wms->ReleaseCaptureBlockedByModalWindow(window); |
246 return true; | |
247 } | 253 } |
248 return false; | 254 return success; |
249 } | 255 } |
250 | 256 |
251 std::vector<const ServerWindow*> WindowTree::GetWindowTree( | 257 std::vector<const ServerWindow*> WindowTree::GetWindowTree( |
252 const ClientWindowId& window_id) const { | 258 const ClientWindowId& window_id) const { |
253 const ServerWindow* window = GetWindowByClientId(window_id); | 259 const ServerWindow* window = GetWindowByClientId(window_id); |
254 std::vector<const ServerWindow*> windows; | 260 std::vector<const ServerWindow*> windows; |
255 if (window) | 261 if (window) |
256 GetWindowTreeImpl(window, &windows); | 262 GetWindowTreeImpl(window, &windows); |
257 return windows; | 263 return windows; |
258 } | 264 } |
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1409 } | 1415 } |
1410 | 1416 |
1411 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( | 1417 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( |
1412 const ServerWindow* window) const { | 1418 const ServerWindow* window) const { |
1413 WindowTree* tree = window_server_->GetTreeWithRoot(window); | 1419 WindowTree* tree = window_server_->GetTreeWithRoot(window); |
1414 return tree && tree != this; | 1420 return tree && tree != this; |
1415 } | 1421 } |
1416 | 1422 |
1417 } // namespace ws | 1423 } // namespace ws |
1418 } // namespace mus | 1424 } // namespace mus |
OLD | NEW |