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

Side by Side Diff: ash/mus/bridge/wm_shell_mus.cc

Issue 2115663002: Folds methods in WmShellCommon to WmShell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moar Created 4 years, 5 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/mus/bridge/wm_shell_mus.h" 5 #include "ash/mus/bridge/wm_shell_mus.h"
6 6
7 #include "ash/common/default_accessibility_delegate.h" 7 #include "ash/common/default_accessibility_delegate.h"
8 #include "ash/common/display/display_info.h" 8 #include "ash/common/display/display_info.h"
9 #include "ash/common/session/session_state_delegate.h" 9 #include "ash/common/session/session_state_delegate.h"
10 #include "ash/common/shell_observer.h" 10 #include "ash/common/shell_observer.h"
11 #include "ash/common/shell_window_ids.h" 11 #include "ash/common/shell_window_ids.h"
12 #include "ash/common/system/tray/default_system_tray_delegate.h" 12 #include "ash/common/system/tray/default_system_tray_delegate.h"
13 #include "ash/common/wm/maximize_mode/maximize_mode_event_handler.h" 13 #include "ash/common/wm/maximize_mode/maximize_mode_event_handler.h"
14 #include "ash/common/wm/mru_window_tracker.h" 14 #include "ash/common/wm/mru_window_tracker.h"
15 #include "ash/common/wm/window_resizer.h" 15 #include "ash/common/wm/window_resizer.h"
16 #include "ash/common/wm_activation_observer.h" 16 #include "ash/common/wm_activation_observer.h"
17 #include "ash/common/wm_shell_common.h"
18 #include "ash/mus/bridge/wm_root_window_controller_mus.h" 17 #include "ash/mus/bridge/wm_root_window_controller_mus.h"
19 #include "ash/mus/bridge/wm_window_mus.h" 18 #include "ash/mus/bridge/wm_window_mus.h"
20 #include "ash/mus/container_ids.h" 19 #include "ash/mus/container_ids.h"
21 #include "ash/mus/drag_window_resizer.h" 20 #include "ash/mus/drag_window_resizer.h"
22 #include "ash/mus/root_window_controller.h" 21 #include "ash/mus/root_window_controller.h"
23 #include "base/memory/ptr_util.h" 22 #include "base/memory/ptr_util.h"
24 #include "components/mus/common/util.h" 23 #include "components/mus/common/util.h"
25 #include "components/mus/public/cpp/window.h" 24 #include "components/mus/public/cpp/window.h"
26 #include "components/mus/public/cpp/window_tree_client.h" 25 #include "components/mus/public/cpp/window_tree_client.h"
27 #include "components/user_manager/user_info_impl.h" 26 #include "components/user_manager/user_info_impl.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub); 89 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub);
91 }; 90 };
92 91
93 } // namespace 92 } // namespace
94 93
95 WmShellMus::WmShellMus(::mus::WindowTreeClient* client) 94 WmShellMus::WmShellMus(::mus::WindowTreeClient* client)
96 : client_(client), session_state_delegate_(new SessionStateDelegateStub) { 95 : client_(client), session_state_delegate_(new SessionStateDelegateStub) {
97 client_->AddObserver(this); 96 client_->AddObserver(this);
98 WmShell::Set(this); 97 WmShell::Set(this);
99 98
100 wm_shell_common_.reset(new WmShellCommon); 99 CreateMruWindowTracker();
101 wm_shell_common_->CreateMruWindowTracker();
102 100
103 accessibility_delegate_.reset(new DefaultAccessibilityDelegate); 101 accessibility_delegate_.reset(new DefaultAccessibilityDelegate);
104 SetSystemTrayDelegate(base::WrapUnique(new DefaultSystemTrayDelegate)); 102 SetSystemTrayDelegate(base::WrapUnique(new DefaultSystemTrayDelegate));
105 } 103 }
106 104
107 WmShellMus::~WmShellMus() { 105 WmShellMus::~WmShellMus() {
108 DeleteSystemTrayDelegate(); 106 DeleteSystemTrayDelegate();
109 DeleteWindowSelectorController(); 107 DeleteWindowSelectorController();
110 wm_shell_common_->DeleteMruWindowTracker(); 108 DeleteMruWindowTracker();
111 RemoveClientObserver(); 109 RemoveClientObserver();
112 WmShell::Set(nullptr); 110 WmShell::Set(nullptr);
113 } 111 }
114 112
115 // static 113 // static
116 WmShellMus* WmShellMus::Get() { 114 WmShellMus* WmShellMus::Get() {
117 return static_cast<WmShellMus*>(WmShell::Get()); 115 return static_cast<WmShellMus*>(WmShell::Get());
118 } 116 }
119 117
120 void WmShellMus::AddRootWindowController( 118 void WmShellMus::AddRootWindowController(
(...skipping 23 matching lines...) Expand all
144 int64_t id) { 142 int64_t id) {
145 for (WmRootWindowControllerMus* root_window_controller : 143 for (WmRootWindowControllerMus* root_window_controller :
146 root_window_controllers_) { 144 root_window_controllers_) {
147 if (root_window_controller->GetDisplay().id() == id) 145 if (root_window_controller->GetDisplay().id() == id)
148 return root_window_controller; 146 return root_window_controller;
149 } 147 }
150 NOTREACHED(); 148 NOTREACHED();
151 return nullptr; 149 return nullptr;
152 } 150 }
153 151
154 MruWindowTracker* WmShellMus::GetMruWindowTracker() {
155 return wm_shell_common_->mru_window_tracker();
156 }
157
158 WmWindow* WmShellMus::NewContainerWindow() { 152 WmWindow* WmShellMus::NewContainerWindow() {
159 return WmWindowMus::Get(client_->NewWindow()); 153 return WmWindowMus::Get(client_->NewWindow());
160 } 154 }
161 155
162 WmWindow* WmShellMus::GetFocusedWindow() { 156 WmWindow* WmShellMus::GetFocusedWindow() {
163 return WmWindowMus::Get(client_->GetFocusedWindow()); 157 return WmWindowMus::Get(client_->GetFocusedWindow());
164 } 158 }
165 159
166 WmWindow* WmShellMus::GetActiveWindow() { 160 WmWindow* WmShellMus::GetActiveWindow() {
167 return GetToplevelAncestor(client_->GetFocusedWindow()); 161 return GetToplevelAncestor(client_->GetFocusedWindow());
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 227
234 std::unique_ptr<wm::MaximizeModeEventHandler> 228 std::unique_ptr<wm::MaximizeModeEventHandler>
235 WmShellMus::CreateMaximizeModeEventHandler() { 229 WmShellMus::CreateMaximizeModeEventHandler() {
236 // TODO: need support for window manager to get events before client: 230 // TODO: need support for window manager to get events before client:
237 // http://crbug.com/624157. 231 // http://crbug.com/624157.
238 NOTIMPLEMENTED(); 232 NOTIMPLEMENTED();
239 return nullptr; 233 return nullptr;
240 } 234 }
241 235
242 void WmShellMus::OnOverviewModeStarting() { 236 void WmShellMus::OnOverviewModeStarting() {
243 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), 237 FOR_EACH_OBSERVER(ShellObserver, *shell_observers(),
244 OnOverviewModeStarting()); 238 OnOverviewModeStarting());
245 } 239 }
246 240
247 void WmShellMus::OnOverviewModeEnded() { 241 void WmShellMus::OnOverviewModeEnded() {
248 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), 242 FOR_EACH_OBSERVER(ShellObserver, *shell_observers(), OnOverviewModeEnded());
249 OnOverviewModeEnded());
250 } 243 }
251 244
252 AccessibilityDelegate* WmShellMus::GetAccessibilityDelegate() { 245 AccessibilityDelegate* WmShellMus::GetAccessibilityDelegate() {
253 return accessibility_delegate_.get(); 246 return accessibility_delegate_.get();
254 } 247 }
255 248
256 SessionStateDelegate* WmShellMus::GetSessionStateDelegate() { 249 SessionStateDelegate* WmShellMus::GetSessionStateDelegate() {
257 return session_state_delegate_.get(); 250 return session_state_delegate_.get();
258 } 251 }
259 252
260 void WmShellMus::AddActivationObserver(WmActivationObserver* observer) { 253 void WmShellMus::AddActivationObserver(WmActivationObserver* observer) {
261 activation_observers_.AddObserver(observer); 254 activation_observers_.AddObserver(observer);
262 } 255 }
263 256
264 void WmShellMus::RemoveActivationObserver(WmActivationObserver* observer) { 257 void WmShellMus::RemoveActivationObserver(WmActivationObserver* observer) {
265 activation_observers_.RemoveObserver(observer); 258 activation_observers_.RemoveObserver(observer);
266 } 259 }
267 260
268 void WmShellMus::AddDisplayObserver(WmDisplayObserver* observer) { 261 void WmShellMus::AddDisplayObserver(WmDisplayObserver* observer) {
269 NOTIMPLEMENTED(); 262 NOTIMPLEMENTED();
270 } 263 }
271 264
272 void WmShellMus::RemoveDisplayObserver(WmDisplayObserver* observer) { 265 void WmShellMus::RemoveDisplayObserver(WmDisplayObserver* observer) {
273 NOTIMPLEMENTED(); 266 NOTIMPLEMENTED();
274 } 267 }
275 268
276 void WmShellMus::AddShellObserver(ShellObserver* observer) {
277 wm_shell_common_->AddShellObserver(observer);
278 }
279
280 void WmShellMus::RemoveShellObserver(ShellObserver* observer) {
281 wm_shell_common_->RemoveShellObserver(observer);
282 }
283
284 void WmShellMus::AddPointerWatcher(views::PointerWatcher* watcher) { 269 void WmShellMus::AddPointerWatcher(views::PointerWatcher* watcher) {
285 // TODO(jamescook): Move PointerWatcherDelegateMus to //ash/mus and use here. 270 // TODO(jamescook): Move PointerWatcherDelegateMus to //ash/mus and use here.
286 NOTIMPLEMENTED(); 271 NOTIMPLEMENTED();
287 } 272 }
288 273
289 void WmShellMus::RemovePointerWatcher(views::PointerWatcher* watcher) { 274 void WmShellMus::RemovePointerWatcher(views::PointerWatcher* watcher) {
290 NOTIMPLEMENTED(); 275 NOTIMPLEMENTED();
291 } 276 }
292 277
293 #if defined(OS_CHROMEOS) 278 #if defined(OS_CHROMEOS)
(...skipping 28 matching lines...) Expand all
322 OnWindowActivated(gained_active, lost_active)); 307 OnWindowActivated(gained_active, lost_active));
323 } 308 }
324 309
325 void WmShellMus::OnWillDestroyClient(::mus::WindowTreeClient* client) { 310 void WmShellMus::OnWillDestroyClient(::mus::WindowTreeClient* client) {
326 DCHECK_EQ(client, client_); 311 DCHECK_EQ(client, client_);
327 RemoveClientObserver(); 312 RemoveClientObserver();
328 } 313 }
329 314
330 } // namespace mus 315 } // namespace mus
331 } // namespace ash 316 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698