| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/shell.h" | 5 #include "ash/shell.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 keyboard::KeyboardController::ResetInstance(nullptr); | 366 keyboard::KeyboardController::ResetInstance(nullptr); |
| 367 } | 367 } |
| 368 | 368 |
| 369 bool Shell::ShouldSaveDisplaySettings() { | 369 bool Shell::ShouldSaveDisplaySettings() { |
| 370 DCHECK(GetAshConfig() != Config::MASH); | 370 DCHECK(GetAshConfig() != Config::MASH); |
| 371 return !( | 371 return !( |
| 372 screen_orientation_controller_->ignore_display_configuration_updates() || | 372 screen_orientation_controller_->ignore_display_configuration_updates() || |
| 373 resolution_notification_controller_->DoesNotificationTimeout()); | 373 resolution_notification_controller_->DoesNotificationTimeout()); |
| 374 } | 374 } |
| 375 | 375 |
| 376 NightLightController* Shell::night_light_controller() { |
| 377 DCHECK(NightLightController::IsFeatureEnabled()); |
| 378 return night_light_controller_.get(); |
| 379 } |
| 380 |
| 376 ShelfModel* Shell::shelf_model() { | 381 ShelfModel* Shell::shelf_model() { |
| 377 return shelf_controller_->model(); | 382 return shelf_controller_->model(); |
| 378 } | 383 } |
| 379 | 384 |
| 380 ::wm::ActivationClient* Shell::activation_client() { | 385 ::wm::ActivationClient* Shell::activation_client() { |
| 381 return focus_controller_.get(); | 386 return focus_controller_.get(); |
| 382 } | 387 } |
| 383 | 388 |
| 384 void Shell::UpdateShelfVisibility() { | 389 void Shell::UpdateShelfVisibility() { |
| 385 for (aura::Window* root : GetAllRootWindows()) | 390 for (aura::Window* root : GetAllRootWindows()) |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 focus_cycler_(base::MakeUnique<FocusCycler>()), | 559 focus_cycler_(base::MakeUnique<FocusCycler>()), |
| 555 immersive_context_(base::MakeUnique<ImmersiveContextAsh>()), | 560 immersive_context_(base::MakeUnique<ImmersiveContextAsh>()), |
| 556 keyboard_brightness_control_delegate_( | 561 keyboard_brightness_control_delegate_( |
| 557 base::MakeUnique<KeyboardBrightnessController>()), | 562 base::MakeUnique<KeyboardBrightnessController>()), |
| 558 locale_notification_controller_( | 563 locale_notification_controller_( |
| 559 base::MakeUnique<LocaleNotificationController>()), | 564 base::MakeUnique<LocaleNotificationController>()), |
| 560 lock_screen_controller_(base::MakeUnique<LockScreenController>()), | 565 lock_screen_controller_(base::MakeUnique<LockScreenController>()), |
| 561 media_controller_(base::MakeUnique<MediaController>()), | 566 media_controller_(base::MakeUnique<MediaController>()), |
| 562 new_window_controller_(base::MakeUnique<NewWindowController>()), | 567 new_window_controller_(base::MakeUnique<NewWindowController>()), |
| 563 session_controller_(base::MakeUnique<SessionController>()), | 568 session_controller_(base::MakeUnique<SessionController>()), |
| 564 night_light_controller_( | |
| 565 base::MakeUnique<NightLightController>(session_controller_.get())), | |
| 566 shelf_controller_(base::MakeUnique<ShelfController>()), | 569 shelf_controller_(base::MakeUnique<ShelfController>()), |
| 567 shell_delegate_(std::move(shell_delegate)), | 570 shell_delegate_(std::move(shell_delegate)), |
| 568 shutdown_controller_(base::MakeUnique<ShutdownController>()), | 571 shutdown_controller_(base::MakeUnique<ShutdownController>()), |
| 569 system_tray_controller_(base::MakeUnique<SystemTrayController>()), | 572 system_tray_controller_(base::MakeUnique<SystemTrayController>()), |
| 570 system_tray_notifier_(base::MakeUnique<SystemTrayNotifier>()), | 573 system_tray_notifier_(base::MakeUnique<SystemTrayNotifier>()), |
| 571 tray_action_(base::MakeUnique<TrayAction>()), | 574 tray_action_(base::MakeUnique<TrayAction>()), |
| 572 vpn_list_(base::MakeUnique<VpnList>()), | 575 vpn_list_(base::MakeUnique<VpnList>()), |
| 573 window_cycle_controller_(base::MakeUnique<WindowCycleController>()), | 576 window_cycle_controller_(base::MakeUnique<WindowCycleController>()), |
| 574 window_selector_controller_(base::MakeUnique<WindowSelectorController>()), | 577 window_selector_controller_(base::MakeUnique<WindowSelectorController>()), |
| 575 app_list_(base::MakeUnique<app_list::AppList>()), | 578 app_list_(base::MakeUnique<app_list::AppList>()), |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 pref_service_ = nullptr; | 786 pref_service_ = nullptr; |
| 784 shell_delegate_.reset(); | 787 shell_delegate_.reset(); |
| 785 | 788 |
| 786 DCHECK(instance_ == this); | 789 DCHECK(instance_ == this); |
| 787 instance_ = nullptr; | 790 instance_ = nullptr; |
| 788 } | 791 } |
| 789 | 792 |
| 790 void Shell::Init(const ShellInitParams& init_params) { | 793 void Shell::Init(const ShellInitParams& init_params) { |
| 791 const Config config = shell_port_->GetAshConfig(); | 794 const Config config = shell_port_->GetAshConfig(); |
| 792 | 795 |
| 796 if (NightLightController::IsFeatureEnabled()) { |
| 797 night_light_controller_ = |
| 798 base::MakeUnique<NightLightController>(session_controller_.get()); |
| 799 } |
| 800 |
| 793 blocking_pool_ = init_params.blocking_pool; | 801 blocking_pool_ = init_params.blocking_pool; |
| 794 | 802 |
| 795 wallpaper_delegate_ = shell_delegate_->CreateWallpaperDelegate(); | 803 wallpaper_delegate_ = shell_delegate_->CreateWallpaperDelegate(); |
| 796 | 804 |
| 797 // Can be null in tests. | 805 // Can be null in tests. |
| 798 if (config == Config::MASH && shell_delegate_->GetShellConnector()) { | 806 if (config == Config::MASH && shell_delegate_->GetShellConnector()) { |
| 799 auto pref_registry = base::MakeRefCounted<PrefRegistrySimple>(); | 807 auto pref_registry = base::MakeRefCounted<PrefRegistrySimple>(); |
| 800 Shell::RegisterPrefs(pref_registry.get()); | 808 Shell::RegisterPrefs(pref_registry.get()); |
| 801 prefs::ConnectToPrefService( | 809 prefs::ConnectToPrefService( |
| 802 shell_delegate_->GetShellConnector(), std::move(pref_registry), {}, | 810 shell_delegate_->GetShellConnector(), std::move(pref_registry), {}, |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 void Shell::OnPrefServiceInitialized( | 1267 void Shell::OnPrefServiceInitialized( |
| 1260 std::unique_ptr<::PrefService> pref_service) { | 1268 std::unique_ptr<::PrefService> pref_service) { |
| 1261 if (!instance_) | 1269 if (!instance_) |
| 1262 return; | 1270 return; |
| 1263 // |pref_service_| is null if can't connect to Chrome (as happens when | 1271 // |pref_service_| is null if can't connect to Chrome (as happens when |
| 1264 // running mash outside of chrome --mash and chrome isn't built). | 1272 // running mash outside of chrome --mash and chrome isn't built). |
| 1265 pref_service_ = std::move(pref_service); | 1273 pref_service_ = std::move(pref_service); |
| 1266 } | 1274 } |
| 1267 | 1275 |
| 1268 } // namespace ash | 1276 } // namespace ash |
| OLD | NEW |