| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/common/wm/mru_window_tracker.h" | 5 #include "ash/common/wm/mru_window_tracker.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/common/shell_window_ids.h" | 9 #include "ash/common/shell_window_ids.h" |
| 10 #include "ash/common/wm/focus_rules.h" | 10 #include "ash/common/wm/focus_rules.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 } | 43 } |
| 44 | 44 |
| 45 // Returns a list of windows ordered by their stacking order. | 45 // Returns a list of windows ordered by their stacking order. |
| 46 // If |mru_windows| is passed, these windows are moved to the front of the list. | 46 // If |mru_windows| is passed, these windows are moved to the front of the list. |
| 47 // It uses the given |should_include_window_predicate| to determine whether to | 47 // It uses the given |should_include_window_predicate| to determine whether to |
| 48 // include a window in the returned list or not. | 48 // include a window in the returned list or not. |
| 49 MruWindowTracker::WindowList BuildWindowListInternal( | 49 MruWindowTracker::WindowList BuildWindowListInternal( |
| 50 const std::list<WmWindow*>* mru_windows, | 50 const std::list<WmWindow*>* mru_windows, |
| 51 const CanActivateWindowPredicate& should_include_window_predicate) { | 51 const CanActivateWindowPredicate& should_include_window_predicate) { |
| 52 MruWindowTracker::WindowList windows; | 52 MruWindowTracker::WindowList windows; |
| 53 WmWindow* active_root = WmShell::Get()->GetRootWindowForNewWindows(); | 53 WmWindow* active_root = WmShell::Get()->root_window_for_new_windows(); |
| 54 for (WmWindow* window : WmShell::Get()->GetAllRootWindows()) { | 54 for (WmWindow* window : WmShell::Get()->GetAllRootWindows()) { |
| 55 if (window == active_root) | 55 if (window == active_root) |
| 56 continue; | 56 continue; |
| 57 for (size_t i = 0; i < wm::kSwitchableWindowContainerIdsLength; ++i) | 57 for (size_t i = 0; i < wm::kSwitchableWindowContainerIdsLength; ++i) |
| 58 AddTrackedWindows(window, wm::kSwitchableWindowContainerIds[i], &windows); | 58 AddTrackedWindows(window, wm::kSwitchableWindowContainerIds[i], &windows); |
| 59 } | 59 } |
| 60 | 60 |
| 61 // Add windows in the active root windows last so that the topmost window | 61 // Add windows in the active root windows last so that the topmost window |
| 62 // in the active root window becomes the front of the list. | 62 // in the active root window becomes the front of the list. |
| 63 for (size_t i = 0; i < wm::kSwitchableWindowContainerIdsLength; ++i) | 63 for (size_t i = 0; i < wm::kSwitchableWindowContainerIdsLength; ++i) |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 void MruWindowTracker::OnWindowDestroyed(WmWindow* window) { | 164 void MruWindowTracker::OnWindowDestroyed(WmWindow* window) { |
| 165 // It's possible for OnWindowActivated() to be called after | 165 // It's possible for OnWindowActivated() to be called after |
| 166 // OnWindowDestroying(). This means we need to override OnWindowDestroyed() | 166 // OnWindowDestroying(). This means we need to override OnWindowDestroyed() |
| 167 // else we may end up with a deleted window in |mru_windows_|. | 167 // else we may end up with a deleted window in |mru_windows_|. |
| 168 mru_windows_.remove(window); | 168 mru_windows_.remove(window); |
| 169 window->RemoveObserver(this); | 169 window->RemoveObserver(this); |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace ash | 172 } // namespace ash |
| OLD | NEW |