Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Unified Diff: ash/wm/mru_window_tracker.cc

Issue 149493008: Use active window if on current workspace for fullscreen mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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:

Powered by Google App Engine
This is Rietveld 408576698