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 <queue> | 11 #include <queue> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/event_types.h" | 15 #include "base/event_types.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/memory/scoped_vector.h" |
17 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
18 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
19 #include "base/timer/timer.h" | 20 #include "base/timer/timer.h" |
20 #include "third_party/cros_system_api/dbus/service_constants.h" | 21 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 22 #include "ui/display/chromeos/display_snapshot_virtual.h" |
21 #include "ui/display/chromeos/query_content_protection_task.h" | 23 #include "ui/display/chromeos/query_content_protection_task.h" |
22 #include "ui/display/display_export.h" | 24 #include "ui/display/display_export.h" |
23 #include "ui/display/types/display_constants.h" | 25 #include "ui/display/types/display_constants.h" |
24 #include "ui/display/types/native_display_observer.h" | 26 #include "ui/display/types/native_display_observer.h" |
25 #include "ui/gfx/geometry/size.h" | 27 #include "ui/gfx/geometry/size.h" |
26 | 28 |
27 namespace gfx { | 29 namespace gfx { |
28 class Point; | 30 class Point; |
29 class Size; | 31 class Size; |
30 } | 32 } |
31 | 33 |
32 namespace ui { | 34 namespace ui { |
33 struct DisplayConfigureRequest; | 35 struct DisplayConfigureRequest; |
34 struct GammaRampRGBEntry; | 36 struct GammaRampRGBEntry; |
35 class DisplayLayoutManager; | 37 class DisplayLayoutManager; |
36 class DisplayMode; | 38 class DisplayMode; |
37 class DisplaySnapshot; | 39 class DisplaySnapshot; |
38 class NativeDisplayDelegate; | 40 class NativeDisplayDelegate; |
39 class UpdateDisplayConfigurationTask; | 41 class UpdateDisplayConfigurationTask; |
40 | 42 |
| 43 namespace test { |
| 44 class DisplayConfiguratorTest; |
| 45 } // namespace test |
| 46 |
41 // This class interacts directly with the system display configurator. | 47 // This class interacts directly with the system display configurator. |
42 class DISPLAY_EXPORT DisplayConfigurator : public NativeDisplayObserver { | 48 class DISPLAY_EXPORT DisplayConfigurator : public NativeDisplayObserver { |
43 public: | 49 public: |
44 typedef uint64_t ContentProtectionClientId; | 50 typedef uint64_t ContentProtectionClientId; |
45 static const ContentProtectionClientId kInvalidClientId = 0; | 51 static const ContentProtectionClientId kInvalidClientId = 0; |
46 | 52 |
47 typedef base::Callback<void(bool /* success */)> ConfigurationCallback; | 53 typedef base::Callback<void(bool /* success */)> ConfigurationCallback; |
48 | 54 |
49 typedef base::Callback<void(bool /* success */)> EnableProtectionCallback; | 55 typedef base::Callback<void(bool /* success */)> EnableProtectionCallback; |
50 | 56 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 int64_t display_id); | 268 int64_t display_id); |
263 | 269 |
264 // Updates the color calibration to |new_profile|. | 270 // Updates the color calibration to |new_profile|. |
265 bool SetColorCalibrationProfile(int64_t display_id, | 271 bool SetColorCalibrationProfile(int64_t display_id, |
266 ui::ColorCalibrationProfile new_profile); | 272 ui::ColorCalibrationProfile new_profile); |
267 | 273 |
268 // Sets the gamma ramp for |display_id| to the values in |lut|. | 274 // Sets the gamma ramp for |display_id| to the values in |lut|. |
269 bool SetGammaRamp(int64_t display_id, | 275 bool SetGammaRamp(int64_t display_id, |
270 const std::vector<GammaRampRGBEntry>& lut); | 276 const std::vector<GammaRampRGBEntry>& lut); |
271 | 277 |
| 278 // Enables/disables virtual display. |
| 279 int64_t AddVirtualDisplay(gfx::Size display_size); |
| 280 bool RemoveVirtualDisplay(int64_t display_id); |
| 281 |
272 private: | 282 private: |
| 283 friend class ui::test::DisplayConfiguratorTest; |
273 class DisplayLayoutManagerImpl; | 284 class DisplayLayoutManagerImpl; |
274 | 285 |
275 // Mapping a client to its protection request. | 286 // Mapping a client to its protection request. |
276 typedef std::map<ContentProtectionClientId, ContentProtections> | 287 typedef std::map<ContentProtectionClientId, ContentProtections> |
277 ProtectionRequests; | 288 ProtectionRequests; |
278 | 289 |
279 // Performs platform specific delegate initialization. | 290 // Performs platform specific delegate initialization. |
280 scoped_ptr<NativeDisplayDelegate> CreatePlatformNativeDisplayDelegate(); | 291 scoped_ptr<NativeDisplayDelegate> CreatePlatformNativeDisplayDelegate(); |
281 | 292 |
282 // Configures displays. Invoked by |configure_timer_|. | 293 // Configures displays. Invoked by |configure_timer_|. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 // Display controlled by an external entity. | 425 // Display controlled by an external entity. |
415 bool display_externally_controlled_; | 426 bool display_externally_controlled_; |
416 | 427 |
417 // True if a TakeControl or RelinquishControl has been called but the response | 428 // True if a TakeControl or RelinquishControl has been called but the response |
418 // hasn't arrived yet. | 429 // hasn't arrived yet. |
419 bool display_control_changing_; | 430 bool display_control_changing_; |
420 | 431 |
421 // Whether the displays are currently suspended. | 432 // Whether the displays are currently suspended. |
422 bool displays_suspended_; | 433 bool displays_suspended_; |
423 | 434 |
| 435 // Virtual display control. |
| 436 ScopedVector<DisplaySnapshot> virtual_display_snapshots_; |
| 437 |
| 438 // Last used virtual display id. |
| 439 int64_t last_virtual_display_id_ = 0; |
| 440 |
424 scoped_ptr<DisplayLayoutManager> layout_manager_; | 441 scoped_ptr<DisplayLayoutManager> layout_manager_; |
425 | 442 |
426 scoped_ptr<UpdateDisplayConfigurationTask> configuration_task_; | 443 scoped_ptr<UpdateDisplayConfigurationTask> configuration_task_; |
427 | 444 |
428 // This must be the last variable. | 445 // This must be the last variable. |
429 base::WeakPtrFactory<DisplayConfigurator> weak_ptr_factory_; | 446 base::WeakPtrFactory<DisplayConfigurator> weak_ptr_factory_; |
430 | 447 |
431 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurator); | 448 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurator); |
432 }; | 449 }; |
433 | 450 |
434 } // namespace ui | 451 } // namespace ui |
435 | 452 |
436 #endif // UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ | 453 #endif // UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ |
OLD | NEW |