| 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/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/shell_window_ids.h" | 8 #include "ash/common/shell_window_ids.h" |
| 9 #include "ash/common/wm/container_finder.h" |
| 9 #include "ash/common/wm/focus_rules.h" | 10 #include "ash/common/wm/focus_rules.h" |
| 10 #include "ash/common/wm/mru_window_tracker.h" | 11 #include "ash/common/wm/mru_window_tracker.h" |
| 11 #include "ash/common/wm/window_state.h" | 12 #include "ash/common/wm/window_state.h" |
| 12 #include "ash/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
| 13 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 14 #include "ash/wm/window_state_aura.h" | 15 #include "ash/wm/window_state_aura.h" |
| 15 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 16 | 17 |
| 17 namespace ash { | 18 namespace ash { |
| 18 namespace wm { | 19 namespace wm { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 } | 111 } |
| 111 return window; | 112 return window; |
| 112 } | 113 } |
| 113 | 114 |
| 114 //////////////////////////////////////////////////////////////////////////////// | 115 //////////////////////////////////////////////////////////////////////////////// |
| 115 // AshFocusRules, private: | 116 // AshFocusRules, private: |
| 116 | 117 |
| 117 aura::Window* AshFocusRules::GetTopmostWindowToActivateForContainerIndex( | 118 aura::Window* AshFocusRules::GetTopmostWindowToActivateForContainerIndex( |
| 118 int index, | 119 int index, |
| 119 aura::Window* ignore) const { | 120 aura::Window* ignore) const { |
| 120 aura::Window* window = NULL; | 121 aura::Window* window = nullptr; |
| 121 aura::Window* root = ignore ? ignore->GetRootWindow() : NULL; | 122 aura::Window* root = ignore ? ignore->GetRootWindow() : nullptr; |
| 122 aura::Window::Windows containers = Shell::GetContainersFromAllRootWindows( | 123 WmWindow::Windows containers = GetContainersFromAllRootWindows( |
| 123 kActivatableShellWindowIds[index], root); | 124 kActivatableShellWindowIds[index], WmWindowAura::Get(root)); |
| 124 for (aura::Window::Windows::const_iterator iter = containers.begin(); | 125 for (WmWindow* container : containers) { |
| 125 iter != containers.end() && !window; ++iter) { | 126 window = GetTopmostWindowToActivateInContainer( |
| 126 window = GetTopmostWindowToActivateInContainer((*iter), ignore); | 127 WmWindowAura::GetAuraWindow(container), ignore); |
| 128 if (window) |
| 129 return window; |
| 127 } | 130 } |
| 128 return window; | 131 return window; |
| 129 } | 132 } |
| 130 | 133 |
| 131 aura::Window* AshFocusRules::GetTopmostWindowToActivateInContainer( | 134 aura::Window* AshFocusRules::GetTopmostWindowToActivateInContainer( |
| 132 aura::Window* container, | 135 aura::Window* container, |
| 133 aura::Window* ignore) const { | 136 aura::Window* ignore) const { |
| 134 for (aura::Window::Windows::const_reverse_iterator i = | 137 for (aura::Window::Windows::const_reverse_iterator i = |
| 135 container->children().rbegin(); | 138 container->children().rbegin(); |
| 136 i != container->children().rend(); ++i) { | 139 i != container->children().rend(); ++i) { |
| 137 WindowState* window_state = GetWindowState(*i); | 140 WindowState* window_state = GetWindowState(*i); |
| 138 if (*i != ignore && window_state->CanActivate() && | 141 if (*i != ignore && window_state->CanActivate() && |
| 139 !window_state->IsMinimized()) | 142 !window_state->IsMinimized()) |
| 140 return *i; | 143 return *i; |
| 141 } | 144 } |
| 142 return NULL; | 145 return NULL; |
| 143 } | 146 } |
| 144 | 147 |
| 145 } // namespace wm | 148 } // namespace wm |
| 146 } // namespace ash | 149 } // namespace ash |
| OLD | NEW |