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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, | 118 std::unique_ptr<ShellDelegate> shell_delegate, |
119 WindowManager* window_manager, | 119 WindowManager* window_manager, |
120 views::PointerWatcherEventRouter* pointer_watcher_event_router) | 120 views::PointerWatcherEventRouter* pointer_watcher_event_router, |
| 121 bool create_session_state_delegate_stub) |
121 : WmShell(std::move(shell_delegate)), | 122 : WmShell(std::move(shell_delegate)), |
122 window_manager_(window_manager), | 123 window_manager_(window_manager), |
123 primary_root_window_(primary_root_window), | 124 primary_root_window_(primary_root_window), |
124 pointer_watcher_event_router_(pointer_watcher_event_router), | 125 pointer_watcher_event_router_(pointer_watcher_event_router) { |
125 session_state_delegate_(new SessionStateDelegateStub) { | 126 if (create_session_state_delegate_stub) |
| 127 session_state_delegate_ = base::MakeUnique<SessionStateDelegateStub>(); |
126 DCHECK(primary_root_window_); | 128 DCHECK(primary_root_window_); |
127 WmShell::Set(this); | 129 WmShell::Set(this); |
128 | 130 |
129 uint16_t accelerator_namespace_id = 0u; | 131 uint16_t accelerator_namespace_id = 0u; |
130 const bool add_result = | 132 const bool add_result = |
131 window_manager->GetNextAcceleratorNamespaceId(&accelerator_namespace_id); | 133 window_manager->GetNextAcceleratorNamespaceId(&accelerator_namespace_id); |
132 // WmShellMus is created early on, so that this should always succeed. | 134 // WmShellMus is created early on, so that this should always succeed. |
133 DCHECK(add_result); | 135 DCHECK(add_result); |
134 accelerator_controller_delegate_.reset( | 136 accelerator_controller_delegate_.reset( |
135 new AcceleratorControllerDelegateMus(window_manager_)); | 137 new AcceleratorControllerDelegateMus(window_manager_)); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 for (auto& observer : *shell_observers()) | 365 for (auto& observer : *shell_observers()) |
364 observer.OnOverviewModeStarting(); | 366 observer.OnOverviewModeStarting(); |
365 } | 367 } |
366 | 368 |
367 void WmShellMus::OnOverviewModeEnded() { | 369 void WmShellMus::OnOverviewModeEnded() { |
368 for (auto& observer : *shell_observers()) | 370 for (auto& observer : *shell_observers()) |
369 observer.OnOverviewModeEnded(); | 371 observer.OnOverviewModeEnded(); |
370 } | 372 } |
371 | 373 |
372 SessionStateDelegate* WmShellMus::GetSessionStateDelegate() { | 374 SessionStateDelegate* WmShellMus::GetSessionStateDelegate() { |
373 return session_state_delegate_.get(); | 375 return session_state_delegate_ |
| 376 ? session_state_delegate_.get() |
| 377 : Shell::GetInstance()->session_state_delegate(); |
374 } | 378 } |
375 | 379 |
376 void WmShellMus::AddDisplayObserver(WmDisplayObserver* observer) { | 380 void WmShellMus::AddDisplayObserver(WmDisplayObserver* observer) { |
377 NOTIMPLEMENTED(); | 381 NOTIMPLEMENTED(); |
378 } | 382 } |
379 | 383 |
380 void WmShellMus::RemoveDisplayObserver(WmDisplayObserver* observer) { | 384 void WmShellMus::RemoveDisplayObserver(WmDisplayObserver* observer) { |
381 NOTIMPLEMENTED(); | 385 NOTIMPLEMENTED(); |
382 } | 386 } |
383 | 387 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 } | 420 } |
417 | 421 |
418 void WmShellMus::CreatePrimaryHost() {} | 422 void WmShellMus::CreatePrimaryHost() {} |
419 | 423 |
420 void WmShellMus::InitHosts(const ShellInitParams& init_params) { | 424 void WmShellMus::InitHosts(const ShellInitParams& init_params) { |
421 window_manager_->CreatePrimaryRootWindowController( | 425 window_manager_->CreatePrimaryRootWindowController( |
422 base::WrapUnique(init_params.primary_window_tree_host)); | 426 base::WrapUnique(init_params.primary_window_tree_host)); |
423 } | 427 } |
424 } // namespace mus | 428 } // namespace mus |
425 } // namespace ash | 429 } // namespace ash |
OLD | NEW |