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

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: DisplayAnimator -> DisplayAnimatorChromeOS 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
11 #include "ash/accelerators/accelerator_controller.h" 11 #include "ash/accelerators/accelerator_controller.h"
12 #include "ash/accelerators/accelerator_delegate.h" 12 #include "ash/accelerators/accelerator_delegate.h"
13 #include "ash/accelerators/focus_manager_factory.h" 13 #include "ash/accelerators/focus_manager_factory.h"
14 #include "ash/accelerators/nested_accelerator_delegate.h" 14 #include "ash/accelerators/nested_accelerator_delegate.h"
15 #include "ash/ash_switches.h" 15 #include "ash/ash_switches.h"
16 #include "ash/autoclick/autoclick_controller.h" 16 #include "ash/autoclick/autoclick_controller.h"
17 #include "ash/desktop_background/desktop_background_controller.h" 17 #include "ash/desktop_background/desktop_background_controller.h"
18 #include "ash/desktop_background/desktop_background_view.h" 18 #include "ash/desktop_background/desktop_background_view.h"
19 #include "ash/desktop_background/user_wallpaper_delegate.h" 19 #include "ash/desktop_background/user_wallpaper_delegate.h"
20 #include "ash/display/cursor_window_controller.h" 20 #include "ash/display/cursor_window_controller.h"
21 #include "ash/display/display_configuration_controller.h"
21 #include "ash/display/display_manager.h" 22 #include "ash/display/display_manager.h"
22 #include "ash/display/event_transformation_handler.h" 23 #include "ash/display/event_transformation_handler.h"
23 #include "ash/display/mouse_cursor_event_filter.h" 24 #include "ash/display/mouse_cursor_event_filter.h"
24 #include "ash/display/screen_position_controller.h" 25 #include "ash/display/screen_position_controller.h"
25 #include "ash/display/window_tree_host_manager.h" 26 #include "ash/display/window_tree_host_manager.h"
26 #include "ash/drag_drop/drag_drop_controller.h" 27 #include "ash/drag_drop/drag_drop_controller.h"
27 #include "ash/first_run/first_run_helper_impl.h" 28 #include "ash/first_run/first_run_helper_impl.h"
28 #include "ash/focus_cycler.h" 29 #include "ash/focus_cycler.h"
29 #include "ash/frame/custom_frame_view_ash.h" 30 #include "ash/frame/custom_frame_view_ash.h"
30 #include "ash/gpu_support.h" 31 #include "ash/gpu_support.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 #include "ui/wm/core/visibility_controller.h" 114 #include "ui/wm/core/visibility_controller.h"
114 #include "ui/wm/core/window_modality_controller.h" 115 #include "ui/wm/core/window_modality_controller.h"
115 116
116 #if defined(OS_CHROMEOS) 117 #if defined(OS_CHROMEOS)
117 #if defined(USE_X11) 118 #if defined(USE_X11)
118 #include "ui/gfx/x/x11_types.h" 119 #include "ui/gfx/x/x11_types.h"
119 #endif // defined(USE_X11) 120 #endif // defined(USE_X11)
120 #include "ash/accelerators/magnifier_key_scroller.h" 121 #include "ash/accelerators/magnifier_key_scroller.h"
121 #include "ash/accelerators/spoken_feedback_toggler.h" 122 #include "ash/accelerators/spoken_feedback_toggler.h"
122 #include "ash/ash_constants.h" 123 #include "ash/ash_constants.h"
123 #include "ash/display/display_animator.h"
124 #include "ash/display/display_change_observer_chromeos.h" 124 #include "ash/display/display_change_observer_chromeos.h"
125 #include "ash/display/display_color_manager_chromeos.h" 125 #include "ash/display/display_color_manager_chromeos.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"
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 794
795 #if defined(OS_CHROMEOS) 795 #if defined(OS_CHROMEOS)
796 touch_transformer_controller_.reset(); 796 touch_transformer_controller_.reset();
797 #endif // defined(OS_CHROMEOS) 797 #endif // defined(OS_CHROMEOS)
798 798
799 // This also deletes all RootWindows. Note that we invoke Shutdown() on 799 // This also deletes all RootWindows. Note that we invoke Shutdown() on
800 // WindowTreeHostManager before resetting |window_tree_host_manager_|, since 800 // WindowTreeHostManager before resetting |window_tree_host_manager_|, since
801 // destruction 801 // destruction
802 // of its owned RootWindowControllers relies on the value. 802 // of its owned RootWindowControllers relies on the value.
803 display_manager_->CreateScreenForShutdown(); 803 display_manager_->CreateScreenForShutdown();
804 display_configuration_controller_.reset();
804 window_tree_host_manager_->Shutdown(); 805 window_tree_host_manager_->Shutdown();
805 window_tree_host_manager_.reset(); 806 window_tree_host_manager_.reset();
806 screen_position_controller_.reset(); 807 screen_position_controller_.reset();
807 accessibility_delegate_.reset(); 808 accessibility_delegate_.reset();
808 new_window_delegate_.reset(); 809 new_window_delegate_.reset();
809 media_delegate_.reset(); 810 media_delegate_.reset();
810 811
811 keyboard::KeyboardController::ResetInstance(nullptr); 812 keyboard::KeyboardController::ResetInstance(nullptr);
812 813
813 #if defined(OS_CHROMEOS) 814 #if defined(OS_CHROMEOS)
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();
839
840 display_configuration_controller_.reset(new DisplayConfigurationController(
841 display_manager_.get(), window_tree_host_manager_.get()));
842
840 #if defined(OS_CHROMEOS) 843 #if defined(OS_CHROMEOS)
841 display_configurator_->Init(!gpu_support_->IsPanelFittingDisabled()); 844 display_configurator_->Init(!gpu_support_->IsPanelFittingDisabled());
842 display_animator_.reset(new DisplayAnimator());
843 display_configurator_->AddObserver(display_animator_.get());
844 845
845 // The DBusThreadManager must outlive this Shell. See the DCHECK in ~Shell. 846 // The DBusThreadManager must outlive this Shell. See the DCHECK in ~Shell.
846 chromeos::DBusThreadManager* dbus_thread_manager = 847 chromeos::DBusThreadManager* dbus_thread_manager =
847 chromeos::DBusThreadManager::Get(); 848 chromeos::DBusThreadManager::Get();
848 projecting_observer_.reset( 849 projecting_observer_.reset(
849 new ProjectingObserver(dbus_thread_manager->GetPowerManagerClient())); 850 new ProjectingObserver(dbus_thread_manager->GetPowerManagerClient()));
850 display_configurator_->AddObserver(projecting_observer_.get()); 851 display_configurator_->AddObserver(projecting_observer_.get());
851 AddShellObserver(projecting_observer_.get()); 852 AddShellObserver(projecting_observer_.get());
852 853
853 if (!display_initialized && base::SysInfo::IsRunningOnChromeOS()) { 854 if (!display_initialized && base::SysInfo::IsRunningOnChromeOS()) {
854 display_change_observer_.reset(new DisplayChangeObserver); 855 display_change_observer_.reset(new DisplayChangeObserver);
855 // Register |display_change_observer_| first so that the rest of 856 // Register |display_change_observer_| first so that the rest of
856 // observer gets invoked after the root windows are configured. 857 // observer gets invoked after the root windows are configured.
857 display_configurator_->AddObserver(display_change_observer_.get()); 858 display_configurator_->AddObserver(display_change_observer_.get());
858 display_error_observer_.reset(new DisplayErrorObserver()); 859 display_error_observer_.reset(new DisplayErrorObserver());
859 display_configurator_->AddObserver(display_error_observer_.get()); 860 display_configurator_->AddObserver(display_error_observer_.get());
860 display_configurator_->set_state_controller(display_change_observer_.get()); 861 display_configurator_->set_state_controller(display_change_observer_.get());
861 display_configurator_->set_mirroring_controller(display_manager_.get()); 862 display_configurator_->set_mirroring_controller(display_manager_.get());
862 display_configurator_->ForceInitialConfigure( 863 display_configurator_->ForceInitialConfigure(
863 delegate_->IsFirstRunAfterBoot() ? kChromeOsBootColor : 0); 864 delegate_->IsFirstRunAfterBoot() ? kChromeOsBootColor : 0);
864 display_initialized = true; 865 display_initialized = true;
865 } 866 }
866 display_color_manager_.reset( 867 display_color_manager_.reset(
867 new DisplayColorManager(display_configurator_.get(), blocking_pool_)); 868 new DisplayColorManager(display_configurator_.get(), blocking_pool_));
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

Powered by Google App Engine
This is Rietveld 408576698