| 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/wm/focus_rules.h" | 9 #include "ash/common/wm/focus_rules.h" |
| 10 #include "ash/common/wm/switchable_windows.h" | 10 #include "ash/common/wm/switchable_windows.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 // Add windows in the active root windows last so that the topmost window | 53 // Add windows in the active root windows last so that the topmost window |
| 54 // in the active root window becomes the front of the list. | 54 // in the active root window becomes the front of the list. |
| 55 for (size_t i = 0; i < wm::kSwitchableWindowContainerIdsLength; ++i) | 55 for (size_t i = 0; i < wm::kSwitchableWindowContainerIdsLength; ++i) |
| 56 AddTrackedWindows(active_root, wm::kSwitchableWindowContainerIds[i], | 56 AddTrackedWindows(active_root, wm::kSwitchableWindowContainerIds[i], |
| 57 &windows); | 57 &windows); |
| 58 | 58 |
| 59 // Removes unfocusable windows. | 59 // Removes unfocusable windows. |
| 60 std::vector<WmWindow*>::iterator itr = windows.begin(); | 60 std::vector<WmWindow*>::iterator itr = windows.begin(); |
| 61 while (itr != windows.end()) { | 61 while (itr != windows.end()) { |
| 62 if (!should_include_window_predicate.Run(*itr) || | 62 if (!should_include_window_predicate.Run(*itr)) |
| 63 (*itr)->GetWindowState()->ShouldBeExcludedFromMru()) | |
| 64 itr = windows.erase(itr); | 63 itr = windows.erase(itr); |
| 65 else | 64 else |
| 66 ++itr; | 65 ++itr; |
| 67 } | 66 } |
| 68 | 67 |
| 69 // Put the windows in the mru_windows list at the head, if it's available. | 68 // Put the windows in the mru_windows list at the head, if it's available. |
| 70 if (mru_windows) { | 69 if (mru_windows) { |
| 71 // Iterate through the list backwards, so that we can move each window to | 70 // Iterate through the list backwards, so that we can move each window to |
| 72 // the front of the windows list as we find them. | 71 // the front of the windows list as we find them. |
| 73 for (auto ix = mru_windows->rbegin(); ix != mru_windows->rend(); ++ix) { | 72 for (auto ix = mru_windows->rbegin(); ix != mru_windows->rend(); ++ix) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 151 |
| 153 void MruWindowTracker::OnWindowDestroyed(WmWindow* window) { | 152 void MruWindowTracker::OnWindowDestroyed(WmWindow* window) { |
| 154 // It's possible for OnWindowActivated() to be called after | 153 // It's possible for OnWindowActivated() to be called after |
| 155 // OnWindowDestroying(). This means we need to override OnWindowDestroyed() | 154 // OnWindowDestroying(). This means we need to override OnWindowDestroyed() |
| 156 // else we may end up with a deleted window in |mru_windows_|. | 155 // else we may end up with a deleted window in |mru_windows_|. |
| 157 mru_windows_.remove(window); | 156 mru_windows_.remove(window); |
| 158 window->RemoveObserver(this); | 157 window->RemoveObserver(this); |
| 159 } | 158 } |
| 160 | 159 |
| 161 } // namespace ash | 160 } // namespace ash |
| OLD | NEW |