Index: ash/wm/mru_window_tracker.cc |
diff --git a/ash/wm/mru_window_tracker.cc b/ash/wm/mru_window_tracker.cc |
index 0a63e32a47a26c84c13269cf34344ba895f2d643..a5769ec05a1fcf741f00646787fa375cc2848f49 100644 |
--- a/ash/wm/mru_window_tracker.cc |
+++ b/ash/wm/mru_window_tracker.cc |
@@ -181,6 +181,29 @@ void MruWindowTracker::SetIgnoreActivations(bool ignore) { |
SetActiveWindow(wm::GetActiveWindow()); |
} |
+const aura::Window* MruWindowTracker::GetMruWindowInRoot( |
+ const aura::Window* root_window) { |
+ if (ignore_window_activations_) { |
+ // While cycling windows, the activated windows list will not track window |
+ // activations so as to correctly maintain the most recently used window |
+ // order. Despite this, we should still treat the currently active window as |
+ // most recently used for the purpose of window management. |
+ aura::Window* active_window = wm::GetActiveWindow(); |
+ if (active_window && active_window->GetRootWindow() == root_window && |
+ IsSwitchableContainer(active_window->parent())) { |
+ return active_window; |
+ } |
+ } |
+ |
+ for (std::list<aura::Window*>::const_iterator iter = mru_windows_.begin(); |
+ iter != mru_windows_.end(); ++iter) { |
+ if ((*iter)->GetRootWindow() == root_window && |
+ IsSwitchableContainer((*iter)->parent())) |
+ return *iter; |
+ } |
+ return NULL; |
+} |
+ |
////////////////////////////////////////////////////////////////////////////// |
// MruWindowTracker, private: |