| 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" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
| 13 #include "chromeos/system/devicemode.h" | 13 #include "chromeos/system/devicemode.h" |
| 14 #include "services/service_manager/public/cpp/interface_registry.h" | 14 #include "services/service_manager/public/cpp/interface_registry.h" |
| 15 #include "third_party/skia/include/core/SkColor.h" | 15 #include "third_party/skia/include/core/SkColor.h" |
| 16 #include "ui/display/manager/chromeos/display_change_observer.h" | 16 #include "ui/display/manager/chromeos/display_change_observer.h" |
| 17 #include "ui/display/manager/chromeos/touch_transform_controller.h" |
| 17 #include "ui/display/manager/display_layout_store.h" | 18 #include "ui/display/manager/display_layout_store.h" |
| 18 #include "ui/display/manager/display_manager_utilities.h" | 19 #include "ui/display/manager/display_manager_utilities.h" |
| 19 #include "ui/display/screen.h" | 20 #include "ui/display/screen.h" |
| 20 #include "ui/display/screen_base.h" | 21 #include "ui/display/screen_base.h" |
| 21 #include "ui/display/types/display_snapshot.h" | 22 #include "ui/display/types/display_snapshot.h" |
| 22 #include "ui/display/types/fake_display_controller.h" | 23 #include "ui/display/types/fake_display_controller.h" |
| 23 #include "ui/display/types/native_display_delegate.h" | 24 #include "ui/display/types/native_display_delegate.h" |
| 24 #include "ui/gfx/geometry/rect.h" | 25 #include "ui/gfx/geometry/rect.h" |
| 25 #include "ui/ozone/public/ozone_platform.h" | 26 #include "ui/ozone/public/ozone_platform.h" |
| 26 | 27 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 56 std::unique_ptr<ScreenManager> ScreenManager::Create() { | 57 std::unique_ptr<ScreenManager> ScreenManager::Create() { |
| 57 return base::MakeUnique<ScreenManagerOzone>(); | 58 return base::MakeUnique<ScreenManagerOzone>(); |
| 58 } | 59 } |
| 59 | 60 |
| 60 ScreenManagerOzone::ScreenManagerOzone() {} | 61 ScreenManagerOzone::ScreenManagerOzone() {} |
| 61 | 62 |
| 62 ScreenManagerOzone::~ScreenManagerOzone() { | 63 ScreenManagerOzone::~ScreenManagerOzone() { |
| 63 // We are shutting down and don't want to make anymore display changes. | 64 // We are shutting down and don't want to make anymore display changes. |
| 64 fake_display_controller_ = nullptr; | 65 fake_display_controller_ = nullptr; |
| 65 | 66 |
| 67 touch_transform_controller_.reset(); |
| 68 |
| 66 if (display_manager_) | 69 if (display_manager_) |
| 67 display_manager_->RemoveObserver(this); | 70 display_manager_->RemoveObserver(this); |
| 68 | 71 |
| 69 if (display_change_observer_) { | 72 if (display_change_observer_) { |
| 70 display_configurator_.RemoveObserver(display_change_observer_.get()); | 73 display_configurator_.RemoveObserver(display_change_observer_.get()); |
| 71 display_change_observer_.reset(); | 74 display_change_observer_.reset(); |
| 72 } | 75 } |
| 73 | 76 |
| 74 if (display_manager_) | 77 if (display_manager_) |
| 75 display_manager_.reset(); | 78 display_manager_.reset(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 // We want display configuration to happen even off device to keep the control | 176 // We want display configuration to happen even off device to keep the control |
| 174 // flow similar. | 177 // flow similar. |
| 175 display_configurator_.set_configure_display(true); | 178 display_configurator_.set_configure_display(true); |
| 176 display_configurator_.AddObserver(display_change_observer_.get()); | 179 display_configurator_.AddObserver(display_change_observer_.get()); |
| 177 display_configurator_.set_state_controller(display_change_observer_.get()); | 180 display_configurator_.set_state_controller(display_change_observer_.get()); |
| 178 display_configurator_.set_mirroring_controller(display_manager_.get()); | 181 display_configurator_.set_mirroring_controller(display_manager_.get()); |
| 179 | 182 |
| 180 // Perform initial configuration. | 183 // Perform initial configuration. |
| 181 display_configurator_.Init(std::move(native_display_delegate_), false); | 184 display_configurator_.Init(std::move(native_display_delegate_), false); |
| 182 display_configurator_.ForceInitialConfigure(kChromeOsBootColor); | 185 display_configurator_.ForceInitialConfigure(kChromeOsBootColor); |
| 186 |
| 187 touch_transform_controller_ = base::MakeUnique<TouchTransformController>( |
| 188 &display_configurator_, display_manager_.get()); |
| 183 } | 189 } |
| 184 | 190 |
| 185 void ScreenManagerOzone::RequestCloseDisplay(int64_t display_id) { | 191 void ScreenManagerOzone::RequestCloseDisplay(int64_t display_id) { |
| 186 if (!fake_display_controller_) | 192 if (!fake_display_controller_) |
| 187 return; | 193 return; |
| 188 | 194 |
| 189 // Tell the NDD to remove the display. ScreenManager will get an update | 195 // Tell the NDD to remove the display. ScreenManager will get an update |
| 190 // that the display configuration has changed and the display will be gone. | 196 // that the display configuration has changed and the display will be gone. |
| 191 fake_display_controller_->RemoveDisplay(display_id); | 197 fake_display_controller_->RemoveDisplay(display_id); |
| 192 } | 198 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 display_manager_->GetPrimaryDisplayCandidate(); | 355 display_manager_->GetPrimaryDisplayCandidate(); |
| 350 if (primary_display.is_valid()) { | 356 if (primary_display.is_valid()) { |
| 351 primary_display_id_ = primary_display.id(); | 357 primary_display_id_ = primary_display.id(); |
| 352 DVLOG(1) << "Set primary display to " << primary_display_id_; | 358 DVLOG(1) << "Set primary display to " << primary_display_id_; |
| 353 screen_->display_list().UpdateDisplay(primary_display, | 359 screen_->display_list().UpdateDisplay(primary_display, |
| 354 DisplayList::Type::PRIMARY); | 360 DisplayList::Type::PRIMARY); |
| 355 delegate_->OnPrimaryDisplayChanged(primary_display_id_); | 361 delegate_->OnPrimaryDisplayChanged(primary_display_id_); |
| 356 } | 362 } |
| 357 } | 363 } |
| 358 | 364 |
| 365 touch_transform_controller_->UpdateTouchTransforms(); |
| 366 |
| 359 DVLOG(1) << "PostDisplayConfigurationChange"; | 367 DVLOG(1) << "PostDisplayConfigurationChange"; |
| 360 } | 368 } |
| 361 | 369 |
| 362 DisplayConfigurator* ScreenManagerOzone::display_configurator() { | 370 DisplayConfigurator* ScreenManagerOzone::display_configurator() { |
| 363 return &display_configurator_; | 371 return &display_configurator_; |
| 364 } | 372 } |
| 365 | 373 |
| 366 void ScreenManagerOzone::Create( | 374 void ScreenManagerOzone::Create( |
| 367 const service_manager::Identity& remote_identity, | 375 const service_manager::Identity& remote_identity, |
| 368 mojom::DisplayControllerRequest request) { | 376 mojom::DisplayControllerRequest request) { |
| 369 controller_bindings_.AddBinding(this, std::move(request)); | 377 controller_bindings_.AddBinding(this, std::move(request)); |
| 370 } | 378 } |
| 371 | 379 |
| 372 void ScreenManagerOzone::Create( | 380 void ScreenManagerOzone::Create( |
| 373 const service_manager::Identity& remote_identity, | 381 const service_manager::Identity& remote_identity, |
| 374 mojom::TestDisplayControllerRequest request) { | 382 mojom::TestDisplayControllerRequest request) { |
| 375 test_bindings_.AddBinding(this, std::move(request)); | 383 test_bindings_.AddBinding(this, std::move(request)); |
| 376 } | 384 } |
| 377 | 385 |
| 378 } // namespace display | 386 } // namespace display |
| OLD | NEW |