| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/ui/display/screen_manager_ozone.h" | 5 #include "services/ui/display/screen_manager_ozone.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 << " to " << primary_display_id_; | 131 << " to " << primary_display_id_; |
| 132 delegate_->OnPrimaryDisplayChanged(primary_display_id_); | 132 delegate_->OnPrimaryDisplayChanged(primary_display_id_); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void ScreenManagerOzone::AddInterfaces( | 135 void ScreenManagerOzone::AddInterfaces( |
| 136 service_manager::InterfaceRegistry* registry) { | 136 service_manager::InterfaceRegistry* registry) { |
| 137 registry->AddInterface<mojom::DisplayController>(this); | 137 registry->AddInterface<mojom::DisplayController>(this); |
| 138 registry->AddInterface<mojom::TestDisplayController>(this); | 138 registry->AddInterface<mojom::TestDisplayController>(this); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void ScreenManagerOzone::Init(ScreenManagerDelegate* delegate) { | 141 void ScreenManagerOzone::Init(ScreenManagerDelegate* delegate, |
| 142 WindowMode window_mode) { |
| 142 DCHECK(delegate); | 143 DCHECK(delegate); |
| 143 delegate_ = delegate; | 144 delegate_ = delegate; |
| 144 | 145 |
| 145 // Tests may inject a NativeDisplayDelegate, otherwise get it from | 146 // Tests may inject a NativeDisplayDelegate, otherwise get it from |
| 146 // OzonePlatform. | 147 // OzonePlatform. |
| 147 if (!native_display_delegate_) { | 148 if (!native_display_delegate_) { |
| 148 native_display_delegate_ = | 149 native_display_delegate_ = |
| 149 ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate(); | 150 ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate(); |
| 150 } | 151 } |
| 151 | 152 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 166 display_manager_ = base::MakeUnique<DisplayManager>(std::move(screen)); | 167 display_manager_ = base::MakeUnique<DisplayManager>(std::move(screen)); |
| 167 display_manager_->set_configure_displays(true); | 168 display_manager_->set_configure_displays(true); |
| 168 display_manager_->AddObserver(this); | 169 display_manager_->AddObserver(this); |
| 169 display_manager_->set_delegate(this); | 170 display_manager_->set_delegate(this); |
| 170 | 171 |
| 171 // DisplayChangeObserver observes DisplayConfigurator and sends updates to | 172 // DisplayChangeObserver observes DisplayConfigurator and sends updates to |
| 172 // DisplayManager. | 173 // DisplayManager. |
| 173 display_change_observer_ = base::MakeUnique<DisplayChangeObserver>( | 174 display_change_observer_ = base::MakeUnique<DisplayChangeObserver>( |
| 174 &display_configurator_, display_manager_.get()); | 175 &display_configurator_, display_manager_.get()); |
| 175 | 176 |
| 176 // We want display configuration to happen even off device to keep the control | 177 if (window_mode == WINDOW_MODE_INTERNAL) { |
| 177 // flow similar. | 178 // We want display configuration to happen even off device to keep the |
| 178 display_configurator_.set_configure_display(true); | 179 // control flow similar. |
| 179 display_configurator_.AddObserver(display_change_observer_.get()); | 180 display_configurator_.set_configure_display(true); |
| 180 display_configurator_.set_state_controller(display_change_observer_.get()); | 181 display_configurator_.AddObserver(display_change_observer_.get()); |
| 181 display_configurator_.set_mirroring_controller(display_manager_.get()); | 182 display_configurator_.set_state_controller(display_change_observer_.get()); |
| 183 display_configurator_.set_mirroring_controller(display_manager_.get()); |
| 184 } |
| 182 | 185 |
| 183 // Perform initial configuration. | 186 // Perform initial configuration. |
| 184 display_configurator_.Init(std::move(native_display_delegate_), false); | 187 display_configurator_.Init(std::move(native_display_delegate_), false); |
| 185 display_configurator_.ForceInitialConfigure(kChromeOsBootColor); | 188 display_configurator_.ForceInitialConfigure(kChromeOsBootColor); |
| 186 | 189 |
| 187 touch_transform_controller_ = base::MakeUnique<TouchTransformController>( | 190 touch_transform_controller_ = base::MakeUnique<TouchTransformController>( |
| 188 &display_configurator_, display_manager_.get()); | 191 &display_configurator_, display_manager_.get()); |
| 189 } | 192 } |
| 190 | 193 |
| 191 void ScreenManagerOzone::RequestCloseDisplay(int64_t display_id) { | 194 void ScreenManagerOzone::RequestCloseDisplay(int64_t display_id) { |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 controller_bindings_.AddBinding(this, std::move(request)); | 380 controller_bindings_.AddBinding(this, std::move(request)); |
| 378 } | 381 } |
| 379 | 382 |
| 380 void ScreenManagerOzone::Create( | 383 void ScreenManagerOzone::Create( |
| 381 const service_manager::Identity& remote_identity, | 384 const service_manager::Identity& remote_identity, |
| 382 mojom::TestDisplayControllerRequest request) { | 385 mojom::TestDisplayControllerRequest request) { |
| 383 test_bindings_.AddBinding(this, std::move(request)); | 386 test_bindings_.AddBinding(this, std::move(request)); |
| 384 } | 387 } |
| 385 | 388 |
| 386 } // namespace display | 389 } // namespace display |
| OLD | NEW |