| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 return true; | 73 return true; |
| 74 } | 74 } |
| 75 | 75 |
| 76 aura::Window* AshFocusRules::GetNextActivatableWindow( | 76 aura::Window* AshFocusRules::GetNextActivatableWindow( |
| 77 aura::Window* ignore) const { | 77 aura::Window* ignore) const { |
| 78 DCHECK(ignore); | 78 DCHECK(ignore); |
| 79 | 79 |
| 80 // Start from the container of the most-recently-used window. If the list of | 80 // Start from the container of the most-recently-used window. If the list of |
| 81 // MRU windows is empty, then start from the container of the window that just | 81 // MRU windows is empty, then start from the container of the window that just |
| 82 // lost focus |ignore|. | 82 // lost focus |ignore|. |
| 83 ash::MruWindowTracker* mru = ash::Shell::GetInstance()->mru_window_tracker(); | 83 MruWindowTracker* mru = WmShell::Get()->mru_window_tracker(); |
| 84 std::vector<WmWindow*> windows = mru->BuildMruWindowList(); | 84 std::vector<WmWindow*> windows = mru->BuildMruWindowList(); |
| 85 aura::Window* starting_window = | 85 aura::Window* starting_window = |
| 86 windows.empty() ? ignore : WmWindowAura::GetAuraWindow(windows[0]); | 86 windows.empty() ? ignore : WmWindowAura::GetAuraWindow(windows[0]); |
| 87 | 87 |
| 88 // Look for windows to focus in |starting_window|'s container. If none are | 88 // Look for windows to focus in |starting_window|'s container. If none are |
| 89 // found, we look in all the containers in front of |starting_window|'s | 89 // found, we look in all the containers in front of |starting_window|'s |
| 90 // container, then all behind. | 90 // container, then all behind. |
| 91 int starting_container_index = 0; | 91 int starting_container_index = 0; |
| 92 aura::Window* root = starting_window->GetRootWindow(); | 92 aura::Window* root = starting_window->GetRootWindow(); |
| 93 if (!root) | 93 if (!root) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 WindowState* window_state = GetWindowState(*i); | 138 WindowState* window_state = GetWindowState(*i); |
| 139 if (*i != ignore && window_state->CanActivate() && | 139 if (*i != ignore && window_state->CanActivate() && |
| 140 !window_state->IsMinimized()) | 140 !window_state->IsMinimized()) |
| 141 return *i; | 141 return *i; |
| 142 } | 142 } |
| 143 return NULL; | 143 return NULL; |
| 144 } | 144 } |
| 145 | 145 |
| 146 } // namespace wm | 146 } // namespace wm |
| 147 } // namespace ash | 147 } // namespace ash |
| OLD | NEW |