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

Side by Side Diff: ash/shell.cc

Issue 1594683002: Introduce DisplayConfigurationController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_576375_display1b1
Patch Set: Rebase Created 4 years, 11 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
OLDNEW
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 #include "ui/wm/core/visibility_controller.h" 113 #include "ui/wm/core/visibility_controller.h"
114 #include "ui/wm/core/window_modality_controller.h" 114 #include "ui/wm/core/window_modality_controller.h"
115 115
116 #if defined(OS_CHROMEOS) 116 #if defined(OS_CHROMEOS)
117 #if defined(USE_X11) 117 #if defined(USE_X11)
118 #include "ui/gfx/x/x11_types.h" 118 #include "ui/gfx/x/x11_types.h"
119 #endif // defined(USE_X11) 119 #endif // defined(USE_X11)
120 #include "ash/accelerators/magnifier_key_scroller.h" 120 #include "ash/accelerators/magnifier_key_scroller.h"
121 #include "ash/accelerators/spoken_feedback_toggler.h" 121 #include "ash/accelerators/spoken_feedback_toggler.h"
122 #include "ash/ash_constants.h" 122 #include "ash/ash_constants.h"
123 #include "ash/display/display_animator.h"
124 #include "ash/display/display_change_observer_chromeos.h" 123 #include "ash/display/display_change_observer_chromeos.h"
125 #include "ash/display/display_color_manager_chromeos.h" 124 #include "ash/display/display_color_manager_chromeos.h"
125 #include "ash/display/display_configuration_controller.h"
126 #include "ash/display/display_error_observer_chromeos.h" 126 #include "ash/display/display_error_observer_chromeos.h"
127 #include "ash/display/projecting_observer_chromeos.h" 127 #include "ash/display/projecting_observer_chromeos.h"
128 #include "ash/display/resolution_notification_controller.h" 128 #include "ash/display/resolution_notification_controller.h"
129 #include "ash/display/screen_orientation_controller_chromeos.h" 129 #include "ash/display/screen_orientation_controller_chromeos.h"
130 #include "ash/sticky_keys/sticky_keys_controller.h" 130 #include "ash/sticky_keys/sticky_keys_controller.h"
131 #include "ash/system/chromeos/bluetooth/bluetooth_notification_controller.h" 131 #include "ash/system/chromeos/bluetooth/bluetooth_notification_controller.h"
132 #include "ash/system/chromeos/brightness/brightness_controller_chromeos.h" 132 #include "ash/system/chromeos/brightness/brightness_controller_chromeos.h"
133 #include "ash/system/chromeos/power/power_event_observer.h" 133 #include "ash/system/chromeos/power/power_event_observer.h"
134 #include "ash/system/chromeos/power/power_status.h" 134 #include "ash/system/chromeos/power/power_status.h"
135 #include "ash/system/chromeos/power/video_activity_notifier.h" 135 #include "ash/system/chromeos/power/video_activity_notifier.h"
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 window_tree_host_manager_->Shutdown(); 804 window_tree_host_manager_->Shutdown();
805 window_tree_host_manager_.reset(); 805 window_tree_host_manager_.reset();
806 screen_position_controller_.reset(); 806 screen_position_controller_.reset();
807 accessibility_delegate_.reset(); 807 accessibility_delegate_.reset();
808 new_window_delegate_.reset(); 808 new_window_delegate_.reset();
809 media_delegate_.reset(); 809 media_delegate_.reset();
810 810
811 keyboard::KeyboardController::ResetInstance(nullptr); 811 keyboard::KeyboardController::ResetInstance(nullptr);
812 812
813 #if defined(OS_CHROMEOS) 813 #if defined(OS_CHROMEOS)
814 display_configuration_controller_.reset();
814 display_color_manager_.reset(); 815 display_color_manager_.reset();
815 if (display_change_observer_) 816 if (display_change_observer_)
816 display_configurator_->RemoveObserver(display_change_observer_.get()); 817 display_configurator_->RemoveObserver(display_change_observer_.get());
817 if (display_animator_)
818 display_configurator_->RemoveObserver(display_animator_.get());
819 if (display_error_observer_) 818 if (display_error_observer_)
820 display_configurator_->RemoveObserver(display_error_observer_.get()); 819 display_configurator_->RemoveObserver(display_error_observer_.get());
821 if (projecting_observer_) { 820 if (projecting_observer_) {
822 display_configurator_->RemoveObserver(projecting_observer_.get()); 821 display_configurator_->RemoveObserver(projecting_observer_.get());
823 RemoveShellObserver(projecting_observer_.get()); 822 RemoveShellObserver(projecting_observer_.get());
824 } 823 }
825 display_change_observer_.reset(); 824 display_change_observer_.reset();
826 825
827 PowerStatus::Shutdown(); 826 PowerStatus::Shutdown();
828 827
829 // Ensure that DBusThreadManager outlives this Shell. 828 // Ensure that DBusThreadManager outlives this Shell.
830 DCHECK(chromeos::DBusThreadManager::IsInitialized()); 829 DCHECK(chromeos::DBusThreadManager::IsInitialized());
831 #endif 830 #endif
832 831
833 DCHECK(instance_ == this); 832 DCHECK(instance_ == this);
834 instance_ = nullptr; 833 instance_ = nullptr;
835 } 834 }
836 835
837 void Shell::Init(const ShellInitParams& init_params) { 836 void Shell::Init(const ShellInitParams& init_params) {
838 delegate_->PreInit(); 837 delegate_->PreInit();
839 bool display_initialized = display_manager_->InitFromCommandLine(); 838 bool display_initialized = display_manager_->InitFromCommandLine();
840 #if defined(OS_CHROMEOS) 839 #if defined(OS_CHROMEOS)
841 display_configurator_->Init(!gpu_support_->IsPanelFittingDisabled()); 840 display_configurator_->Init(!gpu_support_->IsPanelFittingDisabled());
842 display_animator_.reset(new DisplayAnimator());
843 display_configurator_->AddObserver(display_animator_.get());
844 841
845 // The DBusThreadManager must outlive this Shell. See the DCHECK in ~Shell. 842 // The DBusThreadManager must outlive this Shell. See the DCHECK in ~Shell.
846 chromeos::DBusThreadManager* dbus_thread_manager = 843 chromeos::DBusThreadManager* dbus_thread_manager =
847 chromeos::DBusThreadManager::Get(); 844 chromeos::DBusThreadManager::Get();
848 projecting_observer_.reset( 845 projecting_observer_.reset(
849 new ProjectingObserver(dbus_thread_manager->GetPowerManagerClient())); 846 new ProjectingObserver(dbus_thread_manager->GetPowerManagerClient()));
850 display_configurator_->AddObserver(projecting_observer_.get()); 847 display_configurator_->AddObserver(projecting_observer_.get());
851 AddShellObserver(projecting_observer_.get()); 848 AddShellObserver(projecting_observer_.get());
852 849
853 if (!display_initialized && base::SysInfo::IsRunningOnChromeOS()) { 850 if (!display_initialized && base::SysInfo::IsRunningOnChromeOS()) {
854 display_change_observer_.reset(new DisplayChangeObserver); 851 display_change_observer_.reset(new DisplayChangeObserver);
855 // Register |display_change_observer_| first so that the rest of 852 // Register |display_change_observer_| first so that the rest of
856 // observer gets invoked after the root windows are configured. 853 // observer gets invoked after the root windows are configured.
857 display_configurator_->AddObserver(display_change_observer_.get()); 854 display_configurator_->AddObserver(display_change_observer_.get());
858 display_error_observer_.reset(new DisplayErrorObserver()); 855 display_error_observer_.reset(new DisplayErrorObserver());
859 display_configurator_->AddObserver(display_error_observer_.get()); 856 display_configurator_->AddObserver(display_error_observer_.get());
860 display_configurator_->set_state_controller(display_change_observer_.get()); 857 display_configurator_->set_state_controller(display_change_observer_.get());
861 display_configurator_->set_mirroring_controller(display_manager_.get()); 858 display_configurator_->set_mirroring_controller(display_manager_.get());
862 display_configurator_->ForceInitialConfigure( 859 display_configurator_->ForceInitialConfigure(
863 delegate_->IsFirstRunAfterBoot() ? kChromeOsBootColor : 0); 860 delegate_->IsFirstRunAfterBoot() ? kChromeOsBootColor : 0);
864 display_initialized = true; 861 display_initialized = true;
865 } 862 }
866 display_color_manager_.reset( 863 display_color_manager_.reset(
867 new DisplayColorManager(display_configurator_.get(), blocking_pool_)); 864 new DisplayColorManager(display_configurator_.get(), blocking_pool_));
865
866 display_configuration_controller_.reset(new DisplayConfigurationController(
867 display_configurator_.get(), display_manager_.get(),
868 window_tree_host_manager_.get()));
868 #endif // defined(OS_CHROMEOS) 869 #endif // defined(OS_CHROMEOS)
870
869 if (!display_initialized) 871 if (!display_initialized)
870 display_manager_->InitDefaultDisplay(); 872 display_manager_->InitDefaultDisplay();
871 873
872 display_manager_->RefreshFontParams(); 874 display_manager_->RefreshFontParams();
873 875
874 // Install the custom factory first so that views::FocusManagers for Tray, 876 // Install the custom factory first so that views::FocusManagers for Tray,
875 // Shelf, and WallPaper could be created by the factory. 877 // Shelf, and WallPaper could be created by the factory.
876 views::FocusManagerFactory::Install(new AshFocusManagerFactory); 878 views::FocusManagerFactory::Install(new AshFocusManagerFactory);
877 879
878 aura::Env::GetInstance()->set_context_factory(init_params.context_factory); 880 aura::Env::GetInstance()->set_context_factory(init_params.context_factory);
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 1170
1169 void Shell::OnWindowActivated( 1171 void Shell::OnWindowActivated(
1170 aura::client::ActivationChangeObserver::ActivationReason reason, 1172 aura::client::ActivationChangeObserver::ActivationReason reason,
1171 aura::Window* gained_active, 1173 aura::Window* gained_active,
1172 aura::Window* lost_active) { 1174 aura::Window* lost_active) {
1173 if (gained_active) 1175 if (gained_active)
1174 target_root_window_ = gained_active->GetRootWindow(); 1176 target_root_window_ = gained_active->GetRootWindow();
1175 } 1177 }
1176 1178
1177 } // namespace ash 1179 } // namespace ash
OLDNEW
« ash/display/display_manager.cc ('K') | « ash/shell.h ('k') | ash/test/shell_test_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698