| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // A pseudo user info. | 108 // A pseudo user info. |
| 109 std::unique_ptr<user_manager::UserInfo> user_info_; | 109 std::unique_ptr<user_manager::UserInfo> user_info_; |
| 110 | 110 |
| 111 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub); | 111 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 } // namespace | 114 } // namespace |
| 115 | 115 |
| 116 WmShellMus::WmShellMus( | 116 WmShellMus::WmShellMus( |
| 117 WmWindow* primary_root_window, | 117 WmWindow* primary_root_window, |
| 118 std::unique_ptr<ShellDelegate> shell_delegate, | |
| 119 WindowManager* window_manager, | 118 WindowManager* window_manager, |
| 120 views::PointerWatcherEventRouter* pointer_watcher_event_router, | 119 views::PointerWatcherEventRouter* pointer_watcher_event_router, |
| 121 bool create_session_state_delegate_stub) | 120 bool create_session_state_delegate_stub) |
| 122 : WmShell(std::move(shell_delegate)), | 121 : window_manager_(window_manager), |
| 123 window_manager_(window_manager), | |
| 124 primary_root_window_(primary_root_window), | 122 primary_root_window_(primary_root_window), |
| 125 pointer_watcher_event_router_(pointer_watcher_event_router) { | 123 pointer_watcher_event_router_(pointer_watcher_event_router) { |
| 126 if (create_session_state_delegate_stub) | 124 if (create_session_state_delegate_stub) |
| 127 session_state_delegate_ = base::MakeUnique<SessionStateDelegateStub>(); | 125 session_state_delegate_ = base::MakeUnique<SessionStateDelegateStub>(); |
| 128 DCHECK(primary_root_window_); | 126 DCHECK(primary_root_window_); |
| 129 WmShell::Set(this); | |
| 130 | 127 |
| 131 uint16_t accelerator_namespace_id = 0u; | 128 uint16_t accelerator_namespace_id = 0u; |
| 132 const bool add_result = | 129 const bool add_result = |
| 133 window_manager->GetNextAcceleratorNamespaceId(&accelerator_namespace_id); | 130 window_manager->GetNextAcceleratorNamespaceId(&accelerator_namespace_id); |
| 134 // WmShellMus is created early on, so that this should always succeed. | 131 // WmShellMus is created early on, so that this should always succeed. |
| 135 DCHECK(add_result); | 132 DCHECK(add_result); |
| 136 accelerator_controller_delegate_.reset( | 133 accelerator_controller_delegate_.reset( |
| 137 new AcceleratorControllerDelegateMus(window_manager_)); | 134 new AcceleratorControllerDelegateMus(window_manager_)); |
| 138 accelerator_controller_registrar_.reset(new AcceleratorControllerRegistrar( | 135 accelerator_controller_registrar_.reset(new AcceleratorControllerRegistrar( |
| 139 window_manager_, accelerator_namespace_id)); | 136 window_manager_, accelerator_namespace_id)); |
| 140 SetAcceleratorController(base::MakeUnique<AcceleratorController>( | 137 SetAcceleratorController(base::MakeUnique<AcceleratorController>( |
| 141 accelerator_controller_delegate_.get(), | 138 accelerator_controller_delegate_.get(), |
| 142 accelerator_controller_registrar_.get())); | 139 accelerator_controller_registrar_.get())); |
| 143 immersive_handler_factory_.reset(new ImmersiveHandlerFactoryMus); | 140 immersive_handler_factory_.reset(new ImmersiveHandlerFactoryMus); |
| 144 | 141 |
| 145 SetKeyboardUI(KeyboardUIMus::Create(window_manager_->connector())); | 142 SetKeyboardUI(KeyboardUIMus::Create(window_manager_->connector())); |
| 146 } | 143 } |
| 147 | 144 |
| 148 WmShellMus::~WmShellMus() { | 145 WmShellMus::~WmShellMus() { |
| 149 WmShell::Set(nullptr); | |
| 150 } | 146 } |
| 151 | 147 |
| 152 // static | 148 // static |
| 153 WmShellMus* WmShellMus::Get() { | 149 WmShellMus* WmShellMus::Get() { |
| 154 return static_cast<WmShellMus*>(WmShell::Get()); | 150 return static_cast<WmShellMus*>(WmShell::Get()); |
| 155 } | 151 } |
| 156 | 152 |
| 157 RootWindowController* WmShellMus::GetRootWindowControllerWithDisplayId( | 153 RootWindowController* WmShellMus::GetRootWindowControllerWithDisplayId( |
| 158 int64_t id) { | 154 int64_t id) { |
| 159 for (RootWindowController* root_window_controller : | 155 for (RootWindowController* root_window_controller : |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 } | 390 } |
| 395 | 391 |
| 396 void WmShellMus::CreatePrimaryHost() {} | 392 void WmShellMus::CreatePrimaryHost() {} |
| 397 | 393 |
| 398 void WmShellMus::InitHosts(const ShellInitParams& init_params) { | 394 void WmShellMus::InitHosts(const ShellInitParams& init_params) { |
| 399 window_manager_->CreatePrimaryRootWindowController( | 395 window_manager_->CreatePrimaryRootWindowController( |
| 400 base::WrapUnique(init_params.primary_window_tree_host)); | 396 base::WrapUnique(init_params.primary_window_tree_host)); |
| 401 } | 397 } |
| 402 } // namespace mus | 398 } // namespace mus |
| 403 } // namespace ash | 399 } // namespace ash |
| OLD | NEW |