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

Side by Side Diff: ash/shell.cc

Issue 2840043003: chromeos: Makes mushrome use simplified display management (Closed)
Patch Set: merge Created 3 years, 7 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
« no previous file with comments | « ash/mus/window_manager_application.cc ('k') | ash/shell_init_params.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 #include "ui/base/ui_base_switches.h" 147 #include "ui/base/ui_base_switches.h"
148 #include "ui/base/user_activity/user_activity_detector.h" 148 #include "ui/base/user_activity/user_activity_detector.h"
149 #include "ui/chromeos/user_activity_power_manager_notifier.h" 149 #include "ui/chromeos/user_activity_power_manager_notifier.h"
150 #include "ui/compositor/layer.h" 150 #include "ui/compositor/layer.h"
151 #include "ui/compositor/layer_animator.h" 151 #include "ui/compositor/layer_animator.h"
152 #include "ui/display/display.h" 152 #include "ui/display/display.h"
153 #include "ui/display/manager/chromeos/display_change_observer.h" 153 #include "ui/display/manager/chromeos/display_change_observer.h"
154 #include "ui/display/manager/chromeos/display_configurator.h" 154 #include "ui/display/manager/chromeos/display_configurator.h"
155 #include "ui/display/manager/display_manager.h" 155 #include "ui/display/manager/display_manager.h"
156 #include "ui/display/screen.h" 156 #include "ui/display/screen.h"
157 #include "ui/display/types/native_display_delegate.h"
157 #include "ui/events/event_target_iterator.h" 158 #include "ui/events/event_target_iterator.h"
158 #include "ui/gfx/geometry/insets.h" 159 #include "ui/gfx/geometry/insets.h"
159 #include "ui/gfx/image/image_skia.h" 160 #include "ui/gfx/image/image_skia.h"
160 #include "ui/keyboard/keyboard_controller.h" 161 #include "ui/keyboard/keyboard_controller.h"
161 #include "ui/keyboard/keyboard_switches.h" 162 #include "ui/keyboard/keyboard_switches.h"
162 #include "ui/keyboard/keyboard_util.h" 163 #include "ui/keyboard/keyboard_util.h"
163 #include "ui/views/corewm/tooltip_aura.h" 164 #include "ui/views/corewm/tooltip_aura.h"
164 #include "ui/views/corewm/tooltip_controller.h" 165 #include "ui/views/corewm/tooltip_controller.h"
165 #include "ui/views/focus/focus_manager_factory.h" 166 #include "ui/views/focus/focus_manager_factory.h"
166 #include "ui/views/widget/native_widget_aura.h" 167 #include "ui/views/widget/native_widget_aura.h"
167 #include "ui/views/widget/widget.h" 168 #include "ui/views/widget/widget.h"
168 #include "ui/wm/core/accelerator_filter.h" 169 #include "ui/wm/core/accelerator_filter.h"
169 #include "ui/wm/core/compound_event_filter.h" 170 #include "ui/wm/core/compound_event_filter.h"
170 #include "ui/wm/core/focus_controller.h" 171 #include "ui/wm/core/focus_controller.h"
171 #include "ui/wm/core/shadow_controller.h" 172 #include "ui/wm/core/shadow_controller.h"
172 #include "ui/wm/core/visibility_controller.h" 173 #include "ui/wm/core/visibility_controller.h"
173 #include "ui/wm/core/window_modality_controller.h" 174 #include "ui/wm/core/window_modality_controller.h"
174 175
175 #if defined(USE_X11)
176 #include "ui/display/manager/chromeos/x11/native_display_delegate_x11.h"
177 #include "ui/gfx/x/x11_types.h" // nogncheck
178 #endif
179
180 #if defined(USE_OZONE)
181 #include "ui/display/types/native_display_delegate.h"
182 #include "ui/ozone/public/ozone_platform.h"
183 #endif
184
185 namespace ash { 176 namespace ash {
186 177
187 namespace { 178 namespace {
188 179
189 using aura::Window; 180 using aura::Window;
190 using views::Widget; 181 using views::Widget;
191 182
192 // A Corewm VisibilityController subclass that calls the Ash animation routine 183 // A Corewm VisibilityController subclass that calls the Ash animation routine
193 // so we can pick up our extended animations. See ash/wm/window_animations.h. 184 // so we can pick up our extended animations. See ash/wm/window_animations.h.
194 class AshVisibilityController : public ::wm::VisibilityController { 185 class AshVisibilityController : public ::wm::VisibilityController {
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 app_list_(base::MakeUnique<app_list::AppList>()), 563 app_list_(base::MakeUnique<app_list::AppList>()),
573 link_handler_model_factory_(nullptr), 564 link_handler_model_factory_(nullptr),
574 tray_bluetooth_helper_(base::MakeUnique<TrayBluetoothHelper>()), 565 tray_bluetooth_helper_(base::MakeUnique<TrayBluetoothHelper>()),
575 display_configurator_(new display::DisplayConfigurator()), 566 display_configurator_(new display::DisplayConfigurator()),
576 native_cursor_manager_(nullptr), 567 native_cursor_manager_(nullptr),
577 simulate_modal_window_open_for_testing_(false), 568 simulate_modal_window_open_for_testing_(false),
578 is_touch_hud_projection_enabled_(false) { 569 is_touch_hud_projection_enabled_(false) {
579 // TODO(sky): better refactor cash/mash dependencies. Perhaps put all cash 570 // TODO(sky): better refactor cash/mash dependencies. Perhaps put all cash
580 // state on ShellPortClassic. http://crbug.com/671246. 571 // state on ShellPortClassic. http://crbug.com/671246.
581 572
573 gpu_support_.reset(shell_delegate_->CreateGPUSupport());
574
582 // Don't use Shell::GetAshConfig() as |instance_| has not yet been set. 575 // Don't use Shell::GetAshConfig() as |instance_| has not yet been set.
583 if (shell_port_->GetAshConfig() != Config::MASH) { 576 if (shell_port_->GetAshConfig() != Config::MASH) {
584 gpu_support_.reset(shell_delegate_->CreateGPUSupport());
585 display_manager_.reset(ScreenAsh::CreateDisplayManager()); 577 display_manager_.reset(ScreenAsh::CreateDisplayManager());
586 window_tree_host_manager_.reset(new WindowTreeHostManager); 578 window_tree_host_manager_.reset(new WindowTreeHostManager);
587 user_metrics_recorder_.reset(new UserMetricsRecorder); 579 user_metrics_recorder_.reset(new UserMetricsRecorder);
588 } 580 }
589 581
590 PowerStatus::Initialize(); 582 PowerStatus::Initialize();
591 583
592 session_controller_->AddObserver(this); 584 session_controller_->AddObserver(this);
593 } 585 }
594 586
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 window_positioner_ = base::MakeUnique<WindowPositioner>(); 831 window_positioner_ = base::MakeUnique<WindowPositioner>();
840 832
841 if (config == Config::CLASSIC) { 833 if (config == Config::CLASSIC) {
842 // TODO: needs to work in mus. http://crbug.com/705592. 834 // TODO: needs to work in mus. http://crbug.com/705592.
843 native_cursor_manager_ = new AshNativeCursorManager; 835 native_cursor_manager_ = new AshNativeCursorManager;
844 cursor_manager_.reset( 836 cursor_manager_.reset(
845 new CursorManager(base::WrapUnique(native_cursor_manager_))); 837 new CursorManager(base::WrapUnique(native_cursor_manager_)));
846 } 838 }
847 839
848 shell_delegate_->PreInit(); 840 shell_delegate_->PreInit();
849 bool display_initialized = true; 841 // TODO(sky): remove MASH from here.
850 if (config == Config::CLASSIC) { 842 bool display_initialized =
851 // TODO: decide if this needs to be made to work in Config::MUS. 843 (config == Config::MASH || display_manager_->InitFromCommandLine());
852 // http://crbug.com/705595. 844 if (config == Config::MUS && !display_initialized) {
853 display_initialized = display_manager_->InitFromCommandLine(); 845 // Run display configuration off device in mus mode.
854 846 display_manager_->set_configure_displays(true);
847 display_configurator_->set_configure_display(true);
848 }
849 if (config != Config::MASH) {
850 // TODO(sky): should work in mash too.
855 display_configuration_controller_.reset(new DisplayConfigurationController( 851 display_configuration_controller_.reset(new DisplayConfigurationController(
856 display_manager_.get(), window_tree_host_manager_.get())); 852 display_manager_.get(), window_tree_host_manager_.get()));
857 853 display_configurator_->Init(shell_port_->CreateNativeDisplayDelegate(),
858 #if defined(USE_OZONE) 854 !gpu_support_->IsPanelFittingDisabled());
859 display_configurator_->Init(
860 ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate(),
861 !gpu_support_->IsPanelFittingDisabled());
862 #elif defined(USE_X11)
863 display_configurator_->Init(
864 base::MakeUnique<display::NativeDisplayDelegateX11>(),
865 !gpu_support_->IsPanelFittingDisabled());
866 #endif
867 } 855 }
868 856
869 // The DBusThreadManager must outlive this Shell. See the DCHECK in ~Shell. 857 // The DBusThreadManager must outlive this Shell. See the DCHECK in ~Shell.
870 chromeos::DBusThreadManager* dbus_thread_manager = 858 chromeos::DBusThreadManager* dbus_thread_manager =
871 chromeos::DBusThreadManager::Get(); 859 chromeos::DBusThreadManager::Get();
872 projecting_observer_.reset( 860 projecting_observer_.reset(
873 new ProjectingObserver(dbus_thread_manager->GetPowerManagerClient())); 861 new ProjectingObserver(dbus_thread_manager->GetPowerManagerClient()));
874 display_configurator_->AddObserver(projecting_observer_.get()); 862 display_configurator_->AddObserver(projecting_observer_.get());
875 AddShellObserver(projecting_observer_.get()); 863 AddShellObserver(projecting_observer_.get());
876 864
877 if (!display_initialized && chromeos::IsRunningAsSystemCompositor()) { 865 // TODO(sky): once simplified display management is enabled for mash
866 // config == Config::MUS should be config != Config::CLASSIC.
867 if (!display_initialized &&
868 (config == Config::MUS || chromeos::IsRunningAsSystemCompositor())) {
878 display_change_observer_ = base::MakeUnique<display::DisplayChangeObserver>( 869 display_change_observer_ = base::MakeUnique<display::DisplayChangeObserver>(
879 display_configurator_.get(), display_manager_.get()); 870 display_configurator_.get(), display_manager_.get());
880 871
881 shutdown_observer_ = 872 shutdown_observer_ =
882 base::MakeUnique<ShutdownObserver>(display_configurator_.get()); 873 base::MakeUnique<ShutdownObserver>(display_configurator_.get());
883 874
884 // Register |display_change_observer_| first so that the rest of 875 // Register |display_change_observer_| first so that the rest of
885 // observer gets invoked after the root windows are configured. 876 // observer gets invoked after the root windows are configured.
886 display_configurator_->AddObserver(display_change_observer_.get()); 877 display_configurator_->AddObserver(display_change_observer_.get());
887 display_error_observer_.reset(new DisplayErrorObserver()); 878 display_error_observer_.reset(new DisplayErrorObserver());
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 SetSystemTrayDelegate( 1041 SetSystemTrayDelegate(
1051 base::WrapUnique(shell_delegate_->CreateSystemTrayDelegate())); 1042 base::WrapUnique(shell_delegate_->CreateSystemTrayDelegate()));
1052 1043
1053 // May trigger initialization of the Bluetooth adapter. 1044 // May trigger initialization of the Bluetooth adapter.
1054 tray_bluetooth_helper_->Initialize(); 1045 tray_bluetooth_helper_->Initialize();
1055 1046
1056 // Create AshTouchTransformController before 1047 // Create AshTouchTransformController before
1057 // WindowTreeHostManager::InitDisplays() 1048 // WindowTreeHostManager::InitDisplays()
1058 // since AshTouchTransformController listens on 1049 // since AshTouchTransformController listens on
1059 // WindowTreeHostManager::Observer::OnDisplaysInitialized(). 1050 // WindowTreeHostManager::Observer::OnDisplaysInitialized().
1060 if (config != Config::MASH) { 1051 // TODO(sky): needs to to work for mus too.
1052 if (config == Config::CLASSIC) {
1061 touch_transformer_controller_.reset(new AshTouchTransformController( 1053 touch_transformer_controller_.reset(new AshTouchTransformController(
1062 display_configurator_.get(), display_manager_.get())); 1054 display_configurator_.get(), display_manager_.get()));
1063 } 1055 }
1064 1056
1065 keyboard_ui_ = shell_port_->CreateKeyboardUI(); 1057 keyboard_ui_ = shell_port_->CreateKeyboardUI();
1066 1058
1067 shell_port_->InitHosts(init_params); 1059 shell_port_->InitHosts(init_params);
1068 1060
1069 // Needs to be created after InitDisplays() since it may cause the virtual 1061 // Needs to be created after InitDisplays() since it may cause the virtual
1070 // keyboard to be deployed. 1062 // keyboard to be deployed.
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 void Shell::OnPrefServiceInitialized( 1242 void Shell::OnPrefServiceInitialized(
1251 std::unique_ptr<::PrefService> pref_service) { 1243 std::unique_ptr<::PrefService> pref_service) {
1252 if (!instance_) 1244 if (!instance_)
1253 return; 1245 return;
1254 // |pref_service_| is null if can't connect to Chrome (as happens when 1246 // |pref_service_| is null if can't connect to Chrome (as happens when
1255 // running mash outside of chrome --mash and chrome isn't built). 1247 // running mash outside of chrome --mash and chrome isn't built).
1256 pref_service_ = std::move(pref_service); 1248 pref_service_ = std::move(pref_service);
1257 } 1249 }
1258 1250
1259 } // namespace ash 1251 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/window_manager_application.cc ('k') | ash/shell_init_params.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698