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