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 if (touch_transform_controller_) | |
msw
2017/01/10 19:43:27
optional nit: check is not necessary
kylechar
2017/01/10 22:12:18
Done.
| |
68 touch_transform_controller_.reset(); | |
69 | |
66 if (display_manager_) | 70 if (display_manager_) |
67 display_manager_->RemoveObserver(this); | 71 display_manager_->RemoveObserver(this); |
68 | 72 |
69 if (display_change_observer_) { | 73 if (display_change_observer_) { |
70 display_configurator_.RemoveObserver(display_change_observer_.get()); | 74 display_configurator_.RemoveObserver(display_change_observer_.get()); |
71 display_change_observer_.reset(); | 75 display_change_observer_.reset(); |
72 } | 76 } |
73 | 77 |
74 if (display_manager_) | 78 if (display_manager_) |
75 display_manager_.reset(); | 79 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 | 177 // We want display configuration to happen even off device to keep the control |
174 // flow similar. | 178 // flow similar. |
175 display_configurator_.set_configure_display(true); | 179 display_configurator_.set_configure_display(true); |
176 display_configurator_.AddObserver(display_change_observer_.get()); | 180 display_configurator_.AddObserver(display_change_observer_.get()); |
177 display_configurator_.set_state_controller(display_change_observer_.get()); | 181 display_configurator_.set_state_controller(display_change_observer_.get()); |
178 display_configurator_.set_mirroring_controller(display_manager_.get()); | 182 display_configurator_.set_mirroring_controller(display_manager_.get()); |
179 | 183 |
180 // Perform initial configuration. | 184 // Perform initial configuration. |
181 display_configurator_.Init(std::move(native_display_delegate_), false); | 185 display_configurator_.Init(std::move(native_display_delegate_), false); |
182 display_configurator_.ForceInitialConfigure(kChromeOsBootColor); | 186 display_configurator_.ForceInitialConfigure(kChromeOsBootColor); |
187 | |
188 touch_transform_controller_ = base::MakeUnique<TouchTransformController>( | |
msw
2017/01/10 19:43:27
I don't get results for TouchTransformController i
kylechar
2017/01/10 22:12:18
The current class is ash::TouchTransformerControll
msw
2017/01/10 22:36:57
Acknowledged; thanks for pointing out the change d
| |
189 &display_configurator_, display_manager_.get()); | |
183 } | 190 } |
184 | 191 |
185 void ScreenManagerOzone::RequestCloseDisplay(int64_t display_id) { | 192 void ScreenManagerOzone::RequestCloseDisplay(int64_t display_id) { |
186 if (!fake_display_controller_) | 193 if (!fake_display_controller_) |
187 return; | 194 return; |
188 | 195 |
189 // Tell the NDD to remove the display. ScreenManager will get an update | 196 // 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. | 197 // that the display configuration has changed and the display will be gone. |
191 fake_display_controller_->RemoveDisplay(display_id); | 198 fake_display_controller_->RemoveDisplay(display_id); |
192 } | 199 } |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
349 display_manager_->GetPrimaryDisplayCandidate(); | 356 display_manager_->GetPrimaryDisplayCandidate(); |
350 if (primary_display.is_valid()) { | 357 if (primary_display.is_valid()) { |
351 primary_display_id_ = primary_display.id(); | 358 primary_display_id_ = primary_display.id(); |
352 DVLOG(1) << "Set primary display to " << primary_display_id_; | 359 DVLOG(1) << "Set primary display to " << primary_display_id_; |
353 screen_->display_list().UpdateDisplay(primary_display, | 360 screen_->display_list().UpdateDisplay(primary_display, |
354 DisplayList::Type::PRIMARY); | 361 DisplayList::Type::PRIMARY); |
355 delegate_->OnPrimaryDisplayChanged(primary_display_id_); | 362 delegate_->OnPrimaryDisplayChanged(primary_display_id_); |
356 } | 363 } |
357 } | 364 } |
358 | 365 |
366 if (touch_transform_controller_) | |
msw
2017/01/10 19:43:27
q: does this ever happen before init or after rese
kylechar
2017/01/10 22:12:18
It shouldn't, only if someone changed the order in
| |
367 touch_transform_controller_->UpdateTouchTransforms(); | |
368 | |
359 DVLOG(1) << "PostDisplayConfigurationChange"; | 369 DVLOG(1) << "PostDisplayConfigurationChange"; |
360 } | 370 } |
361 | 371 |
362 DisplayConfigurator* ScreenManagerOzone::display_configurator() { | 372 DisplayConfigurator* ScreenManagerOzone::display_configurator() { |
363 return &display_configurator_; | 373 return &display_configurator_; |
364 } | 374 } |
365 | 375 |
366 void ScreenManagerOzone::Create( | 376 void ScreenManagerOzone::Create( |
367 const service_manager::Identity& remote_identity, | 377 const service_manager::Identity& remote_identity, |
368 mojom::DisplayControllerRequest request) { | 378 mojom::DisplayControllerRequest request) { |
369 controller_bindings_.AddBinding(this, std::move(request)); | 379 controller_bindings_.AddBinding(this, std::move(request)); |
370 } | 380 } |
371 | 381 |
372 void ScreenManagerOzone::Create( | 382 void ScreenManagerOzone::Create( |
373 const service_manager::Identity& remote_identity, | 383 const service_manager::Identity& remote_identity, |
374 mojom::TestDisplayControllerRequest request) { | 384 mojom::TestDisplayControllerRequest request) { |
375 test_bindings_.AddBinding(this, std::move(request)); | 385 test_bindings_.AddBinding(this, std::move(request)); |
376 } | 386 } |
377 | 387 |
378 } // namespace display | 388 } // namespace display |
OLD | NEW |