Chromium Code Reviews| Index: ash/shell.cc |
| diff --git a/ash/shell.cc b/ash/shell.cc |
| index 72e09689ce4e44c613160fbd8239c3d666480583..066410929da7b2a841dcee7c5040563f87e21840 100644 |
| --- a/ash/shell.cc |
| +++ b/ash/shell.cc |
| @@ -328,7 +328,11 @@ void Shell::RegisterPrefs(PrefRegistrySimple* registry) { |
| // static |
| bool Shell::ShouldEnableSimplifiedDisplayManagement() { |
| - return GetAshConfig() != Config::MASH; |
| + return ShouldEnableSimplifiedDisplayManagement(GetAshConfig()); |
| +} |
| + |
| +bool Shell::ShouldEnableSimplifiedDisplayManagement(Config config) { |
| + return true; |
| } |
| views::NonClientFrameView* Shell::CreateDefaultNonClientFrameView( |
| @@ -372,6 +376,7 @@ void Shell::DeactivateKeyboard() { |
| } |
| bool Shell::ShouldSaveDisplaySettings() { |
| + // This function is only called from Chrome, hence the DCHECK for not-MASH. |
| DCHECK(GetAshConfig() != Config::MASH); |
| return !( |
| screen_orientation_controller_->ignore_display_configuration_updates() || |
| @@ -592,7 +597,7 @@ Shell::Shell(std::unique_ptr<ShellDelegate> shell_delegate, |
| gpu_support_.reset(shell_delegate_->CreateGPUSupport()); |
| // Don't use Shell::GetAshConfig() as |instance_| has not yet been set. |
| - if (shell_port_->GetAshConfig() != Config::MASH) { |
| + if (ShouldEnableSimplifiedDisplayManagement(shell_port_->GetAshConfig())) { |
| display_manager_.reset(ScreenAsh::CreateDisplayManager()); |
| window_tree_host_manager_.reset(new WindowTreeHostManager); |
| user_metrics_recorder_.reset(new UserMetricsRecorder); |
| @@ -635,7 +640,7 @@ Shell::~Shell() { |
| RemovePreTargetHandler(event_transformation_handler_.get()); |
| RemovePreTargetHandler(toplevel_window_event_handler_.get()); |
| RemovePostTargetHandler(toplevel_window_event_handler_.get()); |
| - if (config != Config::MASH) { |
| + if (ShouldEnableSimplifiedDisplayManagement()) { |
| RemovePreTargetHandler(system_gesture_filter_.get()); |
| RemovePreTargetHandler(mouse_cursor_filter_.get()); |
| } |
| @@ -855,16 +860,15 @@ void Shell::Init(const ShellInitParams& init_params) { |
| } |
| shell_delegate_->PreInit(); |
| - // TODO(sky): remove MASH from here. |
| - bool display_initialized = |
| - (config == Config::MASH || display_manager_->InitFromCommandLine()); |
| - if (config == Config::MUS && !display_initialized) { |
| + bool display_initialized = (!ShouldEnableSimplifiedDisplayManagement() || |
| + display_manager_->InitFromCommandLine()); |
| + if (!display_initialized && config != Config::CLASSIC && |
| + ShouldEnableSimplifiedDisplayManagement()) { |
| // Run display configuration off device in mus mode. |
| display_manager_->set_configure_displays(true); |
| display_configurator_->set_configure_display(true); |
| } |
| - if (config != Config::MASH) { |
| - // TODO(sky): should work in mash too. |
| + if (ShouldEnableSimplifiedDisplayManagement()) { |
| display_configuration_controller_.reset(new DisplayConfigurationController( |
| display_manager_.get(), window_tree_host_manager_.get())); |
| display_configurator_->Init(shell_port_->CreateNativeDisplayDelegate(), |
| @@ -879,10 +883,9 @@ void Shell::Init(const ShellInitParams& init_params) { |
| display_configurator_->AddObserver(projecting_observer_.get()); |
| AddShellObserver(projecting_observer_.get()); |
| - // TODO(sky): once simplified display management is enabled for mash |
| - // config == Config::MUS should be config != Config::CLASSIC. |
| - if (!display_initialized && |
| - (config == Config::MUS || chromeos::IsRunningAsSystemCompositor())) { |
| + if (!display_initialized && ((config != Config::CLASSIC && |
| + ShouldEnableSimplifiedDisplayManagement()) || |
| + chromeos::IsRunningAsSystemCompositor())) { |
| display_change_observer_ = base::MakeUnique<display::DisplayChangeObserver>( |
| display_configurator_.get(), display_manager_.get()); |
| @@ -909,9 +912,11 @@ void Shell::Init(const ShellInitParams& init_params) { |
| if (!display_initialized) |
| display_manager_->InitDefaultDisplay(); |
| - if (config == Config::CLASSIC) { |
| + // TODO(sky): move this to chrome for mash. |
| + if (ShouldEnableSimplifiedDisplayManagement()) |
| display_manager_->RefreshFontParams(); |
| + if (config == Config::CLASSIC) { |
| aura::Env::GetInstance()->set_context_factory(init_params.context_factory); |
| aura::Env::GetInstance()->set_context_factory_private( |
| init_params.context_factory_private); |
| @@ -939,7 +944,7 @@ void Shell::Init(const ShellInitParams& init_params) { |
| shell_port_->CreatePrimaryHost(); |
| root_window_for_new_windows_ = GetPrimaryRootWindow(); |
| - if (config != Config::MASH) { |
| + if (ShouldEnableSimplifiedDisplayManagement()) { |
| resolution_notification_controller_.reset( |
|
msw
2017/05/26 16:38:50
optional nit: base::MakeUnique here and below
sky
2017/06/05 22:37:40
I'm holding off on this.
|
| new ResolutionNotificationController); |
| } |
| @@ -1012,7 +1017,7 @@ void Shell::Init(const ShellInitParams& init_params) { |
| screenshot_controller_.reset(new ScreenshotController()); |
| // TODO: evaluate if MouseCursorEventFilter needs to work for mash. |
| // http://crbug.com/706474. |
| - if (config != Config::MASH) { |
| + if (ShouldEnableSimplifiedDisplayManagement()) { |
| mouse_cursor_filter_.reset(new MouseCursorEventFilter()); |
| PrependPreTargetHandler(mouse_cursor_filter_.get()); |
| } |
| @@ -1095,7 +1100,7 @@ void Shell::Init(const ShellInitParams& init_params) { |
| video_activity_notifier_.reset( |
| new VideoActivityNotifier(video_detector_.get())); |
| bluetooth_notification_controller_.reset(new BluetoothNotificationController); |
| - if (config != Config::MASH) { |
| + if (ShouldEnableSimplifiedDisplayManagement()) { |
| screen_orientation_controller_.reset(new ScreenOrientationController()); |
| screen_layout_observer_.reset(new ScreenLayoutObserver()); |
| } |
| @@ -1104,7 +1109,7 @@ void Shell::Init(const ShellInitParams& init_params) { |
| // The compositor thread and main message loop have to be running in |
| // order to create mirror window. Run it after the main message loop |
| // is started. |
| - if (config != Config::MASH) |
| + if (ShouldEnableSimplifiedDisplayManagement()) |
| display_manager_->CreateMirrorWindowAsyncIfAny(); |
| for (auto& observer : shell_observers_) |