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

Side by Side Diff: ash/common/wm/mru_window_tracker.cc

Issue 2739553005: Moves maintaining root_window_for_new_windows_ to Shell (Closed)
Patch Set: remove ash:: Created 3 years, 9 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
« no previous file with comments | « ash/common/wm/container_finder.cc ('k') | ash/common/wm/window_cycle_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 27 matching lines...) Expand all
38 } 38 }
39 39
40 // Returns a list of windows ordered by their stacking order. 40 // Returns a list of windows ordered by their stacking order.
41 // If |mru_windows| is passed, these windows are moved to the front of the list. 41 // If |mru_windows| is passed, these windows are moved to the front of the list.
42 // It uses the given |should_include_window_predicate| to determine whether to 42 // It uses the given |should_include_window_predicate| to determine whether to
43 // include a window in the returned list or not. 43 // include a window in the returned list or not.
44 MruWindowTracker::WindowList BuildWindowListInternal( 44 MruWindowTracker::WindowList BuildWindowListInternal(
45 const std::list<WmWindow*>* mru_windows, 45 const std::list<WmWindow*>* mru_windows,
46 const CanActivateWindowPredicate& should_include_window_predicate) { 46 const CanActivateWindowPredicate& should_include_window_predicate) {
47 MruWindowTracker::WindowList windows; 47 MruWindowTracker::WindowList windows;
48 WmWindow* active_root = WmShell::Get()->GetRootWindowForNewWindows(); 48 WmWindow* active_root = Shell::GetWmRootWindowForNewWindows();
49 for (WmWindow* window : WmShell::Get()->GetAllRootWindows()) { 49 for (WmWindow* window : WmShell::Get()->GetAllRootWindows()) {
50 if (window == active_root) 50 if (window == active_root)
51 continue; 51 continue;
52 for (size_t i = 0; i < wm::kSwitchableWindowContainerIdsLength; ++i) 52 for (size_t i = 0; i < wm::kSwitchableWindowContainerIdsLength; ++i)
53 AddTrackedWindows(window, wm::kSwitchableWindowContainerIds[i], &windows); 53 AddTrackedWindows(window, wm::kSwitchableWindowContainerIds[i], &windows);
54 } 54 }
55 55
56 // Add windows in the active root windows last so that the topmost window 56 // Add windows in the active root windows last so that the topmost window
57 // in the active root window becomes the front of the list. 57 // in the active root window becomes the front of the list.
58 for (size_t i = 0; i < wm::kSwitchableWindowContainerIdsLength; ++i) 58 for (size_t i = 0; i < wm::kSwitchableWindowContainerIdsLength; ++i)
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 void MruWindowTracker::OnWindowDestroyed(aura::Window* window) { 156 void MruWindowTracker::OnWindowDestroyed(aura::Window* window) {
157 // It's possible for OnWindowActivated() to be called after 157 // It's possible for OnWindowActivated() to be called after
158 // OnWindowDestroying(). This means we need to override OnWindowDestroyed() 158 // OnWindowDestroying(). This means we need to override OnWindowDestroyed()
159 // else we may end up with a deleted window in |mru_windows_|. 159 // else we may end up with a deleted window in |mru_windows_|.
160 mru_windows_.remove(WmWindow::Get(window)); 160 mru_windows_.remove(WmWindow::Get(window));
161 window->RemoveObserver(this); 161 window->RemoveObserver(this);
162 } 162 }
163 163
164 } // namespace ash 164 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/container_finder.cc ('k') | ash/common/wm/window_cycle_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698