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

Side by Side 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: Update fullscreen state tracking in workspace and only consider switchable containers for active no… 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/wm/mru_window_tracker.h" 5 #include "ash/wm/mru_window_tracker.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/session_state_delegate.h" 9 #include "ash/session_state_delegate.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 void MruWindowTracker::SetIgnoreActivations(bool ignore) { 175 void MruWindowTracker::SetIgnoreActivations(bool ignore) {
176 ignore_window_activations_ = ignore; 176 ignore_window_activations_ = ignore;
177 177
178 // If no longer ignoring window activations, move currently active window 178 // If no longer ignoring window activations, move currently active window
179 // to front. 179 // to front.
180 if (!ignore) 180 if (!ignore)
181 SetActiveWindow(wm::GetActiveWindow()); 181 SetActiveWindow(wm::GetActiveWindow());
182 } 182 }
183 183
184 const aura::Window* MruWindowTracker::GetMruWindowInRoot(
185 const aura::Window* root_window) {
186 if (ignore_window_activations_) {
187 // While cycling windows, the activated windows list will not track window
188 // activations so as to correctly maintain the most recently used window
189 // order. Despite this, we should still treat the currently active window as
190 // most recently used for the purpose of window management.
191 aura::Window* active_window = wm::GetActiveWindow();
192 if (active_window && active_window->GetRootWindow() == root_window &&
193 IsSwitchableContainer(active_window->parent())) {
194 return active_window;
195 }
196 }
197
198 for (std::list<aura::Window*>::const_iterator iter = mru_windows_.begin();
199 iter != mru_windows_.end(); ++iter) {
200 if ((*iter)->GetRootWindow() == root_window &&
201 IsSwitchableContainer((*iter)->parent()))
202 return *iter;
203 }
204 return NULL;
205 }
206
184 ////////////////////////////////////////////////////////////////////////////// 207 //////////////////////////////////////////////////////////////////////////////
185 // MruWindowTracker, private: 208 // MruWindowTracker, private:
186 209
187 void MruWindowTracker::SetActiveWindow(aura::Window* active_window) { 210 void MruWindowTracker::SetActiveWindow(aura::Window* active_window) {
188 if (!active_window) 211 if (!active_window)
189 return; 212 return;
190 213
191 std::list<aura::Window*>::iterator iter = 214 std::list<aura::Window*>::iterator iter =
192 std::find(mru_windows_.begin(), mru_windows_.end(), active_window); 215 std::find(mru_windows_.begin(), mru_windows_.end(), active_window);
193 // Observe all newly tracked windows. 216 // Observe all newly tracked windows.
(...skipping 16 matching lines...) Expand all
210 233
211 void MruWindowTracker::OnWindowDestroyed(aura::Window* window) { 234 void MruWindowTracker::OnWindowDestroyed(aura::Window* window) {
212 // It's possible for OnWindowActivated() to be called after 235 // It's possible for OnWindowActivated() to be called after
213 // OnWindowDestroying(). This means we need to override OnWindowDestroyed() 236 // OnWindowDestroying(). This means we need to override OnWindowDestroyed()
214 // else we may end up with a deleted window in |mru_windows_|. 237 // else we may end up with a deleted window in |mru_windows_|.
215 mru_windows_.remove(window); 238 mru_windows_.remove(window);
216 window->RemoveObserver(this); 239 window->RemoveObserver(this);
217 } 240 }
218 241
219 } // namespace ash 242 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698