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

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

Issue 2783563002: Make WmShellMus use classic types for mus (Closed)
Patch Set: feedback 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
« no previous file with comments | « ash/mus/bridge/wm_shell_mus.h ('k') | ash/wm/maximize_mode/maximize_mode_event_handler_aura.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 22 matching lines...) Expand all
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
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 mus_state_->pointer_watcher_adapter.reset();
msw 2017/03/28 21:27:00 optional nit: nest in |if (GetConfig() == Config::
sky 2017/03/28 21:56:08 Done.
153
126 WmShell::Shutdown(); 154 WmShell::Shutdown();
127 155
128 window_manager_->DeleteAllRootWindowControllers(); 156 window_manager_->DeleteAllRootWindowControllers();
129 } 157 }
130 158
131 bool WmShellMus::IsRunningInMash() const { 159 bool WmShellMus::IsRunningInMash() const {
132 return GetConfig() == Config::MASH; 160 return GetConfig() == Config::MASH;
133 } 161 }
134 162
135 Config WmShellMus::GetConfig() const { 163 Config WmShellMus::GetConfig() const {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 std::vector<WmWindow*> WmShellMus::GetAllRootWindows() { 262 std::vector<WmWindow*> WmShellMus::GetAllRootWindows() {
235 std::vector<WmWindow*> root_windows; 263 std::vector<WmWindow*> root_windows;
236 for (RootWindowController* root_window_controller : 264 for (RootWindowController* root_window_controller :
237 RootWindowController::root_window_controllers()) { 265 RootWindowController::root_window_controllers()) {
238 root_windows.push_back(root_window_controller->GetWindow()); 266 root_windows.push_back(root_window_controller->GetWindow());
239 } 267 }
240 return root_windows; 268 return root_windows;
241 } 269 }
242 270
243 void WmShellMus::RecordGestureAction(GestureActionType action) { 271 void WmShellMus::RecordGestureAction(GestureActionType action) {
272 if (GetConfig() == Config::MUS) {
273 TouchUMA::GetInstance()->RecordGestureAction(action);
274 return;
275 }
244 // TODO: http://crbug.com/616581. 276 // TODO: http://crbug.com/616581.
245 NOTIMPLEMENTED(); 277 NOTIMPLEMENTED();
246 } 278 }
247 279
248 void WmShellMus::RecordUserMetricsAction(UserMetricsAction action) { 280 void WmShellMus::RecordUserMetricsAction(UserMetricsAction action) {
281 if (GetConfig() == Config::MUS) {
282 Shell::GetInstance()->metrics()->RecordUserMetricsAction(action);
283 return;
284 }
249 // TODO: http://crbug.com/616581. 285 // TODO: http://crbug.com/616581.
250 NOTIMPLEMENTED(); 286 NOTIMPLEMENTED();
251 } 287 }
252 288
253 void WmShellMus::RecordTaskSwitchMetric(TaskSwitchSource source) { 289 void WmShellMus::RecordTaskSwitchMetric(TaskSwitchSource source) {
290 if (GetConfig() == Config::MUS) {
291 Shell::GetInstance()
292 ->metrics()
293 ->task_switch_metrics_recorder()
294 .OnTaskSwitch(source);
295 return;
296 }
254 // TODO: http://crbug.com/616581. 297 // TODO: http://crbug.com/616581.
255 NOTIMPLEMENTED(); 298 NOTIMPLEMENTED();
256 } 299 }
257 300
258 std::unique_ptr<WindowResizer> WmShellMus::CreateDragWindowResizer( 301 std::unique_ptr<WindowResizer> WmShellMus::CreateDragWindowResizer(
259 std::unique_ptr<WindowResizer> next_window_resizer, 302 std::unique_ptr<WindowResizer> next_window_resizer,
260 wm::WindowState* window_state) { 303 wm::WindowState* window_state) {
261 return base::MakeUnique<DragWindowResizer>(std::move(next_window_resizer), 304 if (GetConfig() == Config::MUS) {
262 window_state); 305 return base::WrapUnique(ash::DragWindowResizer::Create(
306 next_window_resizer.release(), window_state));
307 }
308 return base::MakeUnique<ash::mus::DragWindowResizer>(
309 std::move(next_window_resizer), window_state);
263 } 310 }
264 311
265 std::unique_ptr<WindowCycleEventFilter> 312 std::unique_ptr<WindowCycleEventFilter>
266 WmShellMus::CreateWindowCycleEventFilter() { 313 WmShellMus::CreateWindowCycleEventFilter() {
314 if (GetConfig() == Config::MUS)
315 return base::MakeUnique<WindowCycleEventFilterAura>();
316
267 // TODO: implement me, http://crbug.com/629191. 317 // TODO: implement me, http://crbug.com/629191.
268 return nullptr; 318 return nullptr;
269 } 319 }
270 320
271 std::unique_ptr<wm::MaximizeModeEventHandler> 321 std::unique_ptr<wm::MaximizeModeEventHandler>
272 WmShellMus::CreateMaximizeModeEventHandler() { 322 WmShellMus::CreateMaximizeModeEventHandler() {
323 if (GetConfig() == Config::MUS)
324 return base::MakeUnique<wm::MaximizeModeEventHandlerAura>();
325
273 // TODO: need support for window manager to get events before client: 326 // TODO: need support for window manager to get events before client:
274 // http://crbug.com/624157. 327 // http://crbug.com/624157.
275 NOTIMPLEMENTED(); 328 NOTIMPLEMENTED();
276 return nullptr; 329 return nullptr;
277 } 330 }
278 331
279 std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> 332 std::unique_ptr<ScopedDisableInternalMouseAndKeyboard>
280 WmShellMus::CreateScopedDisableInternalMouseAndKeyboard() { 333 WmShellMus::CreateScopedDisableInternalMouseAndKeyboard() {
334 if (GetConfig() == Config::MUS) {
335 #if defined(USE_OZONE)
336 return base::MakeUnique<ScopedDisableInternalMouseAndKeyboardOzone>();
337 #else
338 // TODO: remove this conditional. Bots build this config, but it is never
339 // actually used. http://crbug.com/671355.
340 NOTREACHED();
341 return nullptr;
342 #endif
343 }
344
281 // TODO: needs implementation for mus, http://crbug.com/624967. 345 // TODO: needs implementation for mus, http://crbug.com/624967.
282 NOTIMPLEMENTED(); 346 NOTIMPLEMENTED();
283 return nullptr; 347 return nullptr;
284 } 348 }
285 349
286 std::unique_ptr<WorkspaceEventHandler> WmShellMus::CreateWorkspaceEventHandler( 350 std::unique_ptr<WorkspaceEventHandler> WmShellMus::CreateWorkspaceEventHandler(
287 WmWindow* workspace_window) { 351 WmWindow* workspace_window) {
352 if (GetConfig() == Config::MUS)
353 return base::MakeUnique<WorkspaceEventHandlerAura>(workspace_window);
354
288 return base::MakeUnique<WorkspaceEventHandlerMus>( 355 return base::MakeUnique<WorkspaceEventHandlerMus>(
289 WmWindow::GetAuraWindow(workspace_window)); 356 WmWindow::GetAuraWindow(workspace_window));
290 } 357 }
291 358
292 std::unique_ptr<ImmersiveFullscreenController> 359 std::unique_ptr<ImmersiveFullscreenController>
293 WmShellMus::CreateImmersiveFullscreenController() { 360 WmShellMus::CreateImmersiveFullscreenController() {
294 return base::MakeUnique<ImmersiveFullscreenController>(); 361 return base::MakeUnique<ImmersiveFullscreenController>();
295 } 362 }
296 363
297 std::unique_ptr<KeyboardUI> WmShellMus::CreateKeyboardUI() { 364 std::unique_ptr<KeyboardUI> WmShellMus::CreateKeyboardUI() {
365 if (GetConfig() == Config::MUS)
366 return KeyboardUI::Create();
367
298 return KeyboardUIMus::Create(window_manager_->connector()); 368 return KeyboardUIMus::Create(window_manager_->connector());
299 } 369 }
300 370
301 std::unique_ptr<KeyEventWatcher> WmShellMus::CreateKeyEventWatcher() { 371 std::unique_ptr<KeyEventWatcher> WmShellMus::CreateKeyEventWatcher() {
372 if (GetConfig() == Config::MUS)
373 return base::MakeUnique<KeyEventWatcherAura>();
374
302 // TODO: needs implementation for mus, http://crbug.com/649600. 375 // TODO: needs implementation for mus, http://crbug.com/649600.
303 NOTIMPLEMENTED(); 376 NOTIMPLEMENTED();
304 return std::unique_ptr<KeyEventWatcher>(); 377 return std::unique_ptr<KeyEventWatcher>();
305 } 378 }
306 379
307 SessionStateDelegate* WmShellMus::GetSessionStateDelegate() { 380 SessionStateDelegate* WmShellMus::GetSessionStateDelegate() {
308 return session_state_delegate_ 381 return session_state_delegate_
309 ? session_state_delegate_.get() 382 ? session_state_delegate_.get()
310 : Shell::GetInstance()->session_state_delegate(); 383 : Shell::GetInstance()->session_state_delegate();
311 } 384 }
312 385
313 void WmShellMus::AddDisplayObserver(WmDisplayObserver* observer) { 386 void WmShellMus::AddDisplayObserver(WmDisplayObserver* observer) {
387 // TODO: need WmDisplayObserver support for mus. http://crbug.com/705831.
314 NOTIMPLEMENTED(); 388 NOTIMPLEMENTED();
315 } 389 }
316 390
317 void WmShellMus::RemoveDisplayObserver(WmDisplayObserver* observer) { 391 void WmShellMus::RemoveDisplayObserver(WmDisplayObserver* observer) {
392 // TODO: need WmDisplayObserver support for mus. http://crbug.com/705831.
318 NOTIMPLEMENTED(); 393 NOTIMPLEMENTED();
319 } 394 }
320 395
321 void WmShellMus::AddPointerWatcher(views::PointerWatcher* watcher, 396 void WmShellMus::AddPointerWatcher(views::PointerWatcher* watcher,
322 views::PointerWatcherEventTypes events) { 397 views::PointerWatcherEventTypes events) {
398 if (GetConfig() == Config::MUS) {
399 mus_state_->pointer_watcher_adapter->AddPointerWatcher(watcher, events);
400 return;
401 }
402
323 // TODO: implement drags for mus pointer watcher, http://crbug.com/641164. 403 // TODO: implement drags for mus pointer watcher, http://crbug.com/641164.
324 // NOTIMPLEMENTED drags for mus pointer watcher. 404 // NOTIMPLEMENTED drags for mus pointer watcher.
325 pointer_watcher_event_router_->AddPointerWatcher( 405 mash_state_->pointer_watcher_event_router->AddPointerWatcher(
326 watcher, events == views::PointerWatcherEventTypes::MOVES); 406 watcher, events == views::PointerWatcherEventTypes::MOVES);
327 } 407 }
328 408
329 void WmShellMus::RemovePointerWatcher(views::PointerWatcher* watcher) { 409 void WmShellMus::RemovePointerWatcher(views::PointerWatcher* watcher) {
330 pointer_watcher_event_router_->RemovePointerWatcher(watcher); 410 if (GetConfig() == Config::MUS) {
411 mus_state_->pointer_watcher_adapter->RemovePointerWatcher(watcher);
412 return;
413 }
414
415 mash_state_->pointer_watcher_event_router->RemovePointerWatcher(watcher);
331 } 416 }
332 417
333 bool WmShellMus::IsTouchDown() { 418 bool WmShellMus::IsTouchDown() {
419 if (GetConfig() == Config::MUS)
420 return aura::Env::GetInstance()->is_touch_down();
421
334 // TODO: implement me, http://crbug.com/634967. 422 // TODO: implement me, http://crbug.com/634967.
335 // NOTIMPLEMENTED is too spammy here. 423 // NOTIMPLEMENTED is too spammy here.
336 return false; 424 return false;
337 } 425 }
338 426
339 void WmShellMus::ToggleIgnoreExternalKeyboard() { 427 void WmShellMus::ToggleIgnoreExternalKeyboard() {
428 if (GetConfig() == Config::MUS) {
429 Shell::GetInstance()
430 ->virtual_keyboard_controller()
431 ->ToggleIgnoreExternalKeyboard();
432 return;
433 }
434
340 NOTIMPLEMENTED(); 435 NOTIMPLEMENTED();
341 } 436 }
342 437
343 void WmShellMus::SetLaserPointerEnabled(bool enabled) { 438 void WmShellMus::SetLaserPointerEnabled(bool enabled) {
439 if (GetConfig() == Config::MUS) {
440 Shell::GetInstance()->laser_pointer_controller()->SetEnabled(enabled);
441 return;
442 }
443
344 NOTIMPLEMENTED(); 444 NOTIMPLEMENTED();
345 } 445 }
346 446
347 void WmShellMus::SetPartialMagnifierEnabled(bool enabled) { 447 void WmShellMus::SetPartialMagnifierEnabled(bool enabled) {
448 if (GetConfig() == Config::MUS) {
449 Shell::GetInstance()->partial_magnification_controller()->SetEnabled(
450 enabled);
451 return;
452 }
453
348 NOTIMPLEMENTED(); 454 NOTIMPLEMENTED();
349 } 455 }
350 456
351 void WmShellMus::CreatePointerWatcherAdapter() { 457 void WmShellMus::CreatePointerWatcherAdapter() {
352 // Only needed in WmShellAura, which has specific creation order. 458 // In Config::MUS PointerWatcherAdapter must be created when this function is
459 // called (it is order dependent), that is not the case with Config::MASH.
460 if (GetConfig() == Config::MUS) {
461 mus_state_->pointer_watcher_adapter =
462 base::MakeUnique<PointerWatcherAdapter>();
463 }
353 } 464 }
354 465
355 void WmShellMus::CreatePrimaryHost() {} 466 void WmShellMus::CreatePrimaryHost() {}
356 467
357 void WmShellMus::InitHosts(const ShellInitParams& init_params) { 468 void WmShellMus::InitHosts(const ShellInitParams& init_params) {
358 window_manager_->CreatePrimaryRootWindowController( 469 window_manager_->CreatePrimaryRootWindowController(
359 base::WrapUnique(init_params.primary_window_tree_host)); 470 base::WrapUnique(init_params.primary_window_tree_host));
360 } 471 }
361 472
362 std::unique_ptr<AcceleratorController> 473 std::unique_ptr<AcceleratorController>
363 WmShellMus::CreateAcceleratorController() { 474 WmShellMus::CreateAcceleratorController() {
364 DCHECK(!accelerator_controller_delegate_);
365 if (GetConfig() == Config::MUS) { 475 if (GetConfig() == Config::MUS) {
366 accelerator_controller_delegate_classic_ = 476 DCHECK(!mus_state_->accelerator_controller_delegate);
477 mus_state_->accelerator_controller_delegate =
367 base::MakeUnique<AcceleratorControllerDelegateAura>(); 478 base::MakeUnique<AcceleratorControllerDelegateAura>();
368 return base::MakeUnique<AcceleratorController>( 479 return base::MakeUnique<AcceleratorController>(
369 accelerator_controller_delegate_classic_.get(), nullptr); 480 mus_state_->accelerator_controller_delegate.get(), nullptr);
370 } 481 }
371 482
483 DCHECK(!mash_state_->accelerator_controller_delegate);
484
372 uint16_t accelerator_namespace_id = 0u; 485 uint16_t accelerator_namespace_id = 0u;
373 const bool add_result = 486 const bool add_result =
374 window_manager_->GetNextAcceleratorNamespaceId(&accelerator_namespace_id); 487 window_manager_->GetNextAcceleratorNamespaceId(&accelerator_namespace_id);
375 // WmShellMus is created early on, so that GetNextAcceleratorNamespaceId() 488 // WmShellMus is created early on, so that GetNextAcceleratorNamespaceId()
376 // should always succeed. 489 // should always succeed.
377 DCHECK(add_result); 490 DCHECK(add_result);
378 491
379 accelerator_controller_delegate_ = 492 mash_state_->accelerator_controller_delegate =
380 base::MakeUnique<AcceleratorControllerDelegateMus>(window_manager_); 493 base::MakeUnique<AcceleratorControllerDelegateMus>(window_manager_);
381 accelerator_controller_registrar_ = 494 mash_state_->accelerator_controller_registrar =
382 base ::MakeUnique<AcceleratorControllerRegistrar>( 495 base ::MakeUnique<AcceleratorControllerRegistrar>(
383 window_manager_, accelerator_namespace_id); 496 window_manager_, accelerator_namespace_id);
384 return base::MakeUnique<AcceleratorController>( 497 return base::MakeUnique<AcceleratorController>(
385 accelerator_controller_delegate_.get(), 498 mash_state_->accelerator_controller_delegate.get(),
386 accelerator_controller_registrar_.get()); 499 mash_state_->accelerator_controller_registrar.get());
387 } 500 }
388 501
389 } // namespace mus 502 } // namespace mus
390 } // namespace ash 503 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/bridge/wm_shell_mus.h ('k') | ash/wm/maximize_mode/maximize_mode_event_handler_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698