| 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_OUTPUT_CONFIGURATOR_H_ | 5 #ifndef UI_DISPLAY_CHROMEOS_OUTPUT_CONFIGURATOR_H_ |
| 6 #define UI_DISPLAY_CHROMEOS_OUTPUT_CONFIGURATOR_H_ | 6 #define UI_DISPLAY_CHROMEOS_OUTPUT_CONFIGURATOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <map> | 10 #include <map> |
| 9 #include <string> | 11 #include <string> |
| 10 #include <vector> | 12 #include <vector> |
| 11 | 13 |
| 12 #include "base/basictypes.h" | |
| 13 #include "base/event_types.h" | 14 #include "base/event_types.h" |
| 14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 16 #include "base/timer/timer.h" | 17 #include "base/timer/timer.h" |
| 17 #include "third_party/cros_system_api/dbus/service_constants.h" | 18 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 18 #include "ui/display/chromeos/native_display_observer.h" | 19 #include "ui/display/chromeos/native_display_observer.h" |
| 19 #include "ui/display/display_constants.h" | 20 #include "ui/display/display_constants.h" |
| 20 #include "ui/display/display_export.h" | 21 #include "ui/display/display_export.h" |
| 21 | 22 |
| 22 namespace gfx { | 23 namespace gfx { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 }; | 82 }; |
| 82 | 83 |
| 83 // Interface for classes that make decisions about which output state | 84 // Interface for classes that make decisions about which output state |
| 84 // should be used. | 85 // should be used. |
| 85 class StateController { | 86 class StateController { |
| 86 public: | 87 public: |
| 87 virtual ~StateController() {} | 88 virtual ~StateController() {} |
| 88 | 89 |
| 89 // Called when displays are detected. | 90 // Called when displays are detected. |
| 90 virtual OutputState GetStateForDisplayIds( | 91 virtual OutputState GetStateForDisplayIds( |
| 91 const std::vector<int64>& display_ids) const = 0; | 92 const std::vector<int64_t>& display_ids) const = 0; |
| 92 | 93 |
| 93 // Queries the resolution (|size|) in pixels to select output mode for the | 94 // Queries the resolution (|size|) in pixels to select output mode for the |
| 94 // given display id. | 95 // given display id. |
| 95 virtual bool GetResolutionForDisplayId(int64 display_id, | 96 virtual bool GetResolutionForDisplayId(int64_t display_id, |
| 96 gfx::Size* size) const = 0; | 97 gfx::Size* size) const = 0; |
| 97 }; | 98 }; |
| 98 | 99 |
| 99 // Interface for classes that implement software based mirroring. | 100 // Interface for classes that implement software based mirroring. |
| 100 class SoftwareMirroringController { | 101 class SoftwareMirroringController { |
| 101 public: | 102 public: |
| 102 virtual ~SoftwareMirroringController() {} | 103 virtual ~SoftwareMirroringController() {} |
| 103 | 104 |
| 104 // Called when the hardware mirroring failed. | 105 // Called when the hardware mirroring failed. |
| 105 virtual void SetSoftwareMirroring(bool enabled) = 0; | 106 virtual void SetSoftwareMirroring(bool enabled) = 0; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 void SetInitialDisplayPower(chromeos::DisplayPowerState power_state); | 193 void SetInitialDisplayPower(chromeos::DisplayPowerState power_state); |
| 193 | 194 |
| 194 // Initialization, must be called right after constructor. | 195 // Initialization, must be called right after constructor. |
| 195 // |is_panel_fitting_enabled| indicates hardware panel fitting support. | 196 // |is_panel_fitting_enabled| indicates hardware panel fitting support. |
| 196 void Init(bool is_panel_fitting_enabled); | 197 void Init(bool is_panel_fitting_enabled); |
| 197 | 198 |
| 198 // Does initial configuration of displays during startup. | 199 // Does initial configuration of displays during startup. |
| 199 // If |background_color_argb| is non zero and there are multiple displays, | 200 // If |background_color_argb| is non zero and there are multiple displays, |
| 200 // OutputConfigurator sets the background color of X's RootWindow to this | 201 // OutputConfigurator sets the background color of X's RootWindow to this |
| 201 // color. | 202 // color. |
| 202 void ForceInitialConfigure(uint32 background_color_argb); | 203 void ForceInitialConfigure(uint32_t background_color_argb); |
| 203 | 204 |
| 204 // Stop handling display configuration events/requests. | 205 // Stop handling display configuration events/requests. |
| 205 void PrepareForExit(); | 206 void PrepareForExit(); |
| 206 | 207 |
| 207 // Called when powerd notifies us that some set of displays should be turned | 208 // Called when powerd notifies us that some set of displays should be turned |
| 208 // on or off. This requires enabling or disabling the CRTC associated with | 209 // on or off. This requires enabling or disabling the CRTC associated with |
| 209 // the display(s) in question so that the low power state is engaged. | 210 // the display(s) in question so that the low power state is engaged. |
| 210 // |flags| contains bitwise-or-ed kSetDisplayPower* values. | 211 // |flags| contains bitwise-or-ed kSetDisplayPower* values. |
| 211 bool SetDisplayPower(chromeos::DisplayPowerState power_state, int flags); | 212 bool SetDisplayPower(chromeos::DisplayPowerState power_state, int flags); |
| 212 | 213 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 240 | 241 |
| 241 // Unregisters the client. | 242 // Unregisters the client. |
| 242 void UnregisterOutputProtectionClient(OutputProtectionClientId client_id); | 243 void UnregisterOutputProtectionClient(OutputProtectionClientId client_id); |
| 243 | 244 |
| 244 // Queries link status and protection status. | 245 // Queries link status and protection status. |
| 245 // |link_mask| is the type of connected output links, which is a bitmask of | 246 // |link_mask| is the type of connected output links, which is a bitmask of |
| 246 // OutputType values. |protection_mask| is the desired protection methods, | 247 // OutputType values. |protection_mask| is the desired protection methods, |
| 247 // which is a bitmask of the OutputProtectionMethod values. | 248 // which is a bitmask of the OutputProtectionMethod values. |
| 248 // Returns true on success. | 249 // Returns true on success. |
| 249 bool QueryOutputProtectionStatus(OutputProtectionClientId client_id, | 250 bool QueryOutputProtectionStatus(OutputProtectionClientId client_id, |
| 250 int64 display_id, | 251 int64_t display_id, |
| 251 uint32_t* link_mask, | 252 uint32_t* link_mask, |
| 252 uint32_t* protection_mask); | 253 uint32_t* protection_mask); |
| 253 | 254 |
| 254 // Requests the desired protection methods. | 255 // Requests the desired protection methods. |
| 255 // |protection_mask| is the desired protection methods, which is a bitmask | 256 // |protection_mask| is the desired protection methods, which is a bitmask |
| 256 // of the OutputProtectionMethod values. | 257 // of the OutputProtectionMethod values. |
| 257 // Returns true when the protection request has been made. | 258 // Returns true when the protection request has been made. |
| 258 bool EnableOutputProtection(OutputProtectionClientId client_id, | 259 bool EnableOutputProtection(OutputProtectionClientId client_id, |
| 259 int64 display_id, | 260 int64_t display_id, |
| 260 uint32_t desired_protection_mask); | 261 uint32_t desired_protection_mask); |
| 261 | 262 |
| 262 // Checks the available color profiles for |display_id| and fills the result | 263 // Checks the available color profiles for |display_id| and fills the result |
| 263 // into |profiles|. | 264 // into |profiles|. |
| 264 std::vector<ui::ColorCalibrationProfile> GetAvailableColorCalibrationProfiles( | 265 std::vector<ui::ColorCalibrationProfile> GetAvailableColorCalibrationProfiles( |
| 265 int64 display_id); | 266 int64_t display_id); |
| 266 | 267 |
| 267 // Updates the color calibration to |new_profile|. | 268 // Updates the color calibration to |new_profile|. |
| 268 bool SetColorCalibrationProfile( | 269 bool SetColorCalibrationProfile( |
| 269 int64 display_id, | 270 int64_t display_id, |
| 270 ui::ColorCalibrationProfile new_profile); | 271 ui::ColorCalibrationProfile new_profile); |
| 271 | 272 |
| 272 private: | 273 private: |
| 273 // Mapping a display_id to a protection request bitmask. | 274 // Mapping a display_id to a protection request bitmask. |
| 274 typedef std::map<int64, uint32_t> DisplayProtections; | 275 typedef std::map<int64_t, uint32_t> DisplayProtections; |
| 275 // Mapping a client to its protection request. | 276 // Mapping a client to its protection request. |
| 276 typedef std::map<OutputProtectionClientId, DisplayProtections> | 277 typedef std::map<OutputProtectionClientId, DisplayProtections> |
| 277 ProtectionRequests; | 278 ProtectionRequests; |
| 278 | 279 |
| 279 // Updates |cached_outputs_| to contain currently-connected outputs. Calls | 280 // Updates |cached_outputs_| to contain currently-connected outputs. Calls |
| 280 // |delegate_->GetOutputs()| and then does additional work, like finding the | 281 // |delegate_->GetOutputs()| and then does additional work, like finding the |
| 281 // mirror mode and setting user-preferred modes. Note that the server must be | 282 // mirror mode and setting user-preferred modes. Note that the server must be |
| 282 // grabbed via |delegate_->GrabServer()| first. | 283 // grabbed via |delegate_->GrabServer()| first. |
| 283 void UpdateCachedOutputs(); | 284 void UpdateCachedOutputs(); |
| 284 | 285 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 | 391 |
| 391 // Output protection requests of each client. | 392 // Output protection requests of each client. |
| 392 ProtectionRequests client_protection_requests_; | 393 ProtectionRequests client_protection_requests_; |
| 393 | 394 |
| 394 DISALLOW_COPY_AND_ASSIGN(OutputConfigurator); | 395 DISALLOW_COPY_AND_ASSIGN(OutputConfigurator); |
| 395 }; | 396 }; |
| 396 | 397 |
| 397 } // namespace ui | 398 } // namespace ui |
| 398 | 399 |
| 399 #endif // UI_DISPLAY_CHROMEOS_OUTPUT_CONFIGURATOR_H_ | 400 #endif // UI_DISPLAY_CHROMEOS_OUTPUT_CONFIGURATOR_H_ |
| OLD | NEW |