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

Side by Side Diff: ash/aura/wm_shell_aura.cc

Issue 2035543004: Shuffles and renames ash/common/wm classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: random changes for chrome tests Created 4 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/aura/wm_globals_aura.h" 5 #include "ash/aura/wm_shell_aura.h"
6 6
7 #include "ash/common/wm/wm_activation_observer.h" 7 #include "ash/aura/wm_window_aura.h"
8 #include "ash/common/wm/wm_display_observer.h" 8 #include "ash/common/wm_activation_observer.h"
9 #include "ash/common/wm/wm_overview_mode_observer.h" 9 #include "ash/common/wm_display_observer.h"
10 #include "ash/common/wm_overview_mode_observer.h"
10 #include "ash/display/window_tree_host_manager.h" 11 #include "ash/display/window_tree_host_manager.h"
11 #include "ash/session/session_state_delegate.h" 12 #include "ash/session/session_state_delegate.h"
12 #include "ash/shell.h" 13 #include "ash/shell.h"
13 #include "ash/shell_delegate.h" 14 #include "ash/shell_delegate.h"
14 #include "ash/wm/aura/wm_window_aura.h"
15 #include "ash/wm/drag_window_resizer.h" 15 #include "ash/wm/drag_window_resizer.h"
16 #include "ash/wm/mru_window_tracker.h" 16 #include "ash/wm/mru_window_tracker.h"
17 #include "ash/wm/overview/window_selector_controller.h" 17 #include "ash/wm/overview/window_selector_controller.h"
18 #include "ash/wm/window_util.h" 18 #include "ash/wm/window_util.h"
19 #include "base/memory/ptr_util.h" 19 #include "base/memory/ptr_util.h"
20 #include "ui/aura/client/focus_client.h" 20 #include "ui/aura/client/focus_client.h"
21 #include "ui/wm/public/activation_client.h" 21 #include "ui/wm/public/activation_client.h"
22 22
23 namespace ash { 23 namespace ash {
24 namespace wm {
25 24
26 WmGlobalsAura::WmGlobalsAura() { 25 WmShellAura::WmShellAura() {
27 WmGlobals::Set(this); 26 WmShell::Set(this);
28 Shell::GetInstance()->AddShellObserver(this); 27 Shell::GetInstance()->AddShellObserver(this);
29 } 28 }
30 29
31 WmGlobalsAura::~WmGlobalsAura() { 30 WmShellAura::~WmShellAura() {
32 WmGlobals::Set(nullptr); 31 WmShell::Set(nullptr);
33 if (added_activation_observer_) { 32 if (added_activation_observer_) {
34 aura::client::GetActivationClient(Shell::GetPrimaryRootWindow()) 33 aura::client::GetActivationClient(Shell::GetPrimaryRootWindow())
35 ->RemoveObserver(this); 34 ->RemoveObserver(this);
36 } 35 }
37 if (added_display_observer_) 36 if (added_display_observer_)
38 Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); 37 Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this);
39 38
40 Shell::GetInstance()->RemoveShellObserver(this); 39 Shell::GetInstance()->RemoveShellObserver(this);
41 } 40 }
42 41
43 WmWindow* WmGlobalsAura::NewContainerWindow() { 42 WmWindow* WmShellAura::NewContainerWindow() {
44 aura::Window* aura_window = new aura::Window(nullptr); 43 aura::Window* aura_window = new aura::Window(nullptr);
45 aura_window->Init(ui::LAYER_NOT_DRAWN); 44 aura_window->Init(ui::LAYER_NOT_DRAWN);
46 return WmWindowAura::Get(aura_window); 45 return WmWindowAura::Get(aura_window);
47 } 46 }
48 47
49 WmWindow* WmGlobalsAura::GetFocusedWindow() { 48 WmWindow* WmShellAura::GetFocusedWindow() {
50 return WmWindowAura::Get( 49 return WmWindowAura::Get(
51 aura::client::GetFocusClient(Shell::GetPrimaryRootWindow()) 50 aura::client::GetFocusClient(Shell::GetPrimaryRootWindow())
52 ->GetFocusedWindow()); 51 ->GetFocusedWindow());
53 } 52 }
54 53
55 WmWindow* WmGlobalsAura::GetActiveWindow() { 54 WmWindow* WmShellAura::GetActiveWindow() {
56 return WmWindowAura::Get(wm::GetActiveWindow()); 55 return WmWindowAura::Get(wm::GetActiveWindow());
57 } 56 }
58 57
59 WmWindow* WmGlobalsAura::GetPrimaryRootWindow() { 58 WmWindow* WmShellAura::GetPrimaryRootWindow() {
60 return WmWindowAura::Get(Shell::GetPrimaryRootWindow()); 59 return WmWindowAura::Get(Shell::GetPrimaryRootWindow());
61 } 60 }
62 61
63 WmWindow* WmGlobalsAura::GetRootWindowForDisplayId(int64_t display_id) { 62 WmWindow* WmShellAura::GetRootWindowForDisplayId(int64_t display_id) {
64 return WmWindowAura::Get(Shell::GetInstance() 63 return WmWindowAura::Get(Shell::GetInstance()
65 ->window_tree_host_manager() 64 ->window_tree_host_manager()
66 ->GetRootWindowForDisplayId(display_id)); 65 ->GetRootWindowForDisplayId(display_id));
67 } 66 }
68 67
69 WmWindow* WmGlobalsAura::GetRootWindowForNewWindows() { 68 WmWindow* WmShellAura::GetRootWindowForNewWindows() {
70 return WmWindowAura::Get(Shell::GetTargetRootWindow()); 69 return WmWindowAura::Get(Shell::GetTargetRootWindow());
71 } 70 }
72 71
73 std::vector<WmWindow*> WmGlobalsAura::GetMruWindowList() { 72 std::vector<WmWindow*> WmShellAura::GetMruWindowList() {
74 return WmWindowAura::FromAuraWindows( 73 return WmWindowAura::FromAuraWindows(
75 Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList()); 74 Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList());
76 } 75 }
77 76
78 std::vector<WmWindow*> WmGlobalsAura::GetMruWindowListIgnoreModals() { 77 std::vector<WmWindow*> WmShellAura::GetMruWindowListIgnoreModals() {
79 return WmWindowAura::FromAuraWindows( 78 return WmWindowAura::FromAuraWindows(
80 Shell::GetInstance()->mru_window_tracker()->BuildWindowListIgnoreModal()); 79 Shell::GetInstance()->mru_window_tracker()->BuildWindowListIgnoreModal());
81 } 80 }
82 81
83 bool WmGlobalsAura::IsForceMaximizeOnFirstRun() { 82 bool WmShellAura::IsForceMaximizeOnFirstRun() {
84 return Shell::GetInstance()->delegate()->IsForceMaximizeOnFirstRun(); 83 return Shell::GetInstance()->delegate()->IsForceMaximizeOnFirstRun();
85 } 84 }
86 85
87 bool WmGlobalsAura::IsUserSessionBlocked() { 86 bool WmShellAura::IsUserSessionBlocked() {
88 return Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked(); 87 return Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked();
89 } 88 }
90 89
91 bool WmGlobalsAura::IsScreenLocked() { 90 bool WmShellAura::IsScreenLocked() {
92 return Shell::GetInstance()->session_state_delegate()->IsScreenLocked(); 91 return Shell::GetInstance()->session_state_delegate()->IsScreenLocked();
93 } 92 }
94 93
95 void WmGlobalsAura::LockCursor() { 94 void WmShellAura::LockCursor() {
96 Shell::GetInstance()->cursor_manager()->LockCursor(); 95 Shell::GetInstance()->cursor_manager()->LockCursor();
97 } 96 }
98 97
99 void WmGlobalsAura::UnlockCursor() { 98 void WmShellAura::UnlockCursor() {
100 Shell::GetInstance()->cursor_manager()->UnlockCursor(); 99 Shell::GetInstance()->cursor_manager()->UnlockCursor();
101 } 100 }
102 101
103 std::vector<WmWindow*> WmGlobalsAura::GetAllRootWindows() { 102 std::vector<WmWindow*> WmShellAura::GetAllRootWindows() {
104 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 103 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
105 std::vector<WmWindow*> wm_windows(root_windows.size()); 104 std::vector<WmWindow*> wm_windows(root_windows.size());
106 for (size_t i = 0; i < root_windows.size(); ++i) 105 for (size_t i = 0; i < root_windows.size(); ++i)
107 wm_windows[i] = WmWindowAura::Get(root_windows[i]); 106 wm_windows[i] = WmWindowAura::Get(root_windows[i]);
108 return wm_windows; 107 return wm_windows;
109 } 108 }
110 109
111 void WmGlobalsAura::RecordUserMetricsAction(WmUserMetricsAction action) { 110 void WmShellAura::RecordUserMetricsAction(wm::WmUserMetricsAction action) {
112 return Shell::GetInstance()->metrics()->RecordUserMetricsAction(action); 111 return Shell::GetInstance()->metrics()->RecordUserMetricsAction(action);
113 } 112 }
114 113
115 std::unique_ptr<WindowResizer> WmGlobalsAura::CreateDragWindowResizer( 114 std::unique_ptr<WindowResizer> WmShellAura::CreateDragWindowResizer(
116 std::unique_ptr<WindowResizer> next_window_resizer, 115 std::unique_ptr<WindowResizer> next_window_resizer,
117 wm::WindowState* window_state) { 116 wm::WindowState* window_state) {
118 return base::WrapUnique( 117 return base::WrapUnique(
119 DragWindowResizer::Create(next_window_resizer.release(), window_state)); 118 DragWindowResizer::Create(next_window_resizer.release(), window_state));
120 } 119 }
121 120
122 bool WmGlobalsAura::IsOverviewModeSelecting() { 121 bool WmShellAura::IsOverviewModeSelecting() {
123 WindowSelectorController* window_selector_controller = 122 WindowSelectorController* window_selector_controller =
124 Shell::GetInstance()->window_selector_controller(); 123 Shell::GetInstance()->window_selector_controller();
125 return window_selector_controller && 124 return window_selector_controller &&
126 window_selector_controller->IsSelecting(); 125 window_selector_controller->IsSelecting();
127 } 126 }
128 127
129 bool WmGlobalsAura::IsOverviewModeRestoringMinimizedWindows() { 128 bool WmShellAura::IsOverviewModeRestoringMinimizedWindows() {
130 WindowSelectorController* window_selector_controller = 129 WindowSelectorController* window_selector_controller =
131 Shell::GetInstance()->window_selector_controller(); 130 Shell::GetInstance()->window_selector_controller();
132 return window_selector_controller && 131 return window_selector_controller &&
133 window_selector_controller->IsRestoringMinimizedWindows(); 132 window_selector_controller->IsRestoringMinimizedWindows();
134 } 133 }
135 134
136 void WmGlobalsAura::AddActivationObserver(WmActivationObserver* observer) { 135 void WmShellAura::AddActivationObserver(WmActivationObserver* observer) {
137 if (!added_activation_observer_) { 136 if (!added_activation_observer_) {
138 added_activation_observer_ = true; 137 added_activation_observer_ = true;
139 aura::client::GetActivationClient(Shell::GetPrimaryRootWindow()) 138 aura::client::GetActivationClient(Shell::GetPrimaryRootWindow())
140 ->AddObserver(this); 139 ->AddObserver(this);
141 } 140 }
142 activation_observers_.AddObserver(observer); 141 activation_observers_.AddObserver(observer);
143 } 142 }
144 143
145 void WmGlobalsAura::RemoveActivationObserver(WmActivationObserver* observer) { 144 void WmShellAura::RemoveActivationObserver(WmActivationObserver* observer) {
146 activation_observers_.RemoveObserver(observer); 145 activation_observers_.RemoveObserver(observer);
147 } 146 }
148 147
149 void WmGlobalsAura::AddDisplayObserver(WmDisplayObserver* observer) { 148 void WmShellAura::AddDisplayObserver(WmDisplayObserver* observer) {
150 if (!added_display_observer_) { 149 if (!added_display_observer_) {
151 added_display_observer_ = true; 150 added_display_observer_ = true;
152 Shell::GetInstance()->window_tree_host_manager()->AddObserver(this); 151 Shell::GetInstance()->window_tree_host_manager()->AddObserver(this);
153 } 152 }
154 display_observers_.AddObserver(observer); 153 display_observers_.AddObserver(observer);
155 } 154 }
156 155
157 void WmGlobalsAura::RemoveDisplayObserver(WmDisplayObserver* observer) { 156 void WmShellAura::RemoveDisplayObserver(WmDisplayObserver* observer) {
158 display_observers_.RemoveObserver(observer); 157 display_observers_.RemoveObserver(observer);
159 } 158 }
160 159
161 void WmGlobalsAura::AddOverviewModeObserver(WmOverviewModeObserver* observer) { 160 void WmShellAura::AddOverviewModeObserver(WmOverviewModeObserver* observer) {
162 overview_mode_observers_.AddObserver(observer); 161 overview_mode_observers_.AddObserver(observer);
163 } 162 }
164 163
165 void WmGlobalsAura::RemoveOverviewModeObserver( 164 void WmShellAura::RemoveOverviewModeObserver(WmOverviewModeObserver* observer) {
166 WmOverviewModeObserver* observer) {
167 overview_mode_observers_.RemoveObserver(observer); 165 overview_mode_observers_.RemoveObserver(observer);
168 } 166 }
169 167
170 void WmGlobalsAura::OnWindowActivated( 168 void WmShellAura::OnWindowActivated(
171 aura::client::ActivationChangeObserver::ActivationReason reason, 169 aura::client::ActivationChangeObserver::ActivationReason reason,
172 aura::Window* gained_active, 170 aura::Window* gained_active,
173 aura::Window* lost_active) { 171 aura::Window* lost_active) {
174 FOR_EACH_OBSERVER(WmActivationObserver, activation_observers_, 172 FOR_EACH_OBSERVER(WmActivationObserver, activation_observers_,
175 OnWindowActivated(WmWindowAura::Get(gained_active), 173 OnWindowActivated(WmWindowAura::Get(gained_active),
176 WmWindowAura::Get(lost_active))); 174 WmWindowAura::Get(lost_active)));
177 } 175 }
178 176
179 void WmGlobalsAura::OnAttemptToReactivateWindow(aura::Window* request_active, 177 void WmShellAura::OnAttemptToReactivateWindow(aura::Window* request_active,
180 aura::Window* actual_active) { 178 aura::Window* actual_active) {
181 FOR_EACH_OBSERVER( 179 FOR_EACH_OBSERVER(
182 WmActivationObserver, activation_observers_, 180 WmActivationObserver, activation_observers_,
183 OnAttemptToReactivateWindow(WmWindowAura::Get(request_active), 181 OnAttemptToReactivateWindow(WmWindowAura::Get(request_active),
184 WmWindowAura::Get(actual_active))); 182 WmWindowAura::Get(actual_active)));
185 } 183 }
186 184
187 void WmGlobalsAura::OnDisplayConfigurationChanging() { 185 void WmShellAura::OnDisplayConfigurationChanging() {
188 FOR_EACH_OBSERVER(WmDisplayObserver, display_observers_, 186 FOR_EACH_OBSERVER(WmDisplayObserver, display_observers_,
189 OnDisplayConfigurationChanging()); 187 OnDisplayConfigurationChanging());
190 } 188 }
191 189
192 void WmGlobalsAura::OnDisplayConfigurationChanged() { 190 void WmShellAura::OnDisplayConfigurationChanged() {
193 FOR_EACH_OBSERVER(WmDisplayObserver, display_observers_, 191 FOR_EACH_OBSERVER(WmDisplayObserver, display_observers_,
194 OnDisplayConfigurationChanged()); 192 OnDisplayConfigurationChanged());
195 } 193 }
196 194
197 void WmGlobalsAura::OnOverviewModeEnded() { 195 void WmShellAura::OnOverviewModeEnded() {
198 FOR_EACH_OBSERVER(WmOverviewModeObserver, overview_mode_observers_, 196 FOR_EACH_OBSERVER(WmOverviewModeObserver, overview_mode_observers_,
199 OnOverviewModeEnded()); 197 OnOverviewModeEnded());
200 } 198 }
201 199
202 } // namespace wm
203 } // namespace ash 200 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698