| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ | 5 #ifndef UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ |
| 6 #define UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ | 6 #define UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> |
| 11 #include <queue> | 12 #include <queue> |
| 12 #include <string> | 13 #include <string> |
| 13 #include <vector> | 14 #include <vector> |
| 14 | 15 |
| 15 #include "base/event_types.h" | 16 #include "base/event_types.h" |
| 16 #include "base/macros.h" | 17 #include "base/macros.h" |
| 17 #include "base/memory/scoped_ptr.h" | |
| 18 #include "base/memory/scoped_vector.h" | 18 #include "base/memory/scoped_vector.h" |
| 19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 20 #include "base/observer_list.h" | 20 #include "base/observer_list.h" |
| 21 #include "base/timer/timer.h" | 21 #include "base/timer/timer.h" |
| 22 #include "third_party/cros_system_api/dbus/service_constants.h" | 22 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 23 #include "ui/display/chromeos/display_snapshot_virtual.h" | 23 #include "ui/display/chromeos/display_snapshot_virtual.h" |
| 24 #include "ui/display/chromeos/query_content_protection_task.h" | 24 #include "ui/display/chromeos/query_content_protection_task.h" |
| 25 #include "ui/display/display_export.h" | 25 #include "ui/display/display_export.h" |
| 26 #include "ui/display/types/display_constants.h" | 26 #include "ui/display/types/display_constants.h" |
| 27 #include "ui/display/types/native_display_observer.h" | 27 #include "ui/display/types/native_display_observer.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 void set_state_controller(StateController* controller) { | 187 void set_state_controller(StateController* controller) { |
| 188 state_controller_ = controller; | 188 state_controller_ = controller; |
| 189 } | 189 } |
| 190 void set_mirroring_controller(SoftwareMirroringController* controller) { | 190 void set_mirroring_controller(SoftwareMirroringController* controller) { |
| 191 mirroring_controller_ = controller; | 191 mirroring_controller_ = controller; |
| 192 } | 192 } |
| 193 | 193 |
| 194 // Replaces |native_display_delegate_| with the delegate passed in and sets | 194 // Replaces |native_display_delegate_| with the delegate passed in and sets |
| 195 // |configure_display_| to true. Should be called before Init(). | 195 // |configure_display_| to true. Should be called before Init(). |
| 196 void SetDelegateForTesting( | 196 void SetDelegateForTesting( |
| 197 scoped_ptr<NativeDisplayDelegate> display_delegate); | 197 std::unique_ptr<NativeDisplayDelegate> display_delegate); |
| 198 | 198 |
| 199 // Sets the initial value of |power_state_|. Must be called before Start(). | 199 // Sets the initial value of |power_state_|. Must be called before Start(). |
| 200 void SetInitialDisplayPower(chromeos::DisplayPowerState power_state); | 200 void SetInitialDisplayPower(chromeos::DisplayPowerState power_state); |
| 201 | 201 |
| 202 // Initialization, must be called right after constructor. | 202 // Initialization, must be called right after constructor. |
| 203 // |is_panel_fitting_enabled| indicates hardware panel fitting support. | 203 // |is_panel_fitting_enabled| indicates hardware panel fitting support. |
| 204 void Init(bool is_panel_fitting_enabled); | 204 void Init(bool is_panel_fitting_enabled); |
| 205 | 205 |
| 206 // Does initial configuration of displays during startup. | 206 // Does initial configuration of displays during startup. |
| 207 // If |background_color_argb| is non zero and there are multiple displays, | 207 // If |background_color_argb| is non zero and there are multiple displays, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 const std::vector<float>& correction_matrix); | 293 const std::vector<float>& correction_matrix); |
| 294 | 294 |
| 295 private: | 295 private: |
| 296 class DisplayLayoutManagerImpl; | 296 class DisplayLayoutManagerImpl; |
| 297 | 297 |
| 298 // Mapping a client to its protection request. | 298 // Mapping a client to its protection request. |
| 299 typedef std::map<ContentProtectionClientId, ContentProtections> | 299 typedef std::map<ContentProtectionClientId, ContentProtections> |
| 300 ProtectionRequests; | 300 ProtectionRequests; |
| 301 | 301 |
| 302 // Performs platform specific delegate initialization. | 302 // Performs platform specific delegate initialization. |
| 303 scoped_ptr<NativeDisplayDelegate> CreatePlatformNativeDisplayDelegate(); | 303 std::unique_ptr<NativeDisplayDelegate> CreatePlatformNativeDisplayDelegate(); |
| 304 | 304 |
| 305 // Configures displays. Invoked by |configure_timer_|. | 305 // Configures displays. Invoked by |configure_timer_|. |
| 306 void ConfigureDisplays(); | 306 void ConfigureDisplays(); |
| 307 | 307 |
| 308 // Restores |requested_power_state_| after the system has resumed, | 308 // Restores |requested_power_state_| after the system has resumed, |
| 309 // additionally forcing a probe. Invoked by |configure_timer_|. | 309 // additionally forcing a probe. Invoked by |configure_timer_|. |
| 310 void RestoreRequestedPowerStateAfterResume(); | 310 void RestoreRequestedPowerStateAfterResume(); |
| 311 | 311 |
| 312 // Notifies observers about an attempted state change. | 312 // Notifies observers about an attempted state change. |
| 313 void NotifyDisplayStateObservers(bool success, | 313 void NotifyDisplayStateObservers(bool success, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 | 363 |
| 364 // Callbacks used to signal when the native platform has released/taken | 364 // Callbacks used to signal when the native platform has released/taken |
| 365 // display control. | 365 // display control. |
| 366 void OnDisplayControlTaken(const DisplayControlCallback& callback, | 366 void OnDisplayControlTaken(const DisplayControlCallback& callback, |
| 367 bool success); | 367 bool success); |
| 368 void OnDisplayControlRelinquished(const DisplayControlCallback& callback, | 368 void OnDisplayControlRelinquished(const DisplayControlCallback& callback, |
| 369 bool success); | 369 bool success); |
| 370 | 370 |
| 371 StateController* state_controller_; | 371 StateController* state_controller_; |
| 372 SoftwareMirroringController* mirroring_controller_; | 372 SoftwareMirroringController* mirroring_controller_; |
| 373 scoped_ptr<NativeDisplayDelegate> native_display_delegate_; | 373 std::unique_ptr<NativeDisplayDelegate> native_display_delegate_; |
| 374 | 374 |
| 375 // Used to enable modes which rely on panel fitting. | 375 // Used to enable modes which rely on panel fitting. |
| 376 bool is_panel_fitting_enabled_; | 376 bool is_panel_fitting_enabled_; |
| 377 | 377 |
| 378 // This is detected by the constructor to determine whether or not we should | 378 // This is detected by the constructor to determine whether or not we should |
| 379 // be enabled. If we aren't running on Chrome OS, we can't assume that the | 379 // be enabled. If we aren't running on Chrome OS, we can't assume that the |
| 380 // Xrandr X11 extension or the Ozone underlying display hotplug system are | 380 // Xrandr X11 extension or the Ozone underlying display hotplug system are |
| 381 // supported. | 381 // supported. |
| 382 // If this flag is set to false, any attempts to change the display | 382 // If this flag is set to false, any attempts to change the display |
| 383 // configuration to immediately fail without changing the state. | 383 // configuration to immediately fail without changing the state. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 | 447 |
| 448 // Whether the displays are currently suspended. | 448 // Whether the displays are currently suspended. |
| 449 bool displays_suspended_; | 449 bool displays_suspended_; |
| 450 | 450 |
| 451 // Virtual display control. | 451 // Virtual display control. |
| 452 ScopedVector<DisplaySnapshot> virtual_display_snapshots_; | 452 ScopedVector<DisplaySnapshot> virtual_display_snapshots_; |
| 453 | 453 |
| 454 // Last used virtual display id. | 454 // Last used virtual display id. |
| 455 uint8_t last_virtual_display_id_ = 0; | 455 uint8_t last_virtual_display_id_ = 0; |
| 456 | 456 |
| 457 scoped_ptr<DisplayLayoutManager> layout_manager_; | 457 std::unique_ptr<DisplayLayoutManager> layout_manager_; |
| 458 | 458 |
| 459 scoped_ptr<UpdateDisplayConfigurationTask> configuration_task_; | 459 std::unique_ptr<UpdateDisplayConfigurationTask> configuration_task_; |
| 460 | 460 |
| 461 // This must be the last variable. | 461 // This must be the last variable. |
| 462 base::WeakPtrFactory<DisplayConfigurator> weak_ptr_factory_; | 462 base::WeakPtrFactory<DisplayConfigurator> weak_ptr_factory_; |
| 463 | 463 |
| 464 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurator); | 464 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurator); |
| 465 }; | 465 }; |
| 466 | 466 |
| 467 } // namespace ui | 467 } // namespace ui |
| 468 | 468 |
| 469 #endif // UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ | 469 #endif // UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ |
| OLD | NEW |