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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // Returns the mode within |display| that matches the given size with highest | 130 // Returns the mode within |display| that matches the given size with highest |
131 // refresh rate. Returns None if no matching display was found. | 131 // refresh rate. Returns None if no matching display was found. |
132 static const DisplayMode* FindDisplayModeMatchingSize( | 132 static const DisplayMode* FindDisplayModeMatchingSize( |
133 const DisplaySnapshot& display, | 133 const DisplaySnapshot& display, |
134 const gfx::Size& size); | 134 const gfx::Size& size); |
135 | 135 |
136 DisplayConfigurator(); | 136 DisplayConfigurator(); |
137 virtual ~DisplayConfigurator(); | 137 virtual ~DisplayConfigurator(); |
138 | 138 |
139 MultipleDisplayState display_state() const { return display_state_; } | 139 MultipleDisplayState display_state() const { return display_state_; } |
140 chromeos::DisplayPowerState power_state() const { return power_state_; } | 140 chromeos::DisplayPowerState requested_power_state() const { |
| 141 return requested_power_state_; |
| 142 } |
141 const gfx::Size framebuffer_size() const { return framebuffer_size_; } | 143 const gfx::Size framebuffer_size() const { return framebuffer_size_; } |
142 const std::vector<DisplayState>& cached_displays() const { | 144 const std::vector<DisplayState>& cached_displays() const { |
143 return cached_displays_; | 145 return cached_displays_; |
144 } | 146 } |
145 | 147 |
146 void set_state_controller(StateController* controller) { | 148 void set_state_controller(StateController* controller) { |
147 state_controller_ = controller; | 149 state_controller_ = controller; |
148 } | 150 } |
149 void set_mirroring_controller(SoftwareMirroringController* controller) { | 151 void set_mirroring_controller(SoftwareMirroringController* controller) { |
150 mirroring_controller_ = controller; | 152 mirroring_controller_ = controller; |
(...skipping 16 matching lines...) Expand all Loading... |
167 // DisplayConfigurator sets the background color of X's RootWindow to this | 169 // DisplayConfigurator sets the background color of X's RootWindow to this |
168 // color. | 170 // color. |
169 void ForceInitialConfigure(uint32_t background_color_argb); | 171 void ForceInitialConfigure(uint32_t background_color_argb); |
170 | 172 |
171 // Stop handling display configuration events/requests. | 173 // Stop handling display configuration events/requests. |
172 void PrepareForExit(); | 174 void PrepareForExit(); |
173 | 175 |
174 // Called when powerd notifies us that some set of displays should be turned | 176 // Called when powerd notifies us that some set of displays should be turned |
175 // on or off. This requires enabling or disabling the CRTC associated with | 177 // on or off. This requires enabling or disabling the CRTC associated with |
176 // the display(s) in question so that the low power state is engaged. | 178 // the display(s) in question so that the low power state is engaged. |
177 // |flags| contains bitwise-or-ed kSetDisplayPower* values. | 179 // |flags| contains bitwise-or-ed kSetDisplayPower* values. Returns true if |
| 180 // the system successfully enters (or was already in) |power_state|. |
178 bool SetDisplayPower(chromeos::DisplayPowerState power_state, int flags); | 181 bool SetDisplayPower(chromeos::DisplayPowerState power_state, int flags); |
179 | 182 |
180 // Force switching the display mode to |new_state|. Returns false if | 183 // Force switching the display mode to |new_state|. Returns false if |
181 // switching failed (possibly because |new_state| is invalid for the | 184 // switching failed (possibly because |new_state| is invalid for the |
182 // current set of connected displays). | 185 // current set of connected displays). |
183 bool SetDisplayMode(MultipleDisplayState new_state); | 186 bool SetDisplayMode(MultipleDisplayState new_state); |
184 | 187 |
185 // NativeDisplayDelegate::Observer overrides: | 188 // NativeDisplayDelegate::Observer overrides: |
186 virtual void OnConfigurationChanged() OVERRIDE; | 189 virtual void OnConfigurationChanged() OVERRIDE; |
187 | 190 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 // Xrandr X11 extension is supported. | 316 // Xrandr X11 extension is supported. |
314 // If this flag is set to false, any attempts to change the display | 317 // If this flag is set to false, any attempts to change the display |
315 // configuration to immediately fail without changing the state. | 318 // configuration to immediately fail without changing the state. |
316 bool configure_display_; | 319 bool configure_display_; |
317 | 320 |
318 // The current display state. | 321 // The current display state. |
319 MultipleDisplayState display_state_; | 322 MultipleDisplayState display_state_; |
320 | 323 |
321 gfx::Size framebuffer_size_; | 324 gfx::Size framebuffer_size_; |
322 | 325 |
323 // The current power state. | 326 // The last-requested and current power state. These may differ if |
324 chromeos::DisplayPowerState power_state_; | 327 // configuration fails: SetDisplayMode() needs the last-requested state while |
| 328 // SetDisplayPower() needs the current state. |
| 329 chromeos::DisplayPowerState requested_power_state_; |
| 330 chromeos::DisplayPowerState current_power_state_; |
325 | 331 |
326 // Most-recently-used display configuration. Note that the actual | 332 // Most-recently-used display configuration. Note that the actual |
327 // configuration changes asynchronously. | 333 // configuration changes asynchronously. |
328 DisplayStateList cached_displays_; | 334 DisplayStateList cached_displays_; |
329 | 335 |
330 ObserverList<Observer> observers_; | 336 ObserverList<Observer> observers_; |
331 | 337 |
332 // The timer to delay configuring displays. This is used to aggregate multiple | 338 // The timer to delay configuring displays. This is used to aggregate multiple |
333 // display configuration events when they are reported in short time spans. | 339 // display configuration events when they are reported in short time spans. |
334 // See comment for NativeDisplayEventDispatcherX11 for more details. | 340 // See comment for NativeDisplayEventDispatcherX11 for more details. |
335 base::OneShotTimer<DisplayConfigurator> configure_timer_; | 341 base::OneShotTimer<DisplayConfigurator> configure_timer_; |
336 | 342 |
337 // Id for next display protection client. | 343 // Id for next display protection client. |
338 ContentProtectionClientId next_display_protection_client_id_; | 344 ContentProtectionClientId next_display_protection_client_id_; |
339 | 345 |
340 // Display protection requests of each client. | 346 // Display protection requests of each client. |
341 ProtectionRequests client_protection_requests_; | 347 ProtectionRequests client_protection_requests_; |
342 | 348 |
343 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurator); | 349 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurator); |
344 }; | 350 }; |
345 | 351 |
346 } // namespace ui | 352 } // namespace ui |
347 | 353 |
348 #endif // UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ | 354 #endif // UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ |
OLD | NEW |