Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/wm/stacking_controller.h" | 5 #include "ash/wm/stacking_controller.h" |
| 6 | 6 |
| 7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/session_state_delegate.h" | 8 #include "ash/session_state_delegate.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 // all modal windows are placed into the normal modal container. | 121 // all modal windows are placed into the normal modal container. |
| 122 if (!Shell::GetInstance()->session_state_delegate()->IsScreenLocked() && | 122 if (!Shell::GetInstance()->session_state_delegate()->IsScreenLocked() && |
| 123 Shell::GetInstance()->session_state_delegate()-> | 123 Shell::GetInstance()->session_state_delegate()-> |
| 124 IsActiveUserSessionStarted()) { | 124 IsActiveUserSessionStarted()) { |
| 125 return GetContainerById(root, | 125 return GetContainerById(root, |
| 126 internal::kShellWindowId_SystemModalContainer); | 126 internal::kShellWindowId_SystemModalContainer); |
| 127 } | 127 } |
| 128 | 128 |
| 129 // Otherwise those that originate from LockScreen container and above are | 129 // Otherwise those that originate from LockScreen container and above are |
| 130 // placed in the screen lock modal container. | 130 // placed in the screen lock modal container. |
| 131 aura::Window* lock_container = | 131 |
| 132 GetContainerById(root, internal::kShellWindowId_LockScreenContainer); | 132 // Transient parent for window can be NULL for alerts from background pages |
| 133 int lock_container_id = lock_container->id(); | 133 // assume that all such alerts belong to user session. |
| 134 int window_container_id = window->transient_parent()->parent()->id(); | 134 int window_container_id = window->transient_parent() ? |
|
sky
2013/05/30 14:53:47
This code would be less mysterious if you made it
Dmitry Polukhin
2013/05/30 15:09:02
Done.
| |
| 135 window->transient_parent()->parent()->id() : | |
| 136 internal::kShellWindowId_WorkspaceContainer; | |
| 135 | 137 |
| 136 aura::Window* container = NULL; | 138 aura::Window* container = NULL; |
| 137 if (window_container_id < lock_container_id) { | 139 if (window_container_id < internal::kShellWindowId_LockScreenContainer) { |
| 138 container = GetContainerById( | 140 container = GetContainerById( |
| 139 root, internal::kShellWindowId_SystemModalContainer); | 141 root, internal::kShellWindowId_SystemModalContainer); |
| 140 } else { | 142 } else { |
| 141 container = GetContainerById( | 143 container = GetContainerById( |
| 142 root, internal::kShellWindowId_LockSystemModalContainer); | 144 root, internal::kShellWindowId_LockSystemModalContainer); |
| 143 } | 145 } |
| 144 | 146 |
| 145 return container; | 147 return container; |
| 146 } | 148 } |
| 147 | 149 |
| 148 // TODO(oshima): Remove this once extended desktop is on by default. | 150 // TODO(oshima): Remove this once extended desktop is on by default. |
| 149 internal::AlwaysOnTopController* | 151 internal::AlwaysOnTopController* |
| 150 StackingController::GetAlwaysOnTopController(aura::RootWindow* root_window) { | 152 StackingController::GetAlwaysOnTopController(aura::RootWindow* root_window) { |
| 151 internal::AlwaysOnTopController* controller = | 153 internal::AlwaysOnTopController* controller = |
| 152 root_window->GetProperty(internal::kAlwaysOnTopControllerKey); | 154 root_window->GetProperty(internal::kAlwaysOnTopControllerKey); |
| 153 if (!controller) { | 155 if (!controller) { |
| 154 controller = new internal::AlwaysOnTopController; | 156 controller = new internal::AlwaysOnTopController; |
| 155 controller->SetAlwaysOnTopContainer( | 157 controller->SetAlwaysOnTopContainer( |
| 156 root_window->GetChildById( | 158 root_window->GetChildById( |
| 157 internal::kShellWindowId_AlwaysOnTopContainer)); | 159 internal::kShellWindowId_AlwaysOnTopContainer)); |
| 158 // RootWindow owns the AlwaysOnTopController object. | 160 // RootWindow owns the AlwaysOnTopController object. |
| 159 root_window->SetProperty(internal::kAlwaysOnTopControllerKey, controller); | 161 root_window->SetProperty(internal::kAlwaysOnTopControllerKey, controller); |
| 160 } | 162 } |
| 161 return controller; | 163 return controller; |
| 162 } | 164 } |
| 163 | 165 |
| 164 } // namespace ash | 166 } // namespace ash |
| OLD | NEW |