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..962f5c9314271caa254cc1670e15ad958fba2ced 100644 |
--- a/ash/wm/mru_window_tracker.cc |
+++ b/ash/wm/mru_window_tracker.cc |
@@ -132,6 +132,20 @@ MruWindowTracker::WindowList BuildWindowListInternal( |
return windows; |
} |
+// A comparator for locating a window in a given root window. |
+struct WindowInRoot |
+ : public std::unary_function<const aura::Window*, bool> { |
+ explicit WindowInRoot(const aura::Window* root) |
+ : root_window(root) { |
+ } |
+ |
+ bool operator()(const aura::Window* item) const { |
+ return item->GetRootWindow() == root_window; |
oshima
2014/02/10 19:21:06
I'd prefer just looping for simple pointer compari
flackr
2014/02/10 21:45:28
Done.
|
+ } |
+ |
+ const aura::Window* root_window; |
+}; |
+ |
} // namespace |
const int kSwitchableWindowContainerIds[] = { |
@@ -181,6 +195,16 @@ void MruWindowTracker::SetIgnoreActivations(bool ignore) { |
SetActiveWindow(wm::GetActiveWindow()); |
} |
+const aura::Window* MruWindowTracker::GetMruWindowInRoot( |
+ const aura::Window* root_window) { |
+ std::list<aura::Window*>::const_iterator mru_in_root = |
+ std::find_if(mru_windows_.begin(), mru_windows_.end(), |
+ WindowInRoot(root_window)); |
+ if (mru_in_root == mru_windows_.end()) |
+ return NULL; |
+ return *mru_in_root; |
+} |
+ |
////////////////////////////////////////////////////////////////////////////// |
// MruWindowTracker, private: |