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 <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/event_types.h" | 14 #include "base/event_types.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
17 #include "base/timer/timer.h" | 17 #include "base/timer/timer.h" |
18 #include "third_party/cros_system_api/dbus/service_constants.h" | 18 #include "third_party/cros_system_api/dbus/service_constants.h" |
19 #include "ui/display/display_export.h" | 19 #include "ui/display/display_export.h" |
20 #include "ui/display/types/display_constants.h" | 20 #include "ui/display/types/display_constants.h" |
21 #include "ui/display/types/native_display_observer.h" | 21 #include "ui/display/types/native_display_observer.h" |
22 #include "ui/gfx/geometry/size.h" | 22 #include "ui/gfx/geometry/size.h" |
23 | 23 |
24 namespace gfx { | 24 namespace gfx { |
25 class Point; | 25 class Point; |
26 class Size; | 26 class Size; |
27 } | 27 } |
28 | 28 |
29 namespace ui { | 29 namespace ui { |
| 30 struct DisplayConfigureRequest; |
30 class DisplayMode; | 31 class DisplayMode; |
31 class DisplaySnapshot; | 32 class DisplaySnapshot; |
32 class NativeDisplayDelegate; | 33 class NativeDisplayDelegate; |
33 | 34 |
34 // This class interacts directly with the system display configurator. | 35 // This class interacts directly with the system display configurator. |
35 class DISPLAY_EXPORT DisplayConfigurator : public NativeDisplayObserver { | 36 class DISPLAY_EXPORT DisplayConfigurator : public NativeDisplayObserver { |
36 public: | 37 public: |
37 typedef uint64_t ContentProtectionClientId; | 38 typedef uint64_t ContentProtectionClientId; |
38 static const ContentProtectionClientId kInvalidClientId = 0; | 39 static const ContentProtectionClientId kInvalidClientId = 0; |
39 | 40 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // Interface for classes that implement software based mirroring. | 88 // Interface for classes that implement software based mirroring. |
88 class SoftwareMirroringController { | 89 class SoftwareMirroringController { |
89 public: | 90 public: |
90 virtual ~SoftwareMirroringController() {} | 91 virtual ~SoftwareMirroringController() {} |
91 | 92 |
92 // Called when the hardware mirroring failed. | 93 // Called when the hardware mirroring failed. |
93 virtual void SetSoftwareMirroring(bool enabled) = 0; | 94 virtual void SetSoftwareMirroring(bool enabled) = 0; |
94 virtual bool SoftwareMirroringEnabled() const = 0; | 95 virtual bool SoftwareMirroringEnabled() const = 0; |
95 }; | 96 }; |
96 | 97 |
| 98 class DisplayLayoutManager { |
| 99 public: |
| 100 virtual ~DisplayLayoutManager() {} |
| 101 |
| 102 virtual SoftwareMirroringController* GetSoftwareMirroringController() |
| 103 const = 0; |
| 104 |
| 105 virtual StateController* GetStateController() const = 0; |
| 106 |
| 107 // Returns the current display state. |
| 108 virtual MultipleDisplayState GetDisplayState() const = 0; |
| 109 |
| 110 // Returns the current power state. |
| 111 virtual chromeos::DisplayPowerState GetPowerState() const = 0; |
| 112 |
| 113 // Parses the |displays| into a list of DisplayStates. This effectively adds |
| 114 // |mirror_mode| and |selected_mode| to the returned results. |
| 115 // TODO(dnicoara): This operation doesn't depend on state and could be done |
| 116 // directly in |GetDisplayLayout()|. Though I need to make sure that there |
| 117 // are no uses for those fields outside DisplayConfigurator. |
| 118 virtual std::vector<DisplayState> ParseDisplays( |
| 119 const std::vector<DisplaySnapshot*>& displays) const = 0; |
| 120 |
| 121 // Based on the given |displays|, display state and power state, it will |
| 122 // create display configuration requests which will then be used to |
| 123 // configure the hardware. The requested configuration is stored in |
| 124 // |requests| and |framebuffer_size|. |
| 125 virtual bool GetDisplayLayout( |
| 126 const std::vector<DisplayState>& displays, |
| 127 MultipleDisplayState new_display_state, |
| 128 chromeos::DisplayPowerState new_power_state, |
| 129 std::vector<DisplayConfigureRequest>* requests, |
| 130 gfx::Size* framebuffer_size) const = 0; |
| 131 }; |
| 132 |
97 // Helper class used by tests. | 133 // Helper class used by tests. |
98 class TestApi { | 134 class TestApi { |
99 public: | 135 public: |
100 TestApi(DisplayConfigurator* configurator) : configurator_(configurator) {} | 136 TestApi(DisplayConfigurator* configurator) : configurator_(configurator) {} |
101 ~TestApi() {} | 137 ~TestApi() {} |
102 | 138 |
103 // If |configure_timer_| is started, stops the timer, runs | 139 // If |configure_timer_| is started, stops the timer, runs |
104 // ConfigureDisplays(), and returns true; returns false otherwise. | 140 // ConfigureDisplays(), and returns true; returns false otherwise. |
105 bool TriggerConfigureTimeout() WARN_UNUSED_RESULT; | 141 bool TriggerConfigureTimeout() WARN_UNUSED_RESULT; |
106 | 142 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 | 396 |
361 // Display controlled by an external entity. | 397 // Display controlled by an external entity. |
362 bool display_externally_controlled_; | 398 bool display_externally_controlled_; |
363 | 399 |
364 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurator); | 400 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurator); |
365 }; | 401 }; |
366 | 402 |
367 } // namespace ui | 403 } // namespace ui |
368 | 404 |
369 #endif // UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ | 405 #endif // UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ |
OLD | NEW |