| OLD | NEW |
| 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 22 matching lines...) Expand all Loading... |
| 72 | 84 |
| 73 private: | 85 private: |
| 74 // A pseudo user info. | 86 // A pseudo user info. |
| 75 std::unique_ptr<user_manager::UserInfo> user_info_; | 87 std::unique_ptr<user_manager::UserInfo> user_info_; |
| 76 | 88 |
| 77 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub); | 89 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub); |
| 78 }; | 90 }; |
| 79 | 91 |
| 80 } // namespace | 92 } // namespace |
| 81 | 93 |
| 94 WmShellMus::MashSpecificState::MashSpecificState() = default; |
| 95 |
| 96 WmShellMus::MashSpecificState::~MashSpecificState() = default; |
| 97 |
| 98 WmShellMus::MusSpecificState::MusSpecificState() = default; |
| 99 |
| 100 WmShellMus::MusSpecificState::~MusSpecificState() = default; |
| 101 |
| 82 WmShellMus::WmShellMus( | 102 WmShellMus::WmShellMus( |
| 83 WmWindow* primary_root_window, | 103 WmWindow* primary_root_window, |
| 84 WindowManager* window_manager, | 104 WindowManager* window_manager, |
| 85 views::PointerWatcherEventRouter* pointer_watcher_event_router, | 105 views::PointerWatcherEventRouter* pointer_watcher_event_router, |
| 86 bool create_session_state_delegate_stub) | 106 bool create_session_state_delegate_stub) |
| 87 : window_manager_(window_manager), | 107 : window_manager_(window_manager), |
| 88 primary_root_window_(primary_root_window), | 108 primary_root_window_(primary_root_window) { |
| 89 pointer_watcher_event_router_(pointer_watcher_event_router) { | |
| 90 if (create_session_state_delegate_stub) | 109 if (create_session_state_delegate_stub) |
| 91 session_state_delegate_ = base::MakeUnique<SessionStateDelegateStub>(); | 110 session_state_delegate_ = base::MakeUnique<SessionStateDelegateStub>(); |
| 92 DCHECK(primary_root_window_); | 111 DCHECK(primary_root_window_); |
| 93 | 112 |
| 94 if (GetConfig() == Config::MASH) | 113 if (GetConfig() == Config::MASH) { |
| 95 immersive_handler_factory_ = base::MakeUnique<ImmersiveHandlerFactoryMus>(); | 114 mash_state_ = base::MakeUnique<MashSpecificState>(); |
| 115 mash_state_->pointer_watcher_event_router = pointer_watcher_event_router; |
| 116 mash_state_->immersive_handler_factory = |
| 117 base::MakeUnique<ImmersiveHandlerFactoryMus>(); |
| 118 } else { |
| 119 DCHECK_EQ(Config::MUS, GetConfig()); |
| 120 mus_state_ = base::MakeUnique<MusSpecificState>(); |
| 121 } |
| 96 } | 122 } |
| 97 | 123 |
| 98 WmShellMus::~WmShellMus() { | 124 WmShellMus::~WmShellMus() { |
| 99 } | 125 } |
| 100 | 126 |
| 101 // static | 127 // static |
| 102 WmShellMus* WmShellMus::Get() { | 128 WmShellMus* WmShellMus::Get() { |
| 103 const ash::Config config = WmShell::Get()->GetConfig(); | 129 const ash::Config config = WmShell::Get()->GetConfig(); |
| 104 CHECK(config == Config::MUS || config == Config::MASH); | 130 CHECK(config == Config::MUS || config == Config::MASH); |
| 105 return static_cast<WmShellMus*>(WmShell::Get()); | 131 return static_cast<WmShellMus*>(WmShell::Get()); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 116 return root_window_controller; | 142 return root_window_controller; |
| 117 } | 143 } |
| 118 return nullptr; | 144 return nullptr; |
| 119 } | 145 } |
| 120 | 146 |
| 121 aura::WindowTreeClient* WmShellMus::window_tree_client() { | 147 aura::WindowTreeClient* WmShellMus::window_tree_client() { |
| 122 return window_manager_->window_tree_client(); | 148 return window_manager_->window_tree_client(); |
| 123 } | 149 } |
| 124 | 150 |
| 125 void WmShellMus::Shutdown() { | 151 void WmShellMus::Shutdown() { |
| 152 if (mus_state_) |
| 153 mus_state_->pointer_watcher_adapter.reset(); |
| 154 |
| 126 WmShell::Shutdown(); | 155 WmShell::Shutdown(); |
| 127 | 156 |
| 128 window_manager_->DeleteAllRootWindowControllers(); | 157 window_manager_->DeleteAllRootWindowControllers(); |
| 129 } | 158 } |
| 130 | 159 |
| 131 bool WmShellMus::IsRunningInMash() const { | 160 bool WmShellMus::IsRunningInMash() const { |
| 132 return GetConfig() == Config::MASH; | 161 return GetConfig() == Config::MASH; |
| 133 } | 162 } |
| 134 | 163 |
| 135 Config WmShellMus::GetConfig() const { | 164 Config WmShellMus::GetConfig() const { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 std::vector<WmWindow*> WmShellMus::GetAllRootWindows() { | 263 std::vector<WmWindow*> WmShellMus::GetAllRootWindows() { |
| 235 std::vector<WmWindow*> root_windows; | 264 std::vector<WmWindow*> root_windows; |
| 236 for (RootWindowController* root_window_controller : | 265 for (RootWindowController* root_window_controller : |
| 237 RootWindowController::root_window_controllers()) { | 266 RootWindowController::root_window_controllers()) { |
| 238 root_windows.push_back(root_window_controller->GetWindow()); | 267 root_windows.push_back(root_window_controller->GetWindow()); |
| 239 } | 268 } |
| 240 return root_windows; | 269 return root_windows; |
| 241 } | 270 } |
| 242 | 271 |
| 243 void WmShellMus::RecordGestureAction(GestureActionType action) { | 272 void WmShellMus::RecordGestureAction(GestureActionType action) { |
| 273 if (GetConfig() == Config::MUS) { |
| 274 TouchUMA::GetInstance()->RecordGestureAction(action); |
| 275 return; |
| 276 } |
| 244 // TODO: http://crbug.com/616581. | 277 // TODO: http://crbug.com/616581. |
| 245 NOTIMPLEMENTED(); | 278 NOTIMPLEMENTED(); |
| 246 } | 279 } |
| 247 | 280 |
| 248 void WmShellMus::RecordUserMetricsAction(UserMetricsAction action) { | 281 void WmShellMus::RecordUserMetricsAction(UserMetricsAction action) { |
| 282 if (GetConfig() == Config::MUS) { |
| 283 Shell::GetInstance()->metrics()->RecordUserMetricsAction(action); |
| 284 return; |
| 285 } |
| 249 // TODO: http://crbug.com/616581. | 286 // TODO: http://crbug.com/616581. |
| 250 NOTIMPLEMENTED(); | 287 NOTIMPLEMENTED(); |
| 251 } | 288 } |
| 252 | 289 |
| 253 void WmShellMus::RecordTaskSwitchMetric(TaskSwitchSource source) { | 290 void WmShellMus::RecordTaskSwitchMetric(TaskSwitchSource source) { |
| 291 if (GetConfig() == Config::MUS) { |
| 292 Shell::GetInstance() |
| 293 ->metrics() |
| 294 ->task_switch_metrics_recorder() |
| 295 .OnTaskSwitch(source); |
| 296 return; |
| 297 } |
| 254 // TODO: http://crbug.com/616581. | 298 // TODO: http://crbug.com/616581. |
| 255 NOTIMPLEMENTED(); | 299 NOTIMPLEMENTED(); |
| 256 } | 300 } |
| 257 | 301 |
| 258 std::unique_ptr<WindowResizer> WmShellMus::CreateDragWindowResizer( | 302 std::unique_ptr<WindowResizer> WmShellMus::CreateDragWindowResizer( |
| 259 std::unique_ptr<WindowResizer> next_window_resizer, | 303 std::unique_ptr<WindowResizer> next_window_resizer, |
| 260 wm::WindowState* window_state) { | 304 wm::WindowState* window_state) { |
| 261 return base::MakeUnique<DragWindowResizer>(std::move(next_window_resizer), | 305 if (GetConfig() == Config::MUS) { |
| 262 window_state); | 306 return base::WrapUnique(ash::DragWindowResizer::Create( |
| 307 next_window_resizer.release(), window_state)); |
| 308 } |
| 309 return base::MakeUnique<ash::mus::DragWindowResizer>( |
| 310 std::move(next_window_resizer), window_state); |
| 263 } | 311 } |
| 264 | 312 |
| 265 std::unique_ptr<WindowCycleEventFilter> | 313 std::unique_ptr<WindowCycleEventFilter> |
| 266 WmShellMus::CreateWindowCycleEventFilter() { | 314 WmShellMus::CreateWindowCycleEventFilter() { |
| 315 if (GetConfig() == Config::MUS) |
| 316 return base::MakeUnique<WindowCycleEventFilterAura>(); |
| 317 |
| 267 // TODO: implement me, http://crbug.com/629191. | 318 // TODO: implement me, http://crbug.com/629191. |
| 268 return nullptr; | 319 return nullptr; |
| 269 } | 320 } |
| 270 | 321 |
| 271 std::unique_ptr<wm::MaximizeModeEventHandler> | 322 std::unique_ptr<wm::MaximizeModeEventHandler> |
| 272 WmShellMus::CreateMaximizeModeEventHandler() { | 323 WmShellMus::CreateMaximizeModeEventHandler() { |
| 324 if (GetConfig() == Config::MUS) |
| 325 return base::MakeUnique<wm::MaximizeModeEventHandlerAura>(); |
| 326 |
| 273 // TODO: need support for window manager to get events before client: | 327 // TODO: need support for window manager to get events before client: |
| 274 // http://crbug.com/624157. | 328 // http://crbug.com/624157. |
| 275 NOTIMPLEMENTED(); | 329 NOTIMPLEMENTED(); |
| 276 return nullptr; | 330 return nullptr; |
| 277 } | 331 } |
| 278 | 332 |
| 279 std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> | 333 std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> |
| 280 WmShellMus::CreateScopedDisableInternalMouseAndKeyboard() { | 334 WmShellMus::CreateScopedDisableInternalMouseAndKeyboard() { |
| 335 if (GetConfig() == Config::MUS) { |
| 336 #if defined(USE_OZONE) |
| 337 return base::MakeUnique<ScopedDisableInternalMouseAndKeyboardOzone>(); |
| 338 #else |
| 339 // TODO: remove this conditional. Bots build this config, but it is never |
| 340 // actually used. http://crbug.com/671355. |
| 341 NOTREACHED(); |
| 342 return nullptr; |
| 343 #endif |
| 344 } |
| 345 |
| 281 // TODO: needs implementation for mus, http://crbug.com/624967. | 346 // TODO: needs implementation for mus, http://crbug.com/624967. |
| 282 NOTIMPLEMENTED(); | 347 NOTIMPLEMENTED(); |
| 283 return nullptr; | 348 return nullptr; |
| 284 } | 349 } |
| 285 | 350 |
| 286 std::unique_ptr<WorkspaceEventHandler> WmShellMus::CreateWorkspaceEventHandler( | 351 std::unique_ptr<WorkspaceEventHandler> WmShellMus::CreateWorkspaceEventHandler( |
| 287 WmWindow* workspace_window) { | 352 WmWindow* workspace_window) { |
| 353 if (GetConfig() == Config::MUS) |
| 354 return base::MakeUnique<WorkspaceEventHandlerAura>(workspace_window); |
| 355 |
| 288 return base::MakeUnique<WorkspaceEventHandlerMus>( | 356 return base::MakeUnique<WorkspaceEventHandlerMus>( |
| 289 WmWindow::GetAuraWindow(workspace_window)); | 357 WmWindow::GetAuraWindow(workspace_window)); |
| 290 } | 358 } |
| 291 | 359 |
| 292 std::unique_ptr<ImmersiveFullscreenController> | 360 std::unique_ptr<ImmersiveFullscreenController> |
| 293 WmShellMus::CreateImmersiveFullscreenController() { | 361 WmShellMus::CreateImmersiveFullscreenController() { |
| 294 return base::MakeUnique<ImmersiveFullscreenController>(); | 362 return base::MakeUnique<ImmersiveFullscreenController>(); |
| 295 } | 363 } |
| 296 | 364 |
| 297 std::unique_ptr<KeyboardUI> WmShellMus::CreateKeyboardUI() { | 365 std::unique_ptr<KeyboardUI> WmShellMus::CreateKeyboardUI() { |
| 366 if (GetConfig() == Config::MUS) |
| 367 return KeyboardUI::Create(); |
| 368 |
| 298 return KeyboardUIMus::Create(window_manager_->connector()); | 369 return KeyboardUIMus::Create(window_manager_->connector()); |
| 299 } | 370 } |
| 300 | 371 |
| 301 std::unique_ptr<KeyEventWatcher> WmShellMus::CreateKeyEventWatcher() { | 372 std::unique_ptr<KeyEventWatcher> WmShellMus::CreateKeyEventWatcher() { |
| 373 if (GetConfig() == Config::MUS) |
| 374 return base::MakeUnique<KeyEventWatcherAura>(); |
| 375 |
| 302 // TODO: needs implementation for mus, http://crbug.com/649600. | 376 // TODO: needs implementation for mus, http://crbug.com/649600. |
| 303 NOTIMPLEMENTED(); | 377 NOTIMPLEMENTED(); |
| 304 return std::unique_ptr<KeyEventWatcher>(); | 378 return std::unique_ptr<KeyEventWatcher>(); |
| 305 } | 379 } |
| 306 | 380 |
| 307 SessionStateDelegate* WmShellMus::GetSessionStateDelegate() { | 381 SessionStateDelegate* WmShellMus::GetSessionStateDelegate() { |
| 308 return session_state_delegate_ | 382 return session_state_delegate_ |
| 309 ? session_state_delegate_.get() | 383 ? session_state_delegate_.get() |
| 310 : Shell::GetInstance()->session_state_delegate(); | 384 : Shell::GetInstance()->session_state_delegate(); |
| 311 } | 385 } |
| 312 | 386 |
| 313 void WmShellMus::AddDisplayObserver(WmDisplayObserver* observer) { | 387 void WmShellMus::AddDisplayObserver(WmDisplayObserver* observer) { |
| 388 // TODO: need WmDisplayObserver support for mus. http://crbug.com/705831. |
| 314 NOTIMPLEMENTED(); | 389 NOTIMPLEMENTED(); |
| 315 } | 390 } |
| 316 | 391 |
| 317 void WmShellMus::RemoveDisplayObserver(WmDisplayObserver* observer) { | 392 void WmShellMus::RemoveDisplayObserver(WmDisplayObserver* observer) { |
| 393 // TODO: need WmDisplayObserver support for mus. http://crbug.com/705831. |
| 318 NOTIMPLEMENTED(); | 394 NOTIMPLEMENTED(); |
| 319 } | 395 } |
| 320 | 396 |
| 321 void WmShellMus::AddPointerWatcher(views::PointerWatcher* watcher, | 397 void WmShellMus::AddPointerWatcher(views::PointerWatcher* watcher, |
| 322 views::PointerWatcherEventTypes events) { | 398 views::PointerWatcherEventTypes events) { |
| 399 if (GetConfig() == Config::MUS) { |
| 400 mus_state_->pointer_watcher_adapter->AddPointerWatcher(watcher, events); |
| 401 return; |
| 402 } |
| 403 |
| 323 // TODO: implement drags for mus pointer watcher, http://crbug.com/641164. | 404 // TODO: implement drags for mus pointer watcher, http://crbug.com/641164. |
| 324 // NOTIMPLEMENTED drags for mus pointer watcher. | 405 // NOTIMPLEMENTED drags for mus pointer watcher. |
| 325 pointer_watcher_event_router_->AddPointerWatcher( | 406 mash_state_->pointer_watcher_event_router->AddPointerWatcher( |
| 326 watcher, events == views::PointerWatcherEventTypes::MOVES); | 407 watcher, events == views::PointerWatcherEventTypes::MOVES); |
| 327 } | 408 } |
| 328 | 409 |
| 329 void WmShellMus::RemovePointerWatcher(views::PointerWatcher* watcher) { | 410 void WmShellMus::RemovePointerWatcher(views::PointerWatcher* watcher) { |
| 330 pointer_watcher_event_router_->RemovePointerWatcher(watcher); | 411 if (GetConfig() == Config::MUS) { |
| 412 mus_state_->pointer_watcher_adapter->RemovePointerWatcher(watcher); |
| 413 return; |
| 414 } |
| 415 |
| 416 mash_state_->pointer_watcher_event_router->RemovePointerWatcher(watcher); |
| 331 } | 417 } |
| 332 | 418 |
| 333 bool WmShellMus::IsTouchDown() { | 419 bool WmShellMus::IsTouchDown() { |
| 420 if (GetConfig() == Config::MUS) |
| 421 return aura::Env::GetInstance()->is_touch_down(); |
| 422 |
| 334 // TODO: implement me, http://crbug.com/634967. | 423 // TODO: implement me, http://crbug.com/634967. |
| 335 // NOTIMPLEMENTED is too spammy here. | 424 // NOTIMPLEMENTED is too spammy here. |
| 336 return false; | 425 return false; |
| 337 } | 426 } |
| 338 | 427 |
| 339 void WmShellMus::ToggleIgnoreExternalKeyboard() { | 428 void WmShellMus::ToggleIgnoreExternalKeyboard() { |
| 429 if (GetConfig() == Config::MUS) { |
| 430 Shell::GetInstance() |
| 431 ->virtual_keyboard_controller() |
| 432 ->ToggleIgnoreExternalKeyboard(); |
| 433 return; |
| 434 } |
| 435 |
| 340 NOTIMPLEMENTED(); | 436 NOTIMPLEMENTED(); |
| 341 } | 437 } |
| 342 | 438 |
| 343 void WmShellMus::SetLaserPointerEnabled(bool enabled) { | 439 void WmShellMus::SetLaserPointerEnabled(bool enabled) { |
| 440 if (GetConfig() == Config::MUS) { |
| 441 Shell::GetInstance()->laser_pointer_controller()->SetEnabled(enabled); |
| 442 return; |
| 443 } |
| 444 |
| 344 NOTIMPLEMENTED(); | 445 NOTIMPLEMENTED(); |
| 345 } | 446 } |
| 346 | 447 |
| 347 void WmShellMus::SetPartialMagnifierEnabled(bool enabled) { | 448 void WmShellMus::SetPartialMagnifierEnabled(bool enabled) { |
| 449 if (GetConfig() == Config::MUS) { |
| 450 Shell::GetInstance()->partial_magnification_controller()->SetEnabled( |
| 451 enabled); |
| 452 return; |
| 453 } |
| 454 |
| 348 NOTIMPLEMENTED(); | 455 NOTIMPLEMENTED(); |
| 349 } | 456 } |
| 350 | 457 |
| 351 void WmShellMus::CreatePointerWatcherAdapter() { | 458 void WmShellMus::CreatePointerWatcherAdapter() { |
| 352 // Only needed in WmShellAura, which has specific creation order. | 459 // In Config::MUS PointerWatcherAdapter must be created when this function is |
| 460 // called (it is order dependent), that is not the case with Config::MASH. |
| 461 if (GetConfig() == Config::MUS) { |
| 462 mus_state_->pointer_watcher_adapter = |
| 463 base::MakeUnique<PointerWatcherAdapter>(); |
| 464 } |
| 353 } | 465 } |
| 354 | 466 |
| 355 void WmShellMus::CreatePrimaryHost() {} | 467 void WmShellMus::CreatePrimaryHost() {} |
| 356 | 468 |
| 357 void WmShellMus::InitHosts(const ShellInitParams& init_params) { | 469 void WmShellMus::InitHosts(const ShellInitParams& init_params) { |
| 358 window_manager_->CreatePrimaryRootWindowController( | 470 window_manager_->CreatePrimaryRootWindowController( |
| 359 base::WrapUnique(init_params.primary_window_tree_host)); | 471 base::WrapUnique(init_params.primary_window_tree_host)); |
| 360 } | 472 } |
| 361 | 473 |
| 362 std::unique_ptr<AcceleratorController> | 474 std::unique_ptr<AcceleratorController> |
| 363 WmShellMus::CreateAcceleratorController() { | 475 WmShellMus::CreateAcceleratorController() { |
| 364 DCHECK(!accelerator_controller_delegate_); | |
| 365 if (GetConfig() == Config::MUS) { | 476 if (GetConfig() == Config::MUS) { |
| 366 accelerator_controller_delegate_classic_ = | 477 DCHECK(!mus_state_->accelerator_controller_delegate); |
| 478 mus_state_->accelerator_controller_delegate = |
| 367 base::MakeUnique<AcceleratorControllerDelegateAura>(); | 479 base::MakeUnique<AcceleratorControllerDelegateAura>(); |
| 368 return base::MakeUnique<AcceleratorController>( | 480 return base::MakeUnique<AcceleratorController>( |
| 369 accelerator_controller_delegate_classic_.get(), nullptr); | 481 mus_state_->accelerator_controller_delegate.get(), nullptr); |
| 370 } | 482 } |
| 371 | 483 |
| 484 DCHECK(!mash_state_->accelerator_controller_delegate); |
| 485 |
| 372 uint16_t accelerator_namespace_id = 0u; | 486 uint16_t accelerator_namespace_id = 0u; |
| 373 const bool add_result = | 487 const bool add_result = |
| 374 window_manager_->GetNextAcceleratorNamespaceId(&accelerator_namespace_id); | 488 window_manager_->GetNextAcceleratorNamespaceId(&accelerator_namespace_id); |
| 375 // WmShellMus is created early on, so that GetNextAcceleratorNamespaceId() | 489 // WmShellMus is created early on, so that GetNextAcceleratorNamespaceId() |
| 376 // should always succeed. | 490 // should always succeed. |
| 377 DCHECK(add_result); | 491 DCHECK(add_result); |
| 378 | 492 |
| 379 accelerator_controller_delegate_ = | 493 mash_state_->accelerator_controller_delegate = |
| 380 base::MakeUnique<AcceleratorControllerDelegateMus>(window_manager_); | 494 base::MakeUnique<AcceleratorControllerDelegateMus>(window_manager_); |
| 381 accelerator_controller_registrar_ = | 495 mash_state_->accelerator_controller_registrar = |
| 382 base ::MakeUnique<AcceleratorControllerRegistrar>( | 496 base ::MakeUnique<AcceleratorControllerRegistrar>( |
| 383 window_manager_, accelerator_namespace_id); | 497 window_manager_, accelerator_namespace_id); |
| 384 return base::MakeUnique<AcceleratorController>( | 498 return base::MakeUnique<AcceleratorController>( |
| 385 accelerator_controller_delegate_.get(), | 499 mash_state_->accelerator_controller_delegate.get(), |
| 386 accelerator_controller_registrar_.get()); | 500 mash_state_->accelerator_controller_registrar.get()); |
| 387 } | 501 } |
| 388 | 502 |
| 389 } // namespace mus | 503 } // namespace mus |
| 390 } // namespace ash | 504 } // namespace ash |
| OLD | NEW |