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/ash_focus_rules.h" | 5 #include "ash/wm/ash_focus_rules.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_util.h" | 9 #include "ash/wm/window_state.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
11 | 11 |
12 namespace ash { | 12 namespace ash { |
13 namespace wm { | 13 namespace wm { |
14 namespace { | 14 namespace { |
15 | 15 |
16 // These are the list of container ids of containers which may contain windows | 16 // These are the list of container ids of containers which may contain windows |
17 // that need to be activated in the order that they should be activated. | 17 // that need to be activated in the order that they should be activated. |
18 const int kWindowContainerIds[] = { | 18 const int kWindowContainerIds[] = { |
19 internal::kShellWindowId_LockSystemModalContainer, | 19 internal::kShellWindowId_LockSystemModalContainer, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 return false; | 67 return false; |
68 } | 68 } |
69 | 69 |
70 bool AshFocusRules::IsWindowConsideredVisibleForActivation( | 70 bool AshFocusRules::IsWindowConsideredVisibleForActivation( |
71 aura::Window* window) const { | 71 aura::Window* window) const { |
72 if (BaseFocusRules::IsWindowConsideredVisibleForActivation(window)) | 72 if (BaseFocusRules::IsWindowConsideredVisibleForActivation(window)) |
73 return true; | 73 return true; |
74 | 74 |
75 // Minimized windows are hidden in their minimized state, but they can always | 75 // Minimized windows are hidden in their minimized state, but they can always |
76 // be activated. | 76 // be activated. |
77 if (wm::IsWindowMinimized(window)) | 77 if (wm::GetWindowState(window)->IsMinimized()) |
78 return true; | 78 return true; |
79 | 79 |
80 return window->TargetVisibility() && (window->parent()->id() == | 80 return window->TargetVisibility() && (window->parent()->id() == |
81 internal::kShellWindowId_DefaultContainer || window->parent()->id() == | 81 internal::kShellWindowId_DefaultContainer || window->parent()->id() == |
82 internal::kShellWindowId_LockScreenContainer); | 82 internal::kShellWindowId_LockScreenContainer); |
83 } | 83 } |
84 | 84 |
85 bool AshFocusRules::CanActivateWindow(aura::Window* window) const { | 85 bool AshFocusRules::CanActivateWindow(aura::Window* window) const { |
86 // Clearing activation is always permissible. | 86 // Clearing activation is always permissible. |
87 if (!window) | 87 if (!window) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 return window; | 147 return window; |
148 } | 148 } |
149 | 149 |
150 aura::Window* AshFocusRules::GetTopmostWindowToActivateInContainer( | 150 aura::Window* AshFocusRules::GetTopmostWindowToActivateInContainer( |
151 aura::Window* container, | 151 aura::Window* container, |
152 aura::Window* ignore) const { | 152 aura::Window* ignore) const { |
153 for (aura::Window::Windows::const_reverse_iterator i = | 153 for (aura::Window::Windows::const_reverse_iterator i = |
154 container->children().rbegin(); | 154 container->children().rbegin(); |
155 i != container->children().rend(); | 155 i != container->children().rend(); |
156 ++i) { | 156 ++i) { |
157 if (*i != ignore && CanActivateWindow(*i) && !wm::IsWindowMinimized(*i)) | 157 WindowState* window_state = GetWindowState(*i); |
| 158 if (*i != ignore && |
| 159 window_state->CanActivate() && |
| 160 !window_state->IsMinimized()) |
158 return *i; | 161 return *i; |
159 } | 162 } |
160 return NULL; | 163 return NULL; |
161 } | 164 } |
162 | 165 |
163 } // namespace wm | 166 } // namespace wm |
164 } // namespace ash | 167 } // namespace ash |
OLD | NEW |