| 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> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 class DISPLAY_EXPORT DisplayConfigurator : public NativeDisplayObserver { | 35 class DISPLAY_EXPORT DisplayConfigurator : public NativeDisplayObserver { |
| 36 public: | 36 public: |
| 37 typedef uint64_t ContentProtectionClientId; | 37 typedef uint64_t ContentProtectionClientId; |
| 38 static const ContentProtectionClientId kInvalidClientId = 0; | 38 static const ContentProtectionClientId kInvalidClientId = 0; |
| 39 | 39 |
| 40 struct DisplayState { | 40 struct DisplayState { |
| 41 DisplayState(); | 41 DisplayState(); |
| 42 | 42 |
| 43 DisplaySnapshot* display; // Not owned. | 43 DisplaySnapshot* display; // Not owned. |
| 44 | 44 |
| 45 // XInput device ID or 0 if this display isn't a touchscreen. | |
| 46 int touch_device_id; | |
| 47 | |
| 48 // User-selected mode for the display. | 45 // User-selected mode for the display. |
| 49 const DisplayMode* selected_mode; | 46 const DisplayMode* selected_mode; |
| 50 | 47 |
| 51 // Mode used when displaying the same desktop on multiple displays. | 48 // Mode used when displaying the same desktop on multiple displays. |
| 52 const DisplayMode* mirror_mode; | 49 const DisplayMode* mirror_mode; |
| 53 }; | 50 }; |
| 54 | 51 |
| 55 typedef std::vector<DisplayState> DisplayStateList; | 52 typedef std::vector<DisplayState> DisplayStateList; |
| 56 | 53 |
| 57 class Observer { | 54 class Observer { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // Interface for classes that implement software based mirroring. | 87 // Interface for classes that implement software based mirroring. |
| 91 class SoftwareMirroringController { | 88 class SoftwareMirroringController { |
| 92 public: | 89 public: |
| 93 virtual ~SoftwareMirroringController() {} | 90 virtual ~SoftwareMirroringController() {} |
| 94 | 91 |
| 95 // Called when the hardware mirroring failed. | 92 // Called when the hardware mirroring failed. |
| 96 virtual void SetSoftwareMirroring(bool enabled) = 0; | 93 virtual void SetSoftwareMirroring(bool enabled) = 0; |
| 97 virtual bool SoftwareMirroringEnabled() const = 0; | 94 virtual bool SoftwareMirroringEnabled() const = 0; |
| 98 }; | 95 }; |
| 99 | 96 |
| 100 class TouchscreenDelegate { | |
| 101 public: | |
| 102 virtual ~TouchscreenDelegate() {} | |
| 103 | |
| 104 // Searches for touchscreens among input devices, | |
| 105 // and tries to match them up to screens in |displays|. | |
| 106 // |displays| is an array of detected screens. | |
| 107 // If a touchscreen with same resolution as a display's native mode | |
| 108 // is detected, its id will be stored in this display. | |
| 109 virtual void AssociateTouchscreens(std::vector<DisplayState>* displays) = 0; | |
| 110 }; | |
| 111 | |
| 112 // Helper class used by tests. | 97 // Helper class used by tests. |
| 113 class TestApi { | 98 class TestApi { |
| 114 public: | 99 public: |
| 115 TestApi(DisplayConfigurator* configurator) : configurator_(configurator) {} | 100 TestApi(DisplayConfigurator* configurator) : configurator_(configurator) {} |
| 116 ~TestApi() {} | 101 ~TestApi() {} |
| 117 | 102 |
| 118 // If |configure_timer_| is started, stops the timer, runs | 103 // If |configure_timer_| is started, stops the timer, runs |
| 119 // ConfigureDisplays(), and returns true; returns false otherwise. | 104 // ConfigureDisplays(), and returns true; returns false otherwise. |
| 120 bool TriggerConfigureTimeout() WARN_UNUSED_RESULT; | 105 bool TriggerConfigureTimeout() WARN_UNUSED_RESULT; |
| 121 | 106 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 return cached_displays_; | 143 return cached_displays_; |
| 159 } | 144 } |
| 160 | 145 |
| 161 void set_state_controller(StateController* controller) { | 146 void set_state_controller(StateController* controller) { |
| 162 state_controller_ = controller; | 147 state_controller_ = controller; |
| 163 } | 148 } |
| 164 void set_mirroring_controller(SoftwareMirroringController* controller) { | 149 void set_mirroring_controller(SoftwareMirroringController* controller) { |
| 165 mirroring_controller_ = controller; | 150 mirroring_controller_ = controller; |
| 166 } | 151 } |
| 167 | 152 |
| 168 // Replaces |native_display_delegate_| and |touchscreen_delegate_| with the 2 | 153 // Replaces |native_display_delegate_| with the delegate passed in and sets |
| 169 // delegates passed in and sets |configure_display_| to true. Should be called | 154 // |configure_display_| to true. Should be called before Init(). |
| 170 // before Init(). | 155 void SetDelegateForTesting( |
| 171 void SetDelegatesForTesting( | 156 scoped_ptr<NativeDisplayDelegate> display_delegate); |
| 172 scoped_ptr<NativeDisplayDelegate> display_delegate, | |
| 173 scoped_ptr<TouchscreenDelegate> touchscreen_delegate); | |
| 174 | 157 |
| 175 // Sets the initial value of |power_state_|. Must be called before Start(). | 158 // Sets the initial value of |power_state_|. Must be called before Start(). |
| 176 void SetInitialDisplayPower(chromeos::DisplayPowerState power_state); | 159 void SetInitialDisplayPower(chromeos::DisplayPowerState power_state); |
| 177 | 160 |
| 178 // Initialization, must be called right after constructor. | 161 // Initialization, must be called right after constructor. |
| 179 // |is_panel_fitting_enabled| indicates hardware panel fitting support. | 162 // |is_panel_fitting_enabled| indicates hardware panel fitting support. |
| 180 void Init(bool is_panel_fitting_enabled); | 163 void Init(bool is_panel_fitting_enabled); |
| 181 | 164 |
| 182 // Does initial configuration of displays during startup. | 165 // Does initial configuration of displays during startup. |
| 183 // If |background_color_argb| is non zero and there are multiple displays, | 166 // If |background_color_argb| is non zero and there are multiple displays, |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 | 297 |
| 315 // Returns true if in either hardware or software mirroring mode. | 298 // Returns true if in either hardware or software mirroring mode. |
| 316 bool IsMirroring() const; | 299 bool IsMirroring() const; |
| 317 | 300 |
| 318 // Applies display protections according to requests. | 301 // Applies display protections according to requests. |
| 319 bool ApplyProtections(const ContentProtections& requests); | 302 bool ApplyProtections(const ContentProtections& requests); |
| 320 | 303 |
| 321 StateController* state_controller_; | 304 StateController* state_controller_; |
| 322 SoftwareMirroringController* mirroring_controller_; | 305 SoftwareMirroringController* mirroring_controller_; |
| 323 scoped_ptr<NativeDisplayDelegate> native_display_delegate_; | 306 scoped_ptr<NativeDisplayDelegate> native_display_delegate_; |
| 324 scoped_ptr<TouchscreenDelegate> touchscreen_delegate_; | |
| 325 | 307 |
| 326 // Used to enable modes which rely on panel fitting. | 308 // Used to enable modes which rely on panel fitting. |
| 327 bool is_panel_fitting_enabled_; | 309 bool is_panel_fitting_enabled_; |
| 328 | 310 |
| 329 // This is detected by the constructor to determine whether or not we should | 311 // This is detected by the constructor to determine whether or not we should |
| 330 // be enabled. If we aren't running on ChromeOS, we can't assume that the | 312 // be enabled. If we aren't running on ChromeOS, we can't assume that the |
| 331 // Xrandr X11 extension is supported. | 313 // Xrandr X11 extension is supported. |
| 332 // If this flag is set to false, any attempts to change the display | 314 // If this flag is set to false, any attempts to change the display |
| 333 // configuration to immediately fail without changing the state. | 315 // configuration to immediately fail without changing the state. |
| 334 bool configure_display_; | 316 bool configure_display_; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 357 | 339 |
| 358 // Display protection requests of each client. | 340 // Display protection requests of each client. |
| 359 ProtectionRequests client_protection_requests_; | 341 ProtectionRequests client_protection_requests_; |
| 360 | 342 |
| 361 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurator); | 343 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurator); |
| 362 }; | 344 }; |
| 363 | 345 |
| 364 } // namespace ui | 346 } // namespace ui |
| 365 | 347 |
| 366 #endif // UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ | 348 #endif // UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ |
| OLD | NEW |