| 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/cast_config_controller.h" | 10 #include "ash/common/cast_config_controller.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "ash/common/wm/root_window_finder.h" | 38 #include "ash/common/wm/root_window_finder.h" |
| 39 #include "ash/common/wm/system_modal_container_layout_manager.h" | 39 #include "ash/common/wm/system_modal_container_layout_manager.h" |
| 40 #include "ash/common/wm/window_cycle_controller.h" | 40 #include "ash/common/wm/window_cycle_controller.h" |
| 41 #include "ash/common/wm_window.h" | 41 #include "ash/common/wm_window.h" |
| 42 #include "ash/public/cpp/shell_window_ids.h" | 42 #include "ash/public/cpp/shell_window_ids.h" |
| 43 #include "ash/root_window_controller.h" | 43 #include "ash/root_window_controller.h" |
| 44 #include "ash/shell.h" | 44 #include "ash/shell.h" |
| 45 #include "base/bind.h" | 45 #include "base/bind.h" |
| 46 #include "base/logging.h" | 46 #include "base/logging.h" |
| 47 #include "base/memory/ptr_util.h" | 47 #include "base/memory/ptr_util.h" |
| 48 #include "ui/app_list/presenter/app_list.h" | |
| 49 #include "ui/display/display.h" | 48 #include "ui/display/display.h" |
| 50 | 49 |
| 51 namespace ash { | 50 namespace ash { |
| 52 | 51 |
| 53 // static | 52 // static |
| 54 WmShell* WmShell::instance_ = nullptr; | 53 WmShell* WmShell::instance_ = nullptr; |
| 55 | 54 |
| 56 WmShell::~WmShell() { | 55 WmShell::~WmShell() { |
| 57 DCHECK_EQ(this, instance_); | 56 DCHECK_EQ(this, instance_); |
| 58 instance_ = nullptr; | 57 instance_ = nullptr; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 void WmShell::RemoveLockStateObserver(LockStateObserver* observer) { | 136 void WmShell::RemoveLockStateObserver(LockStateObserver* observer) { |
| 138 lock_state_observers_.RemoveObserver(observer); | 137 lock_state_observers_.RemoveObserver(observer); |
| 139 } | 138 } |
| 140 | 139 |
| 141 void WmShell::SetShelfDelegateForTesting( | 140 void WmShell::SetShelfDelegateForTesting( |
| 142 std::unique_ptr<ShelfDelegate> test_delegate) { | 141 std::unique_ptr<ShelfDelegate> test_delegate) { |
| 143 shelf_delegate_ = std::move(test_delegate); | 142 shelf_delegate_ = std::move(test_delegate); |
| 144 } | 143 } |
| 145 | 144 |
| 146 WmShell::WmShell() | 145 WmShell::WmShell() |
| 147 : app_list_(base::MakeUnique<app_list::AppList>()), | 146 : brightness_control_delegate_( |
| 148 brightness_control_delegate_( | |
| 149 base::MakeUnique<system::BrightnessControllerChromeos>()), | 147 base::MakeUnique<system::BrightnessControllerChromeos>()), |
| 150 cast_config_(base::MakeUnique<CastConfigController>()), | 148 cast_config_(base::MakeUnique<CastConfigController>()), |
| 151 focus_cycler_(base::MakeUnique<FocusCycler>()), | 149 focus_cycler_(base::MakeUnique<FocusCycler>()), |
| 152 immersive_context_(base::MakeUnique<ImmersiveContextAsh>()), | 150 immersive_context_(base::MakeUnique<ImmersiveContextAsh>()), |
| 153 keyboard_brightness_control_delegate_( | 151 keyboard_brightness_control_delegate_( |
| 154 base::MakeUnique<KeyboardBrightnessController>()), | 152 base::MakeUnique<KeyboardBrightnessController>()), |
| 155 locale_notification_controller_( | 153 locale_notification_controller_( |
| 156 base::MakeUnique<LocaleNotificationController>()), | 154 base::MakeUnique<LocaleNotificationController>()), |
| 157 media_controller_(base::MakeUnique<MediaController>()), | 155 media_controller_(base::MakeUnique<MediaController>()), |
| 158 new_window_controller_(base::MakeUnique<NewWindowController>()), | 156 new_window_controller_(base::MakeUnique<NewWindowController>()), |
| 159 session_controller_(base::MakeUnique<SessionController>()), | 157 session_controller_(base::MakeUnique<SessionController>()), |
| 160 shelf_controller_(base::MakeUnique<ShelfController>()), | 158 shelf_controller_(base::MakeUnique<ShelfController>()), |
| 161 shutdown_controller_(base::MakeUnique<ShutdownController>()), | 159 shutdown_controller_(base::MakeUnique<ShutdownController>()), |
| 162 system_tray_controller_(base::MakeUnique<SystemTrayController>()), | 160 system_tray_controller_(base::MakeUnique<SystemTrayController>()), |
| 163 system_tray_notifier_(base::MakeUnique<SystemTrayNotifier>()), | 161 system_tray_notifier_(base::MakeUnique<SystemTrayNotifier>()), |
| 164 vpn_list_(base::MakeUnique<VpnList>()), | 162 vpn_list_(base::MakeUnique<VpnList>()), |
| 165 window_cycle_controller_(base::MakeUnique<WindowCycleController>()), | 163 window_cycle_controller_(base::MakeUnique<WindowCycleController>()), |
| 166 window_selector_controller_( | 164 window_selector_controller_( |
| 167 base::MakeUnique<WindowSelectorController>()) { | 165 base::MakeUnique<WindowSelectorController>()) { |
| 168 DCHECK(!instance_); | 166 DCHECK(!instance_); |
| 169 instance_ = this; | 167 instance_ = this; |
| 170 session_controller_->AddSessionStateObserver(this); | 168 session_controller_->AddSessionStateObserver(this); |
| 171 | |
| 172 } | 169 } |
| 173 | 170 |
| 174 RootWindowController* WmShell::GetPrimaryRootWindowController() { | 171 RootWindowController* WmShell::GetPrimaryRootWindowController() { |
| 175 return GetPrimaryRootWindow()->GetRootWindowController(); | 172 return GetPrimaryRootWindow()->GetRootWindowController(); |
| 176 } | 173 } |
| 177 | 174 |
| 178 bool WmShell::IsForceMaximizeOnFirstRun() { | 175 bool WmShell::IsForceMaximizeOnFirstRun() { |
| 179 return Shell::Get()->shell_delegate()->IsForceMaximizeOnFirstRun(); | 176 return Shell::Get()->shell_delegate()->IsForceMaximizeOnFirstRun(); |
| 180 } | 177 } |
| 181 | 178 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 return; | 213 return; |
| 217 } | 214 } |
| 218 } | 215 } |
| 219 for (WmWindow* root_window : root_windows) { | 216 for (WmWindow* root_window : root_windows) { |
| 220 root_window->GetRootWindowController() | 217 root_window->GetRootWindowController() |
| 221 ->GetSystemModalLayoutManager(removed) | 218 ->GetSystemModalLayoutManager(removed) |
| 222 ->DestroyModalBackground(); | 219 ->DestroyModalBackground(); |
| 223 } | 220 } |
| 224 } | 221 } |
| 225 | 222 |
| 226 void WmShell::ShowAppList() { | |
| 227 // Show the app list on the default display for new windows. | |
| 228 app_list_->Show( | |
| 229 Shell::GetWmRootWindowForNewWindows()->GetDisplayNearestWindow().id()); | |
| 230 } | |
| 231 | |
| 232 void WmShell::DismissAppList() { | |
| 233 app_list_->Dismiss(); | |
| 234 } | |
| 235 | |
| 236 void WmShell::ToggleAppList() { | |
| 237 // Toggle the app list on the default display for new windows. | |
| 238 app_list_->ToggleAppList( | |
| 239 Shell::GetWmRootWindowForNewWindows()->GetDisplayNearestWindow().id()); | |
| 240 } | |
| 241 | |
| 242 bool WmShell::IsApplistVisible() const { | |
| 243 return app_list_->IsVisible(); | |
| 244 } | |
| 245 | |
| 246 bool WmShell::GetAppListTargetVisibility() const { | |
| 247 return app_list_->GetTargetVisibility(); | |
| 248 } | |
| 249 | |
| 250 void WmShell::SetKeyboardUI(std::unique_ptr<KeyboardUI> keyboard_ui) { | 223 void WmShell::SetKeyboardUI(std::unique_ptr<KeyboardUI> keyboard_ui) { |
| 251 keyboard_ui_ = std::move(keyboard_ui); | 224 keyboard_ui_ = std::move(keyboard_ui); |
| 252 } | 225 } |
| 253 | 226 |
| 254 void WmShell::SetSystemTrayDelegate( | 227 void WmShell::SetSystemTrayDelegate( |
| 255 std::unique_ptr<SystemTrayDelegate> delegate) { | 228 std::unique_ptr<SystemTrayDelegate> delegate) { |
| 256 DCHECK(delegate); | 229 DCHECK(delegate); |
| 257 system_tray_delegate_ = std::move(delegate); | 230 system_tray_delegate_ = std::move(delegate); |
| 258 system_tray_delegate_->Initialize(); | 231 system_tray_delegate_->Initialize(); |
| 259 // Accesses WmShell in its constructor. | 232 // Accesses WmShell in its constructor. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 279 |
| 307 // Only trigger an update in mash because with classic ash chrome calls | 280 // Only trigger an update in mash because with classic ash chrome calls |
| 308 // UpdateAfterLoginStatusChange() directly. | 281 // UpdateAfterLoginStatusChange() directly. |
| 309 if (IsRunningInMash()) { | 282 if (IsRunningInMash()) { |
| 310 // TODO(jamescook): Should this call Shell::OnLoginStatusChanged() too? | 283 // TODO(jamescook): Should this call Shell::OnLoginStatusChanged() too? |
| 311 UpdateAfterLoginStatusChange(session_controller_->GetLoginStatus()); | 284 UpdateAfterLoginStatusChange(session_controller_->GetLoginStatus()); |
| 312 } | 285 } |
| 313 } | 286 } |
| 314 | 287 |
| 315 } // namespace ash | 288 } // namespace ash |
| OLD | NEW |