| 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/focus_rules.h" | 9 #include "ash/common/wm/focus_rules.h" |
| 10 #include "ash/common/wm/mru_window_tracker.h" | 10 #include "ash/common/wm/mru_window_tracker.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 return true; | 26 return true; |
| 27 } | 27 } |
| 28 return false; | 28 return false; |
| 29 } | 29 } |
| 30 | 30 |
| 31 } // namespace | 31 } // namespace |
| 32 | 32 |
| 33 //////////////////////////////////////////////////////////////////////////////// | 33 //////////////////////////////////////////////////////////////////////////////// |
| 34 // AshFocusRules, public: | 34 // AshFocusRules, public: |
| 35 | 35 |
| 36 AshFocusRules::AshFocusRules() { | 36 AshFocusRules::AshFocusRules() {} |
| 37 } | |
| 38 | 37 |
| 39 AshFocusRules::~AshFocusRules() { | 38 AshFocusRules::~AshFocusRules() {} |
| 40 } | |
| 41 | 39 |
| 42 bool AshFocusRules::IsWindowConsideredActivatable(aura::Window* window) const { | 40 bool AshFocusRules::IsWindowConsideredActivatable(aura::Window* window) const { |
| 43 return ash::IsWindowConsideredActivatable(WmWindowAura::Get(window)); | 41 return ash::IsWindowConsideredActivatable(WmWindowAura::Get(window)); |
| 44 } | 42 } |
| 45 | 43 |
| 46 //////////////////////////////////////////////////////////////////////////////// | 44 //////////////////////////////////////////////////////////////////////////////// |
| 47 // AshFocusRules, ::wm::FocusRules: | 45 // AshFocusRules, ::wm::FocusRules: |
| 48 | 46 |
| 49 bool AshFocusRules::IsToplevelWindow(aura::Window* window) const { | 47 bool AshFocusRules::IsToplevelWindow(aura::Window* window) const { |
| 50 return ash::IsToplevelWindow(WmWindowAura::Get(window)); | 48 return ash::IsToplevelWindow(WmWindowAura::Get(window)); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 // AshFocusRules, private: | 116 // AshFocusRules, private: |
| 119 | 117 |
| 120 aura::Window* AshFocusRules::GetTopmostWindowToActivateForContainerIndex( | 118 aura::Window* AshFocusRules::GetTopmostWindowToActivateForContainerIndex( |
| 121 int index, | 119 int index, |
| 122 aura::Window* ignore) const { | 120 aura::Window* ignore) const { |
| 123 aura::Window* window = NULL; | 121 aura::Window* window = NULL; |
| 124 aura::Window* root = ignore ? ignore->GetRootWindow() : NULL; | 122 aura::Window* root = ignore ? ignore->GetRootWindow() : NULL; |
| 125 aura::Window::Windows containers = Shell::GetContainersFromAllRootWindows( | 123 aura::Window::Windows containers = Shell::GetContainersFromAllRootWindows( |
| 126 kActivatableShellWindowIds[index], root); | 124 kActivatableShellWindowIds[index], root); |
| 127 for (aura::Window::Windows::const_iterator iter = containers.begin(); | 125 for (aura::Window::Windows::const_iterator iter = containers.begin(); |
| 128 iter != containers.end() && !window; ++iter) { | 126 iter != containers.end() && !window; ++iter) { |
| 129 window = GetTopmostWindowToActivateInContainer((*iter), ignore); | 127 window = GetTopmostWindowToActivateInContainer((*iter), ignore); |
| 130 } | 128 } |
| 131 return window; | 129 return window; |
| 132 } | 130 } |
| 133 | 131 |
| 134 aura::Window* AshFocusRules::GetTopmostWindowToActivateInContainer( | 132 aura::Window* AshFocusRules::GetTopmostWindowToActivateInContainer( |
| 135 aura::Window* container, | 133 aura::Window* container, |
| 136 aura::Window* ignore) const { | 134 aura::Window* ignore) const { |
| 137 for (aura::Window::Windows::const_reverse_iterator i = | 135 for (aura::Window::Windows::const_reverse_iterator i = |
| 138 container->children().rbegin(); | 136 container->children().rbegin(); |
| 139 i != container->children().rend(); | 137 i != container->children().rend(); ++i) { |
| 140 ++i) { | |
| 141 WindowState* window_state = GetWindowState(*i); | 138 WindowState* window_state = GetWindowState(*i); |
| 142 if (*i != ignore && | 139 if (*i != ignore && window_state->CanActivate() && |
| 143 window_state->CanActivate() && | |
| 144 !window_state->IsMinimized()) | 140 !window_state->IsMinimized()) |
| 145 return *i; | 141 return *i; |
| 146 } | 142 } |
| 147 return NULL; | 143 return NULL; |
| 148 } | 144 } |
| 149 | 145 |
| 150 } // namespace wm | 146 } // namespace wm |
| 151 } // namespace ash | 147 } // namespace ash |
| OLD | NEW |