| 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/common/wm_shell.h" | 5 #include "ash/common/wm_shell.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/media_controller.h" | |
| 11 #include "ash/common/new_window_controller.h" | |
| 12 #include "ash/common/session/session_controller.h" | 10 #include "ash/common/session/session_controller.h" |
| 13 #include "ash/common/session/session_state_delegate.h" | 11 #include "ash/common/session/session_state_delegate.h" |
| 14 #include "ash/common/shelf/app_list_shelf_item_delegate.h" | 12 #include "ash/common/shelf/app_list_shelf_item_delegate.h" |
| 15 #include "ash/common/shelf/shelf_controller.h" | 13 #include "ash/common/shelf/shelf_controller.h" |
| 16 #include "ash/common/shelf/shelf_delegate.h" | 14 #include "ash/common/shelf/shelf_delegate.h" |
| 17 #include "ash/common/shelf/shelf_model.h" | 15 #include "ash/common/shelf/shelf_model.h" |
| 18 #include "ash/common/shelf/shelf_window_watcher.h" | 16 #include "ash/common/shelf/shelf_window_watcher.h" |
| 19 #include "ash/common/shell_delegate.h" | 17 #include "ash/common/shell_delegate.h" |
| 20 #include "ash/common/shutdown_controller.h" | 18 #include "ash/common/shutdown_controller.h" |
| 21 #include "ash/common/system/chromeos/network/vpn_list.h" | 19 #include "ash/common/system/chromeos/network/vpn_list.h" |
| 22 #include "ash/common/system/tray/system_tray_notifier.h" | 20 #include "ash/common/system/tray/system_tray_notifier.h" |
| 23 #include "ash/common/wm/immersive_context_ash.h" | |
| 24 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | |
| 25 #include "ash/common/wm/mru_window_tracker.h" | |
| 26 #include "ash/common/wm/overview/window_selector_controller.h" | 21 #include "ash/common/wm/overview/window_selector_controller.h" |
| 27 #include "ash/common/wm/root_window_finder.h" | 22 #include "ash/common/wm/root_window_finder.h" |
| 28 #include "ash/common/wm/system_modal_container_layout_manager.h" | 23 #include "ash/common/wm/system_modal_container_layout_manager.h" |
| 29 #include "ash/common/wm/window_cycle_controller.h" | 24 #include "ash/common/wm/window_cycle_controller.h" |
| 30 #include "ash/common/wm_window.h" | 25 #include "ash/common/wm_window.h" |
| 31 #include "ash/public/cpp/shell_window_ids.h" | 26 #include "ash/public/cpp/shell_window_ids.h" |
| 32 #include "ash/root_window_controller.h" | 27 #include "ash/root_window_controller.h" |
| 33 #include "ash/shell.h" | 28 #include "ash/shell.h" |
| 34 #include "base/bind.h" | 29 #include "base/bind.h" |
| 35 #include "base/logging.h" | 30 #include "base/logging.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 void WmShell::RemoveLockStateObserver(LockStateObserver* observer) { | 120 void WmShell::RemoveLockStateObserver(LockStateObserver* observer) { |
| 126 lock_state_observers_.RemoveObserver(observer); | 121 lock_state_observers_.RemoveObserver(observer); |
| 127 } | 122 } |
| 128 | 123 |
| 129 void WmShell::SetShelfDelegateForTesting( | 124 void WmShell::SetShelfDelegateForTesting( |
| 130 std::unique_ptr<ShelfDelegate> test_delegate) { | 125 std::unique_ptr<ShelfDelegate> test_delegate) { |
| 131 shelf_delegate_ = std::move(test_delegate); | 126 shelf_delegate_ = std::move(test_delegate); |
| 132 } | 127 } |
| 133 | 128 |
| 134 WmShell::WmShell() | 129 WmShell::WmShell() |
| 135 : immersive_context_(base::MakeUnique<ImmersiveContextAsh>()), | 130 : session_controller_(base::MakeUnique<SessionController>()), |
| 136 media_controller_(base::MakeUnique<MediaController>()), | |
| 137 new_window_controller_(base::MakeUnique<NewWindowController>()), | |
| 138 session_controller_(base::MakeUnique<SessionController>()), | |
| 139 shelf_controller_(base::MakeUnique<ShelfController>()), | 131 shelf_controller_(base::MakeUnique<ShelfController>()), |
| 140 shutdown_controller_(base::MakeUnique<ShutdownController>()), | 132 shutdown_controller_(base::MakeUnique<ShutdownController>()), |
| 141 system_tray_notifier_(base::MakeUnique<SystemTrayNotifier>()), | 133 system_tray_notifier_(base::MakeUnique<SystemTrayNotifier>()), |
| 142 vpn_list_(base::MakeUnique<VpnList>()), | 134 vpn_list_(base::MakeUnique<VpnList>()), |
| 143 window_cycle_controller_(base::MakeUnique<WindowCycleController>()), | 135 window_cycle_controller_(base::MakeUnique<WindowCycleController>()), |
| 144 window_selector_controller_( | 136 window_selector_controller_( |
| 145 base::MakeUnique<WindowSelectorController>()) { | 137 base::MakeUnique<WindowSelectorController>()) { |
| 146 DCHECK(!instance_); | 138 DCHECK(!instance_); |
| 147 instance_ = this; | 139 instance_ = this; |
| 148 session_controller_->AddSessionStateObserver(this); | 140 session_controller_->AddSessionStateObserver(this); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 } | 193 } |
| 202 | 194 |
| 203 void WmShell::DeleteWindowCycleController() { | 195 void WmShell::DeleteWindowCycleController() { |
| 204 window_cycle_controller_.reset(); | 196 window_cycle_controller_.reset(); |
| 205 } | 197 } |
| 206 | 198 |
| 207 void WmShell::DeleteWindowSelectorController() { | 199 void WmShell::DeleteWindowSelectorController() { |
| 208 window_selector_controller_.reset(); | 200 window_selector_controller_.reset(); |
| 209 } | 201 } |
| 210 | 202 |
| 211 void WmShell::CreateMaximizeModeController() { | |
| 212 maximize_mode_controller_.reset(new MaximizeModeController); | |
| 213 } | |
| 214 | |
| 215 void WmShell::DeleteMaximizeModeController() { | |
| 216 maximize_mode_controller_.reset(); | |
| 217 } | |
| 218 | |
| 219 void WmShell::CreateMruWindowTracker() { | |
| 220 mru_window_tracker_.reset(new MruWindowTracker); | |
| 221 } | |
| 222 | |
| 223 void WmShell::DeleteMruWindowTracker() { | |
| 224 mru_window_tracker_.reset(); | |
| 225 } | |
| 226 | |
| 227 void WmShell::SessionStateChanged(session_manager::SessionState state) { | 203 void WmShell::SessionStateChanged(session_manager::SessionState state) { |
| 228 // Create the shelf when a session becomes active. It's safe to do this | 204 // Create the shelf when a session becomes active. It's safe to do this |
| 229 // multiple times (e.g. initial login vs. multiprofile add session). | 205 // multiple times (e.g. initial login vs. multiprofile add session). |
| 230 if (state == session_manager::SessionState::ACTIVE) | 206 if (state == session_manager::SessionState::ACTIVE) |
| 231 CreateShelfView(); | 207 CreateShelfView(); |
| 232 | 208 |
| 233 // Only trigger an update in mash because with classic ash chrome calls | 209 // Only trigger an update in mash because with classic ash chrome calls |
| 234 // UpdateAfterLoginStatusChange() directly. | 210 // UpdateAfterLoginStatusChange() directly. |
| 235 if (IsRunningInMash()) { | 211 if (IsRunningInMash()) { |
| 236 // TODO(jamescook): Should this call Shell::OnLoginStatusChanged() too? | 212 // TODO(jamescook): Should this call Shell::OnLoginStatusChanged() too? |
| 237 UpdateAfterLoginStatusChange(session_controller_->GetLoginStatus()); | 213 UpdateAfterLoginStatusChange(session_controller_->GetLoginStatus()); |
| 238 } | 214 } |
| 239 } | 215 } |
| 240 | 216 |
| 241 } // namespace ash | 217 } // namespace ash |
| OLD | NEW |