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

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

Issue 2808723004: Renames WmShell to ShellPort (Closed)
Patch Set: feedback Created 3 years, 8 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
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/public/cpp/shell_window_ids.h" 9 #include "ash/public/cpp/shell_window_ids.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
11 #include "ash/shell_port.h"
11 #include "ash/wm/focus_rules.h" 12 #include "ash/wm/focus_rules.h"
12 #include "ash/wm/switchable_windows.h" 13 #include "ash/wm/switchable_windows.h"
13 #include "ash/wm/window_state.h" 14 #include "ash/wm/window_state.h"
14 #include "ash/wm/window_util.h" 15 #include "ash/wm/window_util.h"
15 #include "ash/wm_shell.h"
16 #include "ash/wm_window.h" 16 #include "ash/wm_window.h"
17 #include "base/bind.h" 17 #include "base/bind.h"
18 #include "ui/aura/window.h" 18 #include "ui/aura/window.h"
19 #include "ui/wm/public/activation_client.h" 19 #include "ui/wm/public/activation_client.h"
20 20
21 namespace ash { 21 namespace ash {
22 22
23 namespace { 23 namespace {
24 24
25 using CanActivateWindowPredicate = base::Callback<bool(WmWindow*)>; 25 using CanActivateWindowPredicate = base::Callback<bool(WmWindow*)>;
(...skipping 14 matching lines...) Expand all
40 40
41 // Returns a list of windows ordered by their stacking order. 41 // Returns a list of windows ordered by their stacking order.
42 // If |mru_windows| is passed, these windows are moved to the front of the list. 42 // If |mru_windows| is passed, these windows are moved to the front of the list.
43 // It uses the given |should_include_window_predicate| to determine whether to 43 // It uses the given |should_include_window_predicate| to determine whether to
44 // include a window in the returned list or not. 44 // include a window in the returned list or not.
45 MruWindowTracker::WindowList BuildWindowListInternal( 45 MruWindowTracker::WindowList BuildWindowListInternal(
46 const std::list<WmWindow*>* mru_windows, 46 const std::list<WmWindow*>* mru_windows,
47 const CanActivateWindowPredicate& should_include_window_predicate) { 47 const CanActivateWindowPredicate& should_include_window_predicate) {
48 MruWindowTracker::WindowList windows; 48 MruWindowTracker::WindowList windows;
49 WmWindow* active_root = Shell::GetWmRootWindowForNewWindows(); 49 WmWindow* active_root = Shell::GetWmRootWindowForNewWindows();
50 for (WmWindow* window : WmShell::Get()->GetAllRootWindows()) { 50 for (WmWindow* window : ShellPort::Get()->GetAllRootWindows()) {
51 if (window == active_root) 51 if (window == active_root)
52 continue; 52 continue;
53 for (size_t i = 0; i < wm::kSwitchableWindowContainerIdsLength; ++i) 53 for (size_t i = 0; i < wm::kSwitchableWindowContainerIdsLength; ++i)
54 AddTrackedWindows(window, wm::kSwitchableWindowContainerIds[i], &windows); 54 AddTrackedWindows(window, wm::kSwitchableWindowContainerIds[i], &windows);
55 } 55 }
56 56
57 // Add windows in the active root windows last so that the topmost window 57 // Add windows in the active root windows last so that the topmost window
58 // in the active root window becomes the front of the list. 58 // in the active root window becomes the front of the list.
59 for (size_t i = 0; i < wm::kSwitchableWindowContainerIdsLength; ++i) 59 for (size_t i = 0; i < wm::kSwitchableWindowContainerIdsLength; ++i)
60 AddTrackedWindows(active_root, wm::kSwitchableWindowContainerIds[i], 60 AddTrackedWindows(active_root, wm::kSwitchableWindowContainerIds[i],
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 void MruWindowTracker::OnWindowDestroyed(aura::Window* window) { 157 void MruWindowTracker::OnWindowDestroyed(aura::Window* window) {
158 // It's possible for OnWindowActivated() to be called after 158 // It's possible for OnWindowActivated() to be called after
159 // OnWindowDestroying(). This means we need to override OnWindowDestroyed() 159 // OnWindowDestroying(). This means we need to override OnWindowDestroyed()
160 // else we may end up with a deleted window in |mru_windows_|. 160 // else we may end up with a deleted window in |mru_windows_|.
161 mru_windows_.remove(WmWindow::Get(window)); 161 mru_windows_.remove(WmWindow::Get(window));
162 window->RemoveObserver(this); 162 window->RemoveObserver(this);
163 } 163 }
164 164
165 } // namespace ash 165 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698