| 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/activation_controller.h" | 5 #include "ash/wm/activation_controller.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
| 9 #include "ash/wm/window_modality_controller.h" | 9 #include "ash/wm/window_modality_controller.h" |
| 10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 if (!window) | 112 if (!window) |
| 113 return; | 113 return; |
| 114 // Nothing may actually have changed. | 114 // Nothing may actually have changed. |
| 115 aura::Window* old_active = GetActiveWindow(); | 115 aura::Window* old_active = GetActiveWindow(); |
| 116 if (old_active == window) | 116 if (old_active == window) |
| 117 return; | 117 return; |
| 118 // The stacking client may impose rules on what window configurations can be | 118 // The stacking client may impose rules on what window configurations can be |
| 119 // activated or deactivated. | 119 // activated or deactivated. |
| 120 if (!CanActivateWindow(window)) | 120 if (!CanActivateWindow(window)) |
| 121 return; | 121 return; |
| 122 // If the screen is locked, just bring the window to top so that |
| 123 // it will be activated when the lock window is destroyed. |
| 124 if (window && !window->CanReceiveEvents()) { |
| 125 StackTransientParentsBelowModalWindow(window); |
| 126 window->parent()->StackChildAtTop(window); |
| 127 return; |
| 128 } |
| 122 | 129 |
| 123 if (!window->Contains(window->GetFocusManager()->GetFocusedWindow())) | 130 if (!window->Contains(window->GetFocusManager()->GetFocusedWindow())) |
| 124 window->GetFocusManager()->SetFocusedWindow(window); | 131 window->GetFocusManager()->SetFocusedWindow(window); |
| 125 aura::RootWindow::GetInstance()->SetProperty( | 132 aura::RootWindow::GetInstance()->SetProperty( |
| 126 aura::client::kRootWindowActiveWindow, | 133 aura::client::kRootWindowActiveWindow, |
| 127 window); | 134 window); |
| 128 // Invoke OnLostActive after we've changed the active window. That way if the | 135 // Invoke OnLostActive after we've changed the active window. That way if the |
| 129 // delegate queries for active state it doesn't think the window is still | 136 // delegate queries for active state it doesn't think the window is still |
| 130 // active. | 137 // active. |
| 131 if (old_active && aura::client::GetActivationDelegate(old_active)) | 138 if (old_active && aura::client::GetActivationDelegate(old_active)) |
| 132 aura::client::GetActivationDelegate(old_active)->OnLostActive(); | 139 aura::client::GetActivationDelegate(old_active)->OnLostActive(); |
| 140 |
| 133 if (window) { | 141 if (window) { |
| 134 StackTransientParentsBelowModalWindow(window); | 142 StackTransientParentsBelowModalWindow(window); |
| 135 window->parent()->StackChildAtTop(window); | 143 window->parent()->StackChildAtTop(window); |
| 136 if (aura::client::GetActivationDelegate(window)) | 144 if (aura::client::GetActivationDelegate(window)) |
| 137 aura::client::GetActivationDelegate(window)->OnActivated(); | 145 aura::client::GetActivationDelegate(window)->OnActivated(); |
| 138 } | 146 } |
| 139 } | 147 } |
| 140 | 148 |
| 141 void ActivationController::DeactivateWindow(aura::Window* window) { | 149 void ActivationController::DeactivateWindow(aura::Window* window) { |
| 142 if (window) | 150 if (window) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 i != container->children().rend(); | 212 i != container->children().rend(); |
| 205 ++i) { | 213 ++i) { |
| 206 if (*i != ignore && CanActivateWindow(*i)) | 214 if (*i != ignore && CanActivateWindow(*i)) |
| 207 return *i; | 215 return *i; |
| 208 } | 216 } |
| 209 return NULL; | 217 return NULL; |
| 210 } | 218 } |
| 211 | 219 |
| 212 } // namespace internal | 220 } // namespace internal |
| 213 } // namespace ash | 221 } // namespace ash |
| OLD | NEW |