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

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

Issue 2783563002: Make WmShellMus use classic types for mus (Closed)
Patch Set: fix x11 build 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 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 <utility> 7 #include <utility>
8 8
9 #include "ash/accelerators/accelerator_controller_delegate_aura.h" 9 #include "ash/accelerators/accelerator_controller_delegate_aura.h"
10 #include "ash/aura/key_event_watcher_aura.h"
11 #include "ash/aura/pointer_watcher_adapter.h"
10 #include "ash/common/accelerators/accelerator_controller.h" 12 #include "ash/common/accelerators/accelerator_controller.h"
11 #include "ash/common/key_event_watcher.h" 13 #include "ash/common/key_event_watcher.h"
12 #include "ash/common/session/session_state_delegate.h" 14 #include "ash/common/session/session_state_delegate.h"
13 #include "ash/common/shell_delegate.h" 15 #include "ash/common/shell_delegate.h"
14 #include "ash/common/shell_observer.h" 16 #include "ash/common/shell_observer.h"
15 #include "ash/common/system/tray/system_tray_delegate.h" 17 #include "ash/common/system/tray/system_tray_delegate.h"
16 #include "ash/common/wallpaper/wallpaper_delegate.h" 18 #include "ash/common/wallpaper/wallpaper_delegate.h"
17 #include "ash/common/wm/maximize_mode/maximize_mode_event_handler.h" 19 #include "ash/common/wm/maximize_mode/maximize_mode_event_handler.h"
18 #include "ash/common/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard .h" 20 #include "ash/common/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard .h"
19 #include "ash/common/wm/mru_window_tracker.h" 21 #include "ash/common/wm/mru_window_tracker.h"
20 #include "ash/common/wm/window_cycle_event_filter.h" 22 #include "ash/common/wm/window_cycle_event_filter.h"
21 #include "ash/common/wm/window_resizer.h" 23 #include "ash/common/wm/window_resizer.h"
22 #include "ash/common/wm_window.h" 24 #include "ash/common/wm_window.h"
25 #include "ash/laser/laser_pointer_controller.h"
26 #include "ash/magnifier/partial_magnification_controller.h"
23 #include "ash/mus/accelerators/accelerator_controller_delegate_mus.h" 27 #include "ash/mus/accelerators/accelerator_controller_delegate_mus.h"
24 #include "ash/mus/accelerators/accelerator_controller_registrar.h" 28 #include "ash/mus/accelerators/accelerator_controller_registrar.h"
25 #include "ash/mus/bridge/immersive_handler_factory_mus.h" 29 #include "ash/mus/bridge/immersive_handler_factory_mus.h"
26 #include "ash/mus/bridge/workspace_event_handler_mus.h" 30 #include "ash/mus/bridge/workspace_event_handler_mus.h"
27 #include "ash/mus/drag_window_resizer.h" 31 #include "ash/mus/drag_window_resizer.h"
28 #include "ash/mus/keyboard_ui_mus.h" 32 #include "ash/mus/keyboard_ui_mus.h"
29 #include "ash/mus/screen_mus.h" 33 #include "ash/mus/screen_mus.h"
30 #include "ash/mus/window_manager.h" 34 #include "ash/mus/window_manager.h"
31 #include "ash/public/cpp/config.h" 35 #include "ash/public/cpp/config.h"
32 #include "ash/root_window_controller.h" 36 #include "ash/root_window_controller.h"
33 #include "ash/root_window_settings.h" 37 #include "ash/root_window_settings.h"
34 #include "ash/shared/immersive_fullscreen_controller.h" 38 #include "ash/shared/immersive_fullscreen_controller.h"
35 #include "ash/shell.h" 39 #include "ash/shell.h"
36 #include "ash/shell_init_params.h" 40 #include "ash/shell_init_params.h"
41 #include "ash/touch/touch_uma.h"
42 #include "ash/virtual_keyboard_controller.h"
43 #include "ash/wm/drag_window_resizer.h"
44 #include "ash/wm/maximize_mode/maximize_mode_event_handler_aura.h"
45 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone. h"
46 #include "ash/wm/window_cycle_event_filter_aura.h"
37 #include "ash/wm/window_util.h" 47 #include "ash/wm/window_util.h"
48 #include "ash/wm/workspace/workspace_event_handler_aura.h"
38 #include "base/memory/ptr_util.h" 49 #include "base/memory/ptr_util.h"
39 #include "components/user_manager/user_info_impl.h" 50 #include "components/user_manager/user_info_impl.h"
51 #include "ui/aura/env.h"
40 #include "ui/aura/mus/window_tree_client.h" 52 #include "ui/aura/mus/window_tree_client.h"
41 #include "ui/aura/mus/window_tree_host_mus.h" 53 #include "ui/aura/mus/window_tree_host_mus.h"
42 #include "ui/aura/window.h" 54 #include "ui/aura/window.h"
43 #include "ui/display/manager/managed_display_info.h" 55 #include "ui/display/manager/managed_display_info.h"
44 #include "ui/display/screen.h" 56 #include "ui/display/screen.h"
45 #include "ui/views/mus/pointer_watcher_event_router.h" 57 #include "ui/views/mus/pointer_watcher_event_router.h"
46 #include "ui/wm/core/capture_controller.h" 58 #include "ui/wm/core/capture_controller.h"
47 #include "ui/wm/core/focus_controller.h" 59 #include "ui/wm/core/focus_controller.h"
48 60
49 namespace ash { 61 namespace ash {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 return root_window_controller; 128 return root_window_controller;
117 } 129 }
118 return nullptr; 130 return nullptr;
119 } 131 }
120 132
121 aura::WindowTreeClient* WmShellMus::window_tree_client() { 133 aura::WindowTreeClient* WmShellMus::window_tree_client() {
122 return window_manager_->window_tree_client(); 134 return window_manager_->window_tree_client();
123 } 135 }
124 136
125 void WmShellMus::Shutdown() { 137 void WmShellMus::Shutdown() {
138 pointer_watcher_adapter_.reset();
139
126 WmShell::Shutdown(); 140 WmShell::Shutdown();
127 141
128 window_manager_->DeleteAllRootWindowControllers(); 142 window_manager_->DeleteAllRootWindowControllers();
129 } 143 }
130 144
131 bool WmShellMus::IsRunningInMash() const { 145 bool WmShellMus::IsRunningInMash() const {
132 return GetConfig() == Config::MASH; 146 return GetConfig() == Config::MASH;
133 } 147 }
134 148
135 Config WmShellMus::GetConfig() const { 149 Config WmShellMus::GetConfig() const {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 std::vector<WmWindow*> WmShellMus::GetAllRootWindows() { 248 std::vector<WmWindow*> WmShellMus::GetAllRootWindows() {
235 std::vector<WmWindow*> root_windows; 249 std::vector<WmWindow*> root_windows;
236 for (RootWindowController* root_window_controller : 250 for (RootWindowController* root_window_controller :
237 RootWindowController::root_window_controllers()) { 251 RootWindowController::root_window_controllers()) {
238 root_windows.push_back(root_window_controller->GetWindow()); 252 root_windows.push_back(root_window_controller->GetWindow());
239 } 253 }
240 return root_windows; 254 return root_windows;
241 } 255 }
242 256
243 void WmShellMus::RecordGestureAction(GestureActionType action) { 257 void WmShellMus::RecordGestureAction(GestureActionType action) {
258 if (GetConfig() == Config::MUS) {
259 TouchUMA::GetInstance()->RecordGestureAction(action);
260 return;
261 }
244 // TODO: http://crbug.com/616581. 262 // TODO: http://crbug.com/616581.
245 NOTIMPLEMENTED(); 263 NOTIMPLEMENTED();
246 } 264 }
247 265
248 void WmShellMus::RecordUserMetricsAction(UserMetricsAction action) { 266 void WmShellMus::RecordUserMetricsAction(UserMetricsAction action) {
267 if (GetConfig() == Config::MUS) {
268 Shell::GetInstance()->metrics()->RecordUserMetricsAction(action);
msw 2017/03/28 20:26:32 Can MASH use this too, since it now instantiates a
sky 2017/03/28 21:21:01 Shell only creates UserMetricsRecorder in classic
269 return;
270 }
249 // TODO: http://crbug.com/616581. 271 // TODO: http://crbug.com/616581.
250 NOTIMPLEMENTED(); 272 NOTIMPLEMENTED();
251 } 273 }
252 274
253 void WmShellMus::RecordTaskSwitchMetric(TaskSwitchSource source) { 275 void WmShellMus::RecordTaskSwitchMetric(TaskSwitchSource source) {
276 if (GetConfig() == Config::MUS) {
277 Shell::GetInstance()
278 ->metrics()
279 ->task_switch_metrics_recorder()
280 .OnTaskSwitch(source);
281 return;
282 }
254 // TODO: http://crbug.com/616581. 283 // TODO: http://crbug.com/616581.
255 NOTIMPLEMENTED(); 284 NOTIMPLEMENTED();
256 } 285 }
257 286
258 std::unique_ptr<WindowResizer> WmShellMus::CreateDragWindowResizer( 287 std::unique_ptr<WindowResizer> WmShellMus::CreateDragWindowResizer(
259 std::unique_ptr<WindowResizer> next_window_resizer, 288 std::unique_ptr<WindowResizer> next_window_resizer,
260 wm::WindowState* window_state) { 289 wm::WindowState* window_state) {
261 return base::MakeUnique<DragWindowResizer>(std::move(next_window_resizer), 290 if (GetConfig() == Config::MUS) {
262 window_state); 291 return base::WrapUnique(ash::DragWindowResizer::Create(
292 next_window_resizer.release(), window_state));
293 }
294 return base::MakeUnique<ash::mus::DragWindowResizer>(
295 std::move(next_window_resizer), window_state);
263 } 296 }
264 297
265 std::unique_ptr<WindowCycleEventFilter> 298 std::unique_ptr<WindowCycleEventFilter>
266 WmShellMus::CreateWindowCycleEventFilter() { 299 WmShellMus::CreateWindowCycleEventFilter() {
300 if (GetConfig() == Config::MUS)
301 return base::MakeUnique<WindowCycleEventFilterAura>();
302
267 // TODO: implement me, http://crbug.com/629191. 303 // TODO: implement me, http://crbug.com/629191.
268 return nullptr; 304 return nullptr;
269 } 305 }
270 306
271 std::unique_ptr<wm::MaximizeModeEventHandler> 307 std::unique_ptr<wm::MaximizeModeEventHandler>
272 WmShellMus::CreateMaximizeModeEventHandler() { 308 WmShellMus::CreateMaximizeModeEventHandler() {
309 if (GetConfig() == Config::MUS)
310 return base::MakeUnique<wm::MaximizeModeEventHandlerAura>();
311
273 // TODO: need support for window manager to get events before client: 312 // TODO: need support for window manager to get events before client:
274 // http://crbug.com/624157. 313 // http://crbug.com/624157.
275 NOTIMPLEMENTED(); 314 NOTIMPLEMENTED();
276 return nullptr; 315 return nullptr;
277 } 316 }
278 317
279 std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> 318 std::unique_ptr<ScopedDisableInternalMouseAndKeyboard>
280 WmShellMus::CreateScopedDisableInternalMouseAndKeyboard() { 319 WmShellMus::CreateScopedDisableInternalMouseAndKeyboard() {
320 if (GetConfig() == Config::MUS) {
321 #if defined(USE_OZONE)
322 return base::MakeUnique<ScopedDisableInternalMouseAndKeyboardOzone>();
323 #else
324 // TODO: remove this conditional. Bots build this config, but it is never
325 // actually used.
msw 2017/03/28 20:26:32 optional nit: cite a bug or actually create a Scop
sky 2017/03/28 21:21:01 x11 for chromeos isn't actually used anymore outsi
326 NOTREACHED();
327 return nullptr;
328 #endif
329 }
330
281 // TODO: needs implementation for mus, http://crbug.com/624967. 331 // TODO: needs implementation for mus, http://crbug.com/624967.
282 NOTIMPLEMENTED(); 332 NOTIMPLEMENTED();
283 return nullptr; 333 return nullptr;
284 } 334 }
285 335
286 std::unique_ptr<WorkspaceEventHandler> WmShellMus::CreateWorkspaceEventHandler( 336 std::unique_ptr<WorkspaceEventHandler> WmShellMus::CreateWorkspaceEventHandler(
287 WmWindow* workspace_window) { 337 WmWindow* workspace_window) {
338 if (GetConfig() == Config::MUS)
339 return base::MakeUnique<WorkspaceEventHandlerAura>(workspace_window);
340
288 return base::MakeUnique<WorkspaceEventHandlerMus>( 341 return base::MakeUnique<WorkspaceEventHandlerMus>(
289 WmWindow::GetAuraWindow(workspace_window)); 342 WmWindow::GetAuraWindow(workspace_window));
290 } 343 }
291 344
292 std::unique_ptr<ImmersiveFullscreenController> 345 std::unique_ptr<ImmersiveFullscreenController>
293 WmShellMus::CreateImmersiveFullscreenController() { 346 WmShellMus::CreateImmersiveFullscreenController() {
294 return base::MakeUnique<ImmersiveFullscreenController>(); 347 return base::MakeUnique<ImmersiveFullscreenController>();
295 } 348 }
296 349
297 std::unique_ptr<KeyboardUI> WmShellMus::CreateKeyboardUI() { 350 std::unique_ptr<KeyboardUI> WmShellMus::CreateKeyboardUI() {
351 if (GetConfig() == Config::MUS)
352 return KeyboardUI::Create();
353
298 return KeyboardUIMus::Create(window_manager_->connector()); 354 return KeyboardUIMus::Create(window_manager_->connector());
299 } 355 }
300 356
301 std::unique_ptr<KeyEventWatcher> WmShellMus::CreateKeyEventWatcher() { 357 std::unique_ptr<KeyEventWatcher> WmShellMus::CreateKeyEventWatcher() {
358 if (GetConfig() == Config::MUS)
359 return base::MakeUnique<KeyEventWatcherAura>();
360
302 // TODO: needs implementation for mus, http://crbug.com/649600. 361 // TODO: needs implementation for mus, http://crbug.com/649600.
303 NOTIMPLEMENTED(); 362 NOTIMPLEMENTED();
304 return std::unique_ptr<KeyEventWatcher>(); 363 return std::unique_ptr<KeyEventWatcher>();
305 } 364 }
306 365
307 SessionStateDelegate* WmShellMus::GetSessionStateDelegate() { 366 SessionStateDelegate* WmShellMus::GetSessionStateDelegate() {
308 return session_state_delegate_ 367 return session_state_delegate_
309 ? session_state_delegate_.get() 368 ? session_state_delegate_.get()
310 : Shell::GetInstance()->session_state_delegate(); 369 : Shell::GetInstance()->session_state_delegate();
311 } 370 }
312 371
313 void WmShellMus::AddDisplayObserver(WmDisplayObserver* observer) { 372 void WmShellMus::AddDisplayObserver(WmDisplayObserver* observer) {
373 // TODO: need WmDisplayObserver support for mus. http://crbug.com/705831.
314 NOTIMPLEMENTED(); 374 NOTIMPLEMENTED();
315 } 375 }
316 376
317 void WmShellMus::RemoveDisplayObserver(WmDisplayObserver* observer) { 377 void WmShellMus::RemoveDisplayObserver(WmDisplayObserver* observer) {
378 // TODO: need WmDisplayObserver support for mus. http://crbug.com/705831.
318 NOTIMPLEMENTED(); 379 NOTIMPLEMENTED();
319 } 380 }
320 381
321 void WmShellMus::AddPointerWatcher(views::PointerWatcher* watcher, 382 void WmShellMus::AddPointerWatcher(views::PointerWatcher* watcher,
322 views::PointerWatcherEventTypes events) { 383 views::PointerWatcherEventTypes events) {
384 if (GetConfig() == Config::MUS) {
385 pointer_watcher_adapter_->AddPointerWatcher(watcher, events);
386 return;
387 }
388
323 // TODO: implement drags for mus pointer watcher, http://crbug.com/641164. 389 // TODO: implement drags for mus pointer watcher, http://crbug.com/641164.
324 // NOTIMPLEMENTED drags for mus pointer watcher. 390 // NOTIMPLEMENTED drags for mus pointer watcher.
325 pointer_watcher_event_router_->AddPointerWatcher( 391 pointer_watcher_event_router_->AddPointerWatcher(
326 watcher, events == views::PointerWatcherEventTypes::MOVES); 392 watcher, events == views::PointerWatcherEventTypes::MOVES);
327 } 393 }
328 394
329 void WmShellMus::RemovePointerWatcher(views::PointerWatcher* watcher) { 395 void WmShellMus::RemovePointerWatcher(views::PointerWatcher* watcher) {
396 if (GetConfig() == Config::MUS) {
397 pointer_watcher_adapter_->RemovePointerWatcher(watcher);
398 return;
399 }
400
330 pointer_watcher_event_router_->RemovePointerWatcher(watcher); 401 pointer_watcher_event_router_->RemovePointerWatcher(watcher);
331 } 402 }
332 403
333 bool WmShellMus::IsTouchDown() { 404 bool WmShellMus::IsTouchDown() {
405 if (GetConfig() == Config::MUS)
406 return aura::Env::GetInstance()->is_touch_down();
407
334 // TODO: implement me, http://crbug.com/634967. 408 // TODO: implement me, http://crbug.com/634967.
335 // NOTIMPLEMENTED is too spammy here. 409 // NOTIMPLEMENTED is too spammy here.
336 return false; 410 return false;
337 } 411 }
338 412
339 void WmShellMus::ToggleIgnoreExternalKeyboard() { 413 void WmShellMus::ToggleIgnoreExternalKeyboard() {
414 if (GetConfig() == Config::MUS) {
415 Shell::GetInstance()
416 ->virtual_keyboard_controller()
417 ->ToggleIgnoreExternalKeyboard();
418 return;
419 }
420
340 NOTIMPLEMENTED(); 421 NOTIMPLEMENTED();
341 } 422 }
342 423
343 void WmShellMus::SetLaserPointerEnabled(bool enabled) { 424 void WmShellMus::SetLaserPointerEnabled(bool enabled) {
425 if (GetConfig() == Config::MUS) {
426 Shell::GetInstance()->laser_pointer_controller()->SetEnabled(enabled);
427 return;
428 }
429
344 NOTIMPLEMENTED(); 430 NOTIMPLEMENTED();
345 } 431 }
346 432
347 void WmShellMus::SetPartialMagnifierEnabled(bool enabled) { 433 void WmShellMus::SetPartialMagnifierEnabled(bool enabled) {
434 if (GetConfig() == Config::MUS) {
435 Shell::GetInstance()->partial_magnification_controller()->SetEnabled(
436 enabled);
437 return;
438 }
439
348 NOTIMPLEMENTED(); 440 NOTIMPLEMENTED();
349 } 441 }
350 442
351 void WmShellMus::CreatePointerWatcherAdapter() { 443 void WmShellMus::CreatePointerWatcherAdapter() {
352 // Only needed in WmShellAura, which has specific creation order. 444 // In Config::MUS PointerWatcherAdapter must be created when this function is
445 // caled (it is order dependent), that is not the case with Config::MASH.
msw 2017/03/28 20:26:32 nit: called
sky 2017/03/28 21:21:01 Done.
446 if (GetConfig() == Config::MUS)
447 pointer_watcher_adapter_ = base::MakeUnique<PointerWatcherAdapter>();
353 } 448 }
354 449
355 void WmShellMus::CreatePrimaryHost() {} 450 void WmShellMus::CreatePrimaryHost() {}
356 451
357 void WmShellMus::InitHosts(const ShellInitParams& init_params) { 452 void WmShellMus::InitHosts(const ShellInitParams& init_params) {
358 window_manager_->CreatePrimaryRootWindowController( 453 window_manager_->CreatePrimaryRootWindowController(
359 base::WrapUnique(init_params.primary_window_tree_host)); 454 base::WrapUnique(init_params.primary_window_tree_host));
360 } 455 }
361 456
362 std::unique_ptr<AcceleratorController> 457 std::unique_ptr<AcceleratorController>
(...skipping 18 matching lines...) Expand all
381 accelerator_controller_registrar_ = 476 accelerator_controller_registrar_ =
382 base ::MakeUnique<AcceleratorControllerRegistrar>( 477 base ::MakeUnique<AcceleratorControllerRegistrar>(
383 window_manager_, accelerator_namespace_id); 478 window_manager_, accelerator_namespace_id);
384 return base::MakeUnique<AcceleratorController>( 479 return base::MakeUnique<AcceleratorController>(
385 accelerator_controller_delegate_.get(), 480 accelerator_controller_delegate_.get(),
386 accelerator_controller_registrar_.get()); 481 accelerator_controller_registrar_.get());
387 } 482 }
388 483
389 } // namespace mus 484 } // namespace mus
390 } // namespace ash 485 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698