| 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/shell_port_mash.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/accelerators/accelerator_controller.h" | 9 #include "ash/accelerators/accelerator_controller.h" |
| 10 #include "ash/accelerators/accelerator_controller_delegate_aura.h" | 10 #include "ash/accelerators/accelerator_controller_delegate_aura.h" |
| 11 #include "ash/aura/key_event_watcher_aura.h" | 11 #include "ash/aura/key_event_watcher_aura.h" |
| 12 #include "ash/aura/pointer_watcher_adapter.h" | 12 #include "ash/aura/pointer_watcher_adapter.h" |
| 13 #include "ash/key_event_watcher.h" | 13 #include "ash/key_event_watcher.h" |
| 14 #include "ash/laser/laser_pointer_controller.h" | 14 #include "ash/laser/laser_pointer_controller.h" |
| 15 #include "ash/magnifier/partial_magnification_controller.h" | 15 #include "ash/magnifier/partial_magnification_controller.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 // A pseudo user info. | 84 // A pseudo user info. |
| 85 std::unique_ptr<user_manager::UserInfo> user_info_; | 85 std::unique_ptr<user_manager::UserInfo> user_info_; |
| 86 | 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub); | 87 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 } // namespace | 90 } // namespace |
| 91 | 91 |
| 92 WmShellMus::MashSpecificState::MashSpecificState() = default; | 92 ShellPortMash::MashSpecificState::MashSpecificState() = default; |
| 93 | 93 |
| 94 WmShellMus::MashSpecificState::~MashSpecificState() = default; | 94 ShellPortMash::MashSpecificState::~MashSpecificState() = default; |
| 95 | 95 |
| 96 WmShellMus::MusSpecificState::MusSpecificState() = default; | 96 ShellPortMash::MusSpecificState::MusSpecificState() = default; |
| 97 | 97 |
| 98 WmShellMus::MusSpecificState::~MusSpecificState() = default; | 98 ShellPortMash::MusSpecificState::~MusSpecificState() = default; |
| 99 | 99 |
| 100 WmShellMus::WmShellMus( | 100 ShellPortMash::ShellPortMash( |
| 101 WmWindow* primary_root_window, | 101 WmWindow* primary_root_window, |
| 102 WindowManager* window_manager, | 102 WindowManager* window_manager, |
| 103 views::PointerWatcherEventRouter* pointer_watcher_event_router, | 103 views::PointerWatcherEventRouter* pointer_watcher_event_router, |
| 104 bool create_session_state_delegate_stub) | 104 bool create_session_state_delegate_stub) |
| 105 : window_manager_(window_manager), | 105 : window_manager_(window_manager), |
| 106 primary_root_window_(primary_root_window) { | 106 primary_root_window_(primary_root_window) { |
| 107 if (create_session_state_delegate_stub) | 107 if (create_session_state_delegate_stub) |
| 108 session_state_delegate_ = base::MakeUnique<SessionStateDelegateStub>(); | 108 session_state_delegate_ = base::MakeUnique<SessionStateDelegateStub>(); |
| 109 DCHECK(primary_root_window_); | 109 DCHECK(primary_root_window_); |
| 110 | 110 |
| 111 if (GetAshConfig() == Config::MASH) { | 111 if (GetAshConfig() == Config::MASH) { |
| 112 mash_state_ = base::MakeUnique<MashSpecificState>(); | 112 mash_state_ = base::MakeUnique<MashSpecificState>(); |
| 113 mash_state_->pointer_watcher_event_router = pointer_watcher_event_router; | 113 mash_state_->pointer_watcher_event_router = pointer_watcher_event_router; |
| 114 mash_state_->immersive_handler_factory = | 114 mash_state_->immersive_handler_factory = |
| 115 base::MakeUnique<ImmersiveHandlerFactoryMus>(); | 115 base::MakeUnique<ImmersiveHandlerFactoryMus>(); |
| 116 } else { | 116 } else { |
| 117 DCHECK_EQ(Config::MUS, GetAshConfig()); | 117 DCHECK_EQ(Config::MUS, GetAshConfig()); |
| 118 mus_state_ = base::MakeUnique<MusSpecificState>(); | 118 mus_state_ = base::MakeUnique<MusSpecificState>(); |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 | 121 |
| 122 WmShellMus::~WmShellMus() { | 122 ShellPortMash::~ShellPortMash() {} |
| 123 |
| 124 // static |
| 125 ShellPortMash* ShellPortMash::Get() { |
| 126 const ash::Config config = ShellPort::Get()->GetAshConfig(); |
| 127 CHECK(config == Config::MUS || config == Config::MASH); |
| 128 return static_cast<ShellPortMash*>(ShellPort::Get()); |
| 123 } | 129 } |
| 124 | 130 |
| 125 // static | 131 RootWindowController* ShellPortMash::GetRootWindowControllerWithDisplayId( |
| 126 WmShellMus* WmShellMus::Get() { | |
| 127 const ash::Config config = WmShell::Get()->GetAshConfig(); | |
| 128 CHECK(config == Config::MUS || config == Config::MASH); | |
| 129 return static_cast<WmShellMus*>(WmShell::Get()); | |
| 130 } | |
| 131 | |
| 132 RootWindowController* WmShellMus::GetRootWindowControllerWithDisplayId( | |
| 133 int64_t id) { | 132 int64_t id) { |
| 134 for (RootWindowController* root_window_controller : | 133 for (RootWindowController* root_window_controller : |
| 135 RootWindowController::root_window_controllers()) { | 134 RootWindowController::root_window_controllers()) { |
| 136 RootWindowSettings* settings = | 135 RootWindowSettings* settings = |
| 137 GetRootWindowSettings(root_window_controller->GetRootWindow()); | 136 GetRootWindowSettings(root_window_controller->GetRootWindow()); |
| 138 DCHECK(settings); | 137 DCHECK(settings); |
| 139 if (settings->display_id == id) | 138 if (settings->display_id == id) |
| 140 return root_window_controller; | 139 return root_window_controller; |
| 141 } | 140 } |
| 142 return nullptr; | 141 return nullptr; |
| 143 } | 142 } |
| 144 | 143 |
| 145 aura::WindowTreeClient* WmShellMus::window_tree_client() { | 144 aura::WindowTreeClient* ShellPortMash::window_tree_client() { |
| 146 return window_manager_->window_tree_client(); | 145 return window_manager_->window_tree_client(); |
| 147 } | 146 } |
| 148 | 147 |
| 149 void WmShellMus::Shutdown() { | 148 void ShellPortMash::Shutdown() { |
| 150 if (mus_state_) | 149 if (mus_state_) |
| 151 mus_state_->pointer_watcher_adapter.reset(); | 150 mus_state_->pointer_watcher_adapter.reset(); |
| 152 | 151 |
| 153 WmShell::Shutdown(); | 152 ShellPort::Shutdown(); |
| 154 | 153 |
| 155 window_manager_->DeleteAllRootWindowControllers(); | 154 window_manager_->DeleteAllRootWindowControllers(); |
| 156 } | 155 } |
| 157 | 156 |
| 158 bool WmShellMus::IsRunningInMash() const { | 157 bool ShellPortMash::IsRunningInMash() const { |
| 159 return GetAshConfig() == Config::MASH; | 158 return GetAshConfig() == Config::MASH; |
| 160 } | 159 } |
| 161 | 160 |
| 162 Config WmShellMus::GetAshConfig() const { | 161 Config ShellPortMash::GetAshConfig() const { |
| 163 return window_manager_->config(); | 162 return window_manager_->config(); |
| 164 } | 163 } |
| 165 | 164 |
| 166 WmWindow* WmShellMus::GetPrimaryRootWindow() { | 165 WmWindow* ShellPortMash::GetPrimaryRootWindow() { |
| 167 // NOTE: This is called before the RootWindowController has been created, so | 166 // NOTE: This is called before the RootWindowController has been created, so |
| 168 // it can't call through to RootWindowController to get all windows. | 167 // it can't call through to RootWindowController to get all windows. |
| 169 return primary_root_window_; | 168 return primary_root_window_; |
| 170 } | 169 } |
| 171 | 170 |
| 172 WmWindow* WmShellMus::GetRootWindowForDisplayId(int64_t display_id) { | 171 WmWindow* ShellPortMash::GetRootWindowForDisplayId(int64_t display_id) { |
| 173 RootWindowController* root_window_controller = | 172 RootWindowController* root_window_controller = |
| 174 GetRootWindowControllerWithDisplayId(display_id); | 173 GetRootWindowControllerWithDisplayId(display_id); |
| 175 return root_window_controller | 174 return root_window_controller |
| 176 ? WmWindow::Get(root_window_controller->GetRootWindow()) | 175 ? WmWindow::Get(root_window_controller->GetRootWindow()) |
| 177 : nullptr; | 176 : nullptr; |
| 178 } | 177 } |
| 179 | 178 |
| 180 const display::ManagedDisplayInfo& WmShellMus::GetDisplayInfo( | 179 const display::ManagedDisplayInfo& ShellPortMash::GetDisplayInfo( |
| 181 int64_t display_id) const { | 180 int64_t display_id) const { |
| 182 // TODO(mash): implement http://crbug.com/622480. | 181 // TODO(mash): implement http://crbug.com/622480. |
| 183 NOTIMPLEMENTED(); | 182 NOTIMPLEMENTED(); |
| 184 static display::ManagedDisplayInfo fake_info; | 183 static display::ManagedDisplayInfo fake_info; |
| 185 return fake_info; | 184 return fake_info; |
| 186 } | 185 } |
| 187 | 186 |
| 188 bool WmShellMus::IsActiveDisplayId(int64_t display_id) const { | 187 bool ShellPortMash::IsActiveDisplayId(int64_t display_id) const { |
| 189 // TODO(mash): implement http://crbug.com/622480. | 188 // TODO(mash): implement http://crbug.com/622480. |
| 190 NOTIMPLEMENTED(); | 189 NOTIMPLEMENTED(); |
| 191 return true; | 190 return true; |
| 192 } | 191 } |
| 193 | 192 |
| 194 display::Display WmShellMus::GetFirstDisplay() const { | 193 display::Display ShellPortMash::GetFirstDisplay() const { |
| 195 // TODO(mash): implement http://crbug.com/622480. | 194 // TODO(mash): implement http://crbug.com/622480. |
| 196 NOTIMPLEMENTED(); | 195 NOTIMPLEMENTED(); |
| 197 return display::Screen::GetScreen()->GetPrimaryDisplay(); | 196 return display::Screen::GetScreen()->GetPrimaryDisplay(); |
| 198 } | 197 } |
| 199 | 198 |
| 200 bool WmShellMus::IsInUnifiedMode() const { | 199 bool ShellPortMash::IsInUnifiedMode() const { |
| 201 // TODO(mash): implement http://crbug.com/622480. | 200 // TODO(mash): implement http://crbug.com/622480. |
| 202 NOTIMPLEMENTED(); | 201 NOTIMPLEMENTED(); |
| 203 return false; | 202 return false; |
| 204 } | 203 } |
| 205 | 204 |
| 206 bool WmShellMus::IsInUnifiedModeIgnoreMirroring() const { | 205 bool ShellPortMash::IsInUnifiedModeIgnoreMirroring() const { |
| 207 // TODO(mash): implement http://crbug.com/622480. | 206 // TODO(mash): implement http://crbug.com/622480. |
| 208 NOTIMPLEMENTED(); | 207 NOTIMPLEMENTED(); |
| 209 return false; | 208 return false; |
| 210 } | 209 } |
| 211 | 210 |
| 212 void WmShellMus::SetDisplayWorkAreaInsets(WmWindow* window, | 211 void ShellPortMash::SetDisplayWorkAreaInsets(WmWindow* window, |
| 213 const gfx::Insets& insets) { | 212 const gfx::Insets& insets) { |
| 214 window_manager_->screen()->SetWorkAreaInsets(window->aura_window(), insets); | 213 window_manager_->screen()->SetWorkAreaInsets(window->aura_window(), insets); |
| 215 } | 214 } |
| 216 | 215 |
| 217 void WmShellMus::LockCursor() { | 216 void ShellPortMash::LockCursor() { |
| 218 // TODO: http://crbug.com/637853 | 217 // TODO: http://crbug.com/637853 |
| 219 NOTIMPLEMENTED(); | 218 NOTIMPLEMENTED(); |
| 220 } | 219 } |
| 221 | 220 |
| 222 void WmShellMus::UnlockCursor() { | 221 void ShellPortMash::UnlockCursor() { |
| 223 // TODO: http://crbug.com/637853 | 222 // TODO: http://crbug.com/637853 |
| 224 NOTIMPLEMENTED(); | 223 NOTIMPLEMENTED(); |
| 225 } | 224 } |
| 226 | 225 |
| 227 bool WmShellMus::IsMouseEventsEnabled() { | 226 bool ShellPortMash::IsMouseEventsEnabled() { |
| 228 // TODO: http://crbug.com/637853 | 227 // TODO: http://crbug.com/637853 |
| 229 NOTIMPLEMENTED(); | 228 NOTIMPLEMENTED(); |
| 230 return true; | 229 return true; |
| 231 } | 230 } |
| 232 | 231 |
| 233 std::vector<WmWindow*> WmShellMus::GetAllRootWindows() { | 232 std::vector<WmWindow*> ShellPortMash::GetAllRootWindows() { |
| 234 std::vector<WmWindow*> root_windows; | 233 std::vector<WmWindow*> root_windows; |
| 235 for (RootWindowController* root_window_controller : | 234 for (RootWindowController* root_window_controller : |
| 236 RootWindowController::root_window_controllers()) { | 235 RootWindowController::root_window_controllers()) { |
| 237 root_windows.push_back(root_window_controller->GetWindow()); | 236 root_windows.push_back(root_window_controller->GetWindow()); |
| 238 } | 237 } |
| 239 return root_windows; | 238 return root_windows; |
| 240 } | 239 } |
| 241 | 240 |
| 242 void WmShellMus::RecordGestureAction(GestureActionType action) { | 241 void ShellPortMash::RecordGestureAction(GestureActionType action) { |
| 243 if (GetAshConfig() == Config::MUS) { | 242 if (GetAshConfig() == Config::MUS) { |
| 244 TouchUMA::GetInstance()->RecordGestureAction(action); | 243 TouchUMA::GetInstance()->RecordGestureAction(action); |
| 245 return; | 244 return; |
| 246 } | 245 } |
| 247 // TODO: http://crbug.com/616581. | 246 // TODO: http://crbug.com/616581. |
| 248 NOTIMPLEMENTED(); | 247 NOTIMPLEMENTED(); |
| 249 } | 248 } |
| 250 | 249 |
| 251 void WmShellMus::RecordUserMetricsAction(UserMetricsAction action) { | 250 void ShellPortMash::RecordUserMetricsAction(UserMetricsAction action) { |
| 252 if (GetAshConfig() == Config::MUS) { | 251 if (GetAshConfig() == Config::MUS) { |
| 253 Shell::Get()->metrics()->RecordUserMetricsAction(action); | 252 Shell::Get()->metrics()->RecordUserMetricsAction(action); |
| 254 return; | 253 return; |
| 255 } | 254 } |
| 256 // TODO: http://crbug.com/616581. | 255 // TODO: http://crbug.com/616581. |
| 257 NOTIMPLEMENTED(); | 256 NOTIMPLEMENTED(); |
| 258 } | 257 } |
| 259 | 258 |
| 260 void WmShellMus::RecordTaskSwitchMetric(TaskSwitchSource source) { | 259 void ShellPortMash::RecordTaskSwitchMetric(TaskSwitchSource source) { |
| 261 if (GetAshConfig() == Config::MUS) { | 260 if (GetAshConfig() == Config::MUS) { |
| 262 Shell::Get()->metrics()->task_switch_metrics_recorder().OnTaskSwitch( | 261 Shell::Get()->metrics()->task_switch_metrics_recorder().OnTaskSwitch( |
| 263 source); | 262 source); |
| 264 return; | 263 return; |
| 265 } | 264 } |
| 266 // TODO: http://crbug.com/616581. | 265 // TODO: http://crbug.com/616581. |
| 267 NOTIMPLEMENTED(); | 266 NOTIMPLEMENTED(); |
| 268 } | 267 } |
| 269 | 268 |
| 270 std::unique_ptr<WindowResizer> WmShellMus::CreateDragWindowResizer( | 269 std::unique_ptr<WindowResizer> ShellPortMash::CreateDragWindowResizer( |
| 271 std::unique_ptr<WindowResizer> next_window_resizer, | 270 std::unique_ptr<WindowResizer> next_window_resizer, |
| 272 wm::WindowState* window_state) { | 271 wm::WindowState* window_state) { |
| 273 if (GetAshConfig() == Config::MUS) { | 272 if (GetAshConfig() == Config::MUS) { |
| 274 return base::WrapUnique(ash::DragWindowResizer::Create( | 273 return base::WrapUnique(ash::DragWindowResizer::Create( |
| 275 next_window_resizer.release(), window_state)); | 274 next_window_resizer.release(), window_state)); |
| 276 } | 275 } |
| 277 return base::MakeUnique<ash::mus::DragWindowResizer>( | 276 return base::MakeUnique<ash::mus::DragWindowResizer>( |
| 278 std::move(next_window_resizer), window_state); | 277 std::move(next_window_resizer), window_state); |
| 279 } | 278 } |
| 280 | 279 |
| 281 std::unique_ptr<WindowCycleEventFilter> | 280 std::unique_ptr<WindowCycleEventFilter> |
| 282 WmShellMus::CreateWindowCycleEventFilter() { | 281 ShellPortMash::CreateWindowCycleEventFilter() { |
| 283 if (GetAshConfig() == Config::MUS) | 282 if (GetAshConfig() == Config::MUS) |
| 284 return base::MakeUnique<WindowCycleEventFilterAura>(); | 283 return base::MakeUnique<WindowCycleEventFilterAura>(); |
| 285 | 284 |
| 286 // TODO: implement me, http://crbug.com/629191. | 285 // TODO: implement me, http://crbug.com/629191. |
| 287 return nullptr; | 286 return nullptr; |
| 288 } | 287 } |
| 289 | 288 |
| 290 std::unique_ptr<wm::MaximizeModeEventHandler> | 289 std::unique_ptr<wm::MaximizeModeEventHandler> |
| 291 WmShellMus::CreateMaximizeModeEventHandler() { | 290 ShellPortMash::CreateMaximizeModeEventHandler() { |
| 292 if (GetAshConfig() == Config::MUS) | 291 if (GetAshConfig() == Config::MUS) |
| 293 return base::MakeUnique<wm::MaximizeModeEventHandlerAura>(); | 292 return base::MakeUnique<wm::MaximizeModeEventHandlerAura>(); |
| 294 | 293 |
| 295 // TODO: need support for window manager to get events before client: | 294 // TODO: need support for window manager to get events before client: |
| 296 // http://crbug.com/624157. | 295 // http://crbug.com/624157. |
| 297 NOTIMPLEMENTED(); | 296 NOTIMPLEMENTED(); |
| 298 return nullptr; | 297 return nullptr; |
| 299 } | 298 } |
| 300 | 299 |
| 301 std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> | 300 std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> |
| 302 WmShellMus::CreateScopedDisableInternalMouseAndKeyboard() { | 301 ShellPortMash::CreateScopedDisableInternalMouseAndKeyboard() { |
| 303 if (GetAshConfig() == Config::MUS) { | 302 if (GetAshConfig() == Config::MUS) { |
| 304 #if defined(USE_OZONE) | 303 #if defined(USE_OZONE) |
| 305 return base::MakeUnique<ScopedDisableInternalMouseAndKeyboardOzone>(); | 304 return base::MakeUnique<ScopedDisableInternalMouseAndKeyboardOzone>(); |
| 306 #else | 305 #else |
| 307 // TODO: remove this conditional. Bots build this config, but it is never | 306 // TODO: remove this conditional. Bots build this config, but it is never |
| 308 // actually used. http://crbug.com/671355. | 307 // actually used. http://crbug.com/671355. |
| 309 NOTREACHED(); | 308 NOTREACHED(); |
| 310 return nullptr; | 309 return nullptr; |
| 311 #endif | 310 #endif |
| 312 } | 311 } |
| 313 | 312 |
| 314 // TODO: needs implementation for mus, http://crbug.com/624967. | 313 // TODO: needs implementation for mus, http://crbug.com/624967. |
| 315 NOTIMPLEMENTED(); | 314 NOTIMPLEMENTED(); |
| 316 return nullptr; | 315 return nullptr; |
| 317 } | 316 } |
| 318 | 317 |
| 319 std::unique_ptr<WorkspaceEventHandler> WmShellMus::CreateWorkspaceEventHandler( | 318 std::unique_ptr<WorkspaceEventHandler> |
| 320 WmWindow* workspace_window) { | 319 ShellPortMash::CreateWorkspaceEventHandler(WmWindow* workspace_window) { |
| 321 if (GetAshConfig() == Config::MUS) | 320 if (GetAshConfig() == Config::MUS) |
| 322 return base::MakeUnique<WorkspaceEventHandlerAura>(workspace_window); | 321 return base::MakeUnique<WorkspaceEventHandlerAura>(workspace_window); |
| 323 | 322 |
| 324 return base::MakeUnique<WorkspaceEventHandlerMus>( | 323 return base::MakeUnique<WorkspaceEventHandlerMus>( |
| 325 WmWindow::GetAuraWindow(workspace_window)); | 324 WmWindow::GetAuraWindow(workspace_window)); |
| 326 } | 325 } |
| 327 | 326 |
| 328 std::unique_ptr<ImmersiveFullscreenController> | 327 std::unique_ptr<ImmersiveFullscreenController> |
| 329 WmShellMus::CreateImmersiveFullscreenController() { | 328 ShellPortMash::CreateImmersiveFullscreenController() { |
| 330 return base::MakeUnique<ImmersiveFullscreenController>(); | 329 return base::MakeUnique<ImmersiveFullscreenController>(); |
| 331 } | 330 } |
| 332 | 331 |
| 333 std::unique_ptr<KeyboardUI> WmShellMus::CreateKeyboardUI() { | 332 std::unique_ptr<KeyboardUI> ShellPortMash::CreateKeyboardUI() { |
| 334 if (GetAshConfig() == Config::MUS) | 333 if (GetAshConfig() == Config::MUS) |
| 335 return KeyboardUI::Create(); | 334 return KeyboardUI::Create(); |
| 336 | 335 |
| 337 return KeyboardUIMus::Create(window_manager_->connector()); | 336 return KeyboardUIMus::Create(window_manager_->connector()); |
| 338 } | 337 } |
| 339 | 338 |
| 340 std::unique_ptr<KeyEventWatcher> WmShellMus::CreateKeyEventWatcher() { | 339 std::unique_ptr<KeyEventWatcher> ShellPortMash::CreateKeyEventWatcher() { |
| 341 if (GetAshConfig() == Config::MUS) | 340 if (GetAshConfig() == Config::MUS) |
| 342 return base::MakeUnique<KeyEventWatcherAura>(); | 341 return base::MakeUnique<KeyEventWatcherAura>(); |
| 343 | 342 |
| 344 // TODO: needs implementation for mus, http://crbug.com/649600. | 343 // TODO: needs implementation for mus, http://crbug.com/649600. |
| 345 NOTIMPLEMENTED(); | 344 NOTIMPLEMENTED(); |
| 346 return std::unique_ptr<KeyEventWatcher>(); | 345 return std::unique_ptr<KeyEventWatcher>(); |
| 347 } | 346 } |
| 348 | 347 |
| 349 SessionStateDelegate* WmShellMus::GetSessionStateDelegate() { | 348 SessionStateDelegate* ShellPortMash::GetSessionStateDelegate() { |
| 350 return session_state_delegate_ ? session_state_delegate_.get() | 349 return session_state_delegate_ ? session_state_delegate_.get() |
| 351 : Shell::Get()->session_state_delegate(); | 350 : Shell::Get()->session_state_delegate(); |
| 352 } | 351 } |
| 353 | 352 |
| 354 void WmShellMus::AddDisplayObserver(WmDisplayObserver* observer) { | 353 void ShellPortMash::AddDisplayObserver(WmDisplayObserver* observer) { |
| 355 // TODO: need WmDisplayObserver support for mus. http://crbug.com/705831. | 354 // TODO: need WmDisplayObserver support for mus. http://crbug.com/705831. |
| 356 NOTIMPLEMENTED(); | 355 NOTIMPLEMENTED(); |
| 357 } | 356 } |
| 358 | 357 |
| 359 void WmShellMus::RemoveDisplayObserver(WmDisplayObserver* observer) { | 358 void ShellPortMash::RemoveDisplayObserver(WmDisplayObserver* observer) { |
| 360 // TODO: need WmDisplayObserver support for mus. http://crbug.com/705831. | 359 // TODO: need WmDisplayObserver support for mus. http://crbug.com/705831. |
| 361 NOTIMPLEMENTED(); | 360 NOTIMPLEMENTED(); |
| 362 } | 361 } |
| 363 | 362 |
| 364 void WmShellMus::AddPointerWatcher(views::PointerWatcher* watcher, | 363 void ShellPortMash::AddPointerWatcher(views::PointerWatcher* watcher, |
| 365 views::PointerWatcherEventTypes events) { | 364 views::PointerWatcherEventTypes events) { |
| 366 if (GetAshConfig() == Config::MUS) { | 365 if (GetAshConfig() == Config::MUS) { |
| 367 mus_state_->pointer_watcher_adapter->AddPointerWatcher(watcher, events); | 366 mus_state_->pointer_watcher_adapter->AddPointerWatcher(watcher, events); |
| 368 return; | 367 return; |
| 369 } | 368 } |
| 370 | 369 |
| 371 // TODO: implement drags for mus pointer watcher, http://crbug.com/641164. | 370 // TODO: implement drags for mus pointer watcher, http://crbug.com/641164. |
| 372 // NOTIMPLEMENTED drags for mus pointer watcher. | 371 // NOTIMPLEMENTED drags for mus pointer watcher. |
| 373 mash_state_->pointer_watcher_event_router->AddPointerWatcher( | 372 mash_state_->pointer_watcher_event_router->AddPointerWatcher( |
| 374 watcher, events == views::PointerWatcherEventTypes::MOVES); | 373 watcher, events == views::PointerWatcherEventTypes::MOVES); |
| 375 } | 374 } |
| 376 | 375 |
| 377 void WmShellMus::RemovePointerWatcher(views::PointerWatcher* watcher) { | 376 void ShellPortMash::RemovePointerWatcher(views::PointerWatcher* watcher) { |
| 378 if (GetAshConfig() == Config::MUS) { | 377 if (GetAshConfig() == Config::MUS) { |
| 379 mus_state_->pointer_watcher_adapter->RemovePointerWatcher(watcher); | 378 mus_state_->pointer_watcher_adapter->RemovePointerWatcher(watcher); |
| 380 return; | 379 return; |
| 381 } | 380 } |
| 382 | 381 |
| 383 mash_state_->pointer_watcher_event_router->RemovePointerWatcher(watcher); | 382 mash_state_->pointer_watcher_event_router->RemovePointerWatcher(watcher); |
| 384 } | 383 } |
| 385 | 384 |
| 386 bool WmShellMus::IsTouchDown() { | 385 bool ShellPortMash::IsTouchDown() { |
| 387 if (GetAshConfig() == Config::MUS) | 386 if (GetAshConfig() == Config::MUS) |
| 388 return aura::Env::GetInstance()->is_touch_down(); | 387 return aura::Env::GetInstance()->is_touch_down(); |
| 389 | 388 |
| 390 // TODO: implement me, http://crbug.com/634967. | 389 // TODO: implement me, http://crbug.com/634967. |
| 391 // NOTIMPLEMENTED is too spammy here. | 390 // NOTIMPLEMENTED is too spammy here. |
| 392 return false; | 391 return false; |
| 393 } | 392 } |
| 394 | 393 |
| 395 void WmShellMus::ToggleIgnoreExternalKeyboard() { | 394 void ShellPortMash::ToggleIgnoreExternalKeyboard() { |
| 396 if (GetAshConfig() == Config::MUS) { | 395 if (GetAshConfig() == Config::MUS) { |
| 397 Shell::Get()->virtual_keyboard_controller()->ToggleIgnoreExternalKeyboard(); | 396 Shell::Get()->virtual_keyboard_controller()->ToggleIgnoreExternalKeyboard(); |
| 398 return; | 397 return; |
| 399 } | 398 } |
| 400 | 399 |
| 401 NOTIMPLEMENTED(); | 400 NOTIMPLEMENTED(); |
| 402 } | 401 } |
| 403 | 402 |
| 404 void WmShellMus::SetLaserPointerEnabled(bool enabled) { | 403 void ShellPortMash::SetLaserPointerEnabled(bool enabled) { |
| 405 if (GetAshConfig() == Config::MUS) { | 404 if (GetAshConfig() == Config::MUS) { |
| 406 Shell::Get()->laser_pointer_controller()->SetEnabled(enabled); | 405 Shell::Get()->laser_pointer_controller()->SetEnabled(enabled); |
| 407 return; | 406 return; |
| 408 } | 407 } |
| 409 | 408 |
| 410 NOTIMPLEMENTED(); | 409 NOTIMPLEMENTED(); |
| 411 } | 410 } |
| 412 | 411 |
| 413 void WmShellMus::SetPartialMagnifierEnabled(bool enabled) { | 412 void ShellPortMash::SetPartialMagnifierEnabled(bool enabled) { |
| 414 if (GetAshConfig() == Config::MUS) { | 413 if (GetAshConfig() == Config::MUS) { |
| 415 Shell::Get()->partial_magnification_controller()->SetEnabled(enabled); | 414 Shell::Get()->partial_magnification_controller()->SetEnabled(enabled); |
| 416 return; | 415 return; |
| 417 } | 416 } |
| 418 | 417 |
| 419 NOTIMPLEMENTED(); | 418 NOTIMPLEMENTED(); |
| 420 } | 419 } |
| 421 | 420 |
| 422 void WmShellMus::CreatePointerWatcherAdapter() { | 421 void ShellPortMash::CreatePointerWatcherAdapter() { |
| 423 // In Config::MUS PointerWatcherAdapter must be created when this function is | 422 // In Config::MUS PointerWatcherAdapter must be created when this function is |
| 424 // called (it is order dependent), that is not the case with Config::MASH. | 423 // called (it is order dependent), that is not the case with Config::MASH. |
| 425 if (GetAshConfig() == Config::MUS) { | 424 if (GetAshConfig() == Config::MUS) { |
| 426 mus_state_->pointer_watcher_adapter = | 425 mus_state_->pointer_watcher_adapter = |
| 427 base::MakeUnique<PointerWatcherAdapter>(); | 426 base::MakeUnique<PointerWatcherAdapter>(); |
| 428 } | 427 } |
| 429 } | 428 } |
| 430 | 429 |
| 431 void WmShellMus::CreatePrimaryHost() {} | 430 void ShellPortMash::CreatePrimaryHost() {} |
| 432 | 431 |
| 433 void WmShellMus::InitHosts(const ShellInitParams& init_params) { | 432 void ShellPortMash::InitHosts(const ShellInitParams& init_params) { |
| 434 window_manager_->CreatePrimaryRootWindowController( | 433 window_manager_->CreatePrimaryRootWindowController( |
| 435 base::WrapUnique(init_params.primary_window_tree_host)); | 434 base::WrapUnique(init_params.primary_window_tree_host)); |
| 436 } | 435 } |
| 437 | 436 |
| 438 std::unique_ptr<AcceleratorController> | 437 std::unique_ptr<AcceleratorController> |
| 439 WmShellMus::CreateAcceleratorController() { | 438 ShellPortMash::CreateAcceleratorController() { |
| 440 if (GetAshConfig() == Config::MUS) { | 439 if (GetAshConfig() == Config::MUS) { |
| 441 DCHECK(!mus_state_->accelerator_controller_delegate); | 440 DCHECK(!mus_state_->accelerator_controller_delegate); |
| 442 mus_state_->accelerator_controller_delegate = | 441 mus_state_->accelerator_controller_delegate = |
| 443 base::MakeUnique<AcceleratorControllerDelegateAura>(); | 442 base::MakeUnique<AcceleratorControllerDelegateAura>(); |
| 444 return base::MakeUnique<AcceleratorController>( | 443 return base::MakeUnique<AcceleratorController>( |
| 445 mus_state_->accelerator_controller_delegate.get(), nullptr); | 444 mus_state_->accelerator_controller_delegate.get(), nullptr); |
| 446 } | 445 } |
| 447 | 446 |
| 448 DCHECK(!mash_state_->accelerator_controller_delegate); | 447 DCHECK(!mash_state_->accelerator_controller_delegate); |
| 449 | 448 |
| 450 uint16_t accelerator_namespace_id = 0u; | 449 uint16_t accelerator_namespace_id = 0u; |
| 451 const bool add_result = | 450 const bool add_result = |
| 452 window_manager_->GetNextAcceleratorNamespaceId(&accelerator_namespace_id); | 451 window_manager_->GetNextAcceleratorNamespaceId(&accelerator_namespace_id); |
| 453 // WmShellMus is created early on, so that GetNextAcceleratorNamespaceId() | 452 // ShellPortMash is created early on, so that GetNextAcceleratorNamespaceId() |
| 454 // should always succeed. | 453 // should always succeed. |
| 455 DCHECK(add_result); | 454 DCHECK(add_result); |
| 456 | 455 |
| 457 mash_state_->accelerator_controller_delegate = | 456 mash_state_->accelerator_controller_delegate = |
| 458 base::MakeUnique<AcceleratorControllerDelegateMus>(window_manager_); | 457 base::MakeUnique<AcceleratorControllerDelegateMus>(window_manager_); |
| 459 mash_state_->accelerator_controller_registrar = | 458 mash_state_->accelerator_controller_registrar = |
| 460 base ::MakeUnique<AcceleratorControllerRegistrar>( | 459 base ::MakeUnique<AcceleratorControllerRegistrar>( |
| 461 window_manager_, accelerator_namespace_id); | 460 window_manager_, accelerator_namespace_id); |
| 462 return base::MakeUnique<AcceleratorController>( | 461 return base::MakeUnique<AcceleratorController>( |
| 463 mash_state_->accelerator_controller_delegate.get(), | 462 mash_state_->accelerator_controller_delegate.get(), |
| 464 mash_state_->accelerator_controller_registrar.get()); | 463 mash_state_->accelerator_controller_registrar.get()); |
| 465 } | 464 } |
| 466 | 465 |
| 467 } // namespace mus | 466 } // namespace mus |
| 468 } // namespace ash | 467 } // namespace ash |
| OLD | NEW |