| 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/common/accelerators/accelerator_controller.h" | 9 #include "ash/common/accelerators/accelerator_controller.h" |
| 10 #include "ash/common/key_event_watcher.h" | 10 #include "ash/common/key_event_watcher.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 WindowManager* window_manager, | 118 WindowManager* window_manager, |
| 119 views::PointerWatcherEventRouter* pointer_watcher_event_router, | 119 views::PointerWatcherEventRouter* pointer_watcher_event_router, |
| 120 bool create_session_state_delegate_stub) | 120 bool create_session_state_delegate_stub) |
| 121 : window_manager_(window_manager), | 121 : window_manager_(window_manager), |
| 122 primary_root_window_(primary_root_window), | 122 primary_root_window_(primary_root_window), |
| 123 pointer_watcher_event_router_(pointer_watcher_event_router) { | 123 pointer_watcher_event_router_(pointer_watcher_event_router) { |
| 124 if (create_session_state_delegate_stub) | 124 if (create_session_state_delegate_stub) |
| 125 session_state_delegate_ = base::MakeUnique<SessionStateDelegateStub>(); | 125 session_state_delegate_ = base::MakeUnique<SessionStateDelegateStub>(); |
| 126 DCHECK(primary_root_window_); | 126 DCHECK(primary_root_window_); |
| 127 | 127 |
| 128 uint16_t accelerator_namespace_id = 0u; | |
| 129 const bool add_result = | |
| 130 window_manager->GetNextAcceleratorNamespaceId(&accelerator_namespace_id); | |
| 131 // WmShellMus is created early on, so that this should always succeed. | |
| 132 DCHECK(add_result); | |
| 133 accelerator_controller_delegate_.reset( | |
| 134 new AcceleratorControllerDelegateMus(window_manager_)); | |
| 135 accelerator_controller_registrar_.reset(new AcceleratorControllerRegistrar( | |
| 136 window_manager_, accelerator_namespace_id)); | |
| 137 SetAcceleratorController(base::MakeUnique<AcceleratorController>( | |
| 138 accelerator_controller_delegate_.get(), | |
| 139 accelerator_controller_registrar_.get())); | |
| 140 immersive_handler_factory_.reset(new ImmersiveHandlerFactoryMus); | 128 immersive_handler_factory_.reset(new ImmersiveHandlerFactoryMus); |
| 141 | 129 |
| 142 SetKeyboardUI(KeyboardUIMus::Create(window_manager_->connector())); | 130 SetKeyboardUI(KeyboardUIMus::Create(window_manager_->connector())); |
| 143 } | 131 } |
| 144 | 132 |
| 145 WmShellMus::~WmShellMus() { | 133 WmShellMus::~WmShellMus() { |
| 146 } | 134 } |
| 147 | 135 |
| 148 // static | 136 // static |
| 149 WmShellMus* WmShellMus::Get() { | 137 WmShellMus* WmShellMus::Get() { |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 void WmShellMus::CreatePointerWatcherAdapter() { | 376 void WmShellMus::CreatePointerWatcherAdapter() { |
| 389 // Only needed in WmShellAura, which has specific creation order. | 377 // Only needed in WmShellAura, which has specific creation order. |
| 390 } | 378 } |
| 391 | 379 |
| 392 void WmShellMus::CreatePrimaryHost() {} | 380 void WmShellMus::CreatePrimaryHost() {} |
| 393 | 381 |
| 394 void WmShellMus::InitHosts(const ShellInitParams& init_params) { | 382 void WmShellMus::InitHosts(const ShellInitParams& init_params) { |
| 395 window_manager_->CreatePrimaryRootWindowController( | 383 window_manager_->CreatePrimaryRootWindowController( |
| 396 base::WrapUnique(init_params.primary_window_tree_host)); | 384 base::WrapUnique(init_params.primary_window_tree_host)); |
| 397 } | 385 } |
| 386 |
| 387 std::unique_ptr<AcceleratorController> |
| 388 WmShellMus::CreateAcceleratorController() { |
| 389 DCHECK(!accelerator_controller_delegate_); |
| 390 uint16_t accelerator_namespace_id = 0u; |
| 391 const bool add_result = |
| 392 window_manager_->GetNextAcceleratorNamespaceId(&accelerator_namespace_id); |
| 393 // WmShellMus is created early on, so that GetNextAcceleratorNamespaceId() |
| 394 // should always succeed. |
| 395 DCHECK(add_result); |
| 396 |
| 397 accelerator_controller_delegate_ = |
| 398 base::MakeUnique<AcceleratorControllerDelegateMus>(window_manager_); |
| 399 accelerator_controller_registrar_ = |
| 400 base ::MakeUnique<AcceleratorControllerRegistrar>( |
| 401 window_manager_, accelerator_namespace_id); |
| 402 return base::MakeUnique<AcceleratorController>( |
| 403 accelerator_controller_delegate_.get(), |
| 404 accelerator_controller_registrar_.get()); |
| 405 } |
| 406 |
| 398 } // namespace mus | 407 } // namespace mus |
| 399 } // namespace ash | 408 } // namespace ash |
| OLD | NEW |