OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/common/wm/container_finder.h" | 5 #include "ash/common/wm/container_finder.h" |
6 | 6 |
| 7 #include "ash/common/session/session_state_delegate.h" |
7 #include "ash/common/shell_window_ids.h" | 8 #include "ash/common/shell_window_ids.h" |
8 #include "ash/common/wm/always_on_top_controller.h" | 9 #include "ash/common/wm/always_on_top_controller.h" |
9 #include "ash/common/wm/root_window_finder.h" | 10 #include "ash/common/wm/root_window_finder.h" |
10 #include "ash/common/wm/window_state.h" | 11 #include "ash/common/wm/window_state.h" |
11 #include "ash/common/wm_root_window_controller.h" | 12 #include "ash/common/wm_root_window_controller.h" |
12 #include "ash/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
13 #include "ash/common/wm_window.h" | 14 #include "ash/common/wm_window.h" |
14 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
15 | 16 |
16 namespace ash { | 17 namespace ash { |
(...skipping 11 matching lines...) Expand all Loading... |
28 window->GetTransientParent()->GetType() != ui::wm::WINDOW_TYPE_UNKNOWN; | 29 window->GetTransientParent()->GetType() != ui::wm::WINDOW_TYPE_UNKNOWN; |
29 } | 30 } |
30 | 31 |
31 WmWindow* GetSystemModalContainer(WmWindow* root, WmWindow* window) { | 32 WmWindow* GetSystemModalContainer(WmWindow* root, WmWindow* window) { |
32 DCHECK(window->IsSystemModal()); | 33 DCHECK(window->IsSystemModal()); |
33 | 34 |
34 // If screen lock is not active and user session is active, | 35 // If screen lock is not active and user session is active, |
35 // all modal windows are placed into the normal modal container. | 36 // all modal windows are placed into the normal modal container. |
36 // In case of missing transient parent (it could happen for alerts from | 37 // In case of missing transient parent (it could happen for alerts from |
37 // background pages) assume that the window belongs to user session. | 38 // background pages) assume that the window belongs to user session. |
38 if (!window->GetShell()->IsUserSessionBlocked() || | 39 if (!window->GetShell()->GetSessionStateDelegate()->IsUserSessionBlocked() || |
39 !window->GetTransientParent()) { | 40 !window->GetTransientParent()) { |
40 return root->GetChildByShellWindowId(kShellWindowId_SystemModalContainer); | 41 return root->GetChildByShellWindowId(kShellWindowId_SystemModalContainer); |
41 } | 42 } |
42 | 43 |
43 // Otherwise those that originate from LockScreen container and above are | 44 // Otherwise those that originate from LockScreen container and above are |
44 // placed in the screen lock modal container. | 45 // placed in the screen lock modal container. |
45 int window_container_id = | 46 int window_container_id = |
46 window->GetTransientParent()->GetParent()->GetShellWindowId(); | 47 window->GetTransientParent()->GetParent()->GetShellWindowId(); |
47 if (window_container_id < kShellWindowId_LockScreenContainer) | 48 if (window_container_id < kShellWindowId_LockScreenContainer) |
48 return root->GetChildByShellWindowId(kShellWindowId_SystemModalContainer); | 49 return root->GetChildByShellWindowId(kShellWindowId_SystemModalContainer); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 default: | 102 default: |
102 NOTREACHED() << "Window " << window->GetShellWindowId() | 103 NOTREACHED() << "Window " << window->GetShellWindowId() |
103 << " has unhandled type " << window->GetType(); | 104 << " has unhandled type " << window->GetType(); |
104 break; | 105 break; |
105 } | 106 } |
106 return nullptr; | 107 return nullptr; |
107 } | 108 } |
108 | 109 |
109 } // namespace wm | 110 } // namespace wm |
110 } // namespace ash | 111 } // namespace ash |
OLD | NEW |