| 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 UpdateDisplayConfigurationTask; | 35 class UpdateDisplayConfigurationTask; |
| 36 | 36 |
| 37 // This class interacts directly with the system display configurator. | 37 // This class interacts directly with the system display configurator. |
| 38 class DISPLAY_EXPORT DisplayConfigurator : public NativeDisplayObserver { | 38 class DISPLAY_EXPORT DisplayConfigurator : public NativeDisplayObserver { |
| 39 public: | 39 public: |
| 40 typedef uint64_t ContentProtectionClientId; | 40 typedef uint64_t ContentProtectionClientId; |
| 41 static const ContentProtectionClientId kInvalidClientId = 0; | 41 static const ContentProtectionClientId kInvalidClientId = 0; |
| 42 | 42 |
| 43 typedef base::Callback<void(bool)> ConfigurationCallback; | 43 typedef base::Callback<void(bool)> ConfigurationCallback; |
| 44 | 44 |
| 45 typedef base::Callback<void(bool /* success */)> EnableProtectionCallback; |
| 46 |
| 47 struct QueryProtectionResponse { |
| 48 // True if the query succeeded, false otherwise. |
| 49 bool success = false; |
| 50 |
| 51 // The type of connected display links, which is a bitmask of |
| 52 // DisplayConnectionType values. |
| 53 uint32_t link_mask = 0; |
| 54 |
| 55 // The desired protection methods, which is a bitmask of the |
| 56 // ContentProtectionMethod values. |
| 57 uint32_t protection_mask = 0; |
| 58 }; |
| 59 |
| 60 typedef base::Callback<void(const QueryProtectionResponse&)> |
| 61 QueryProtectionCallback; |
| 62 |
| 45 typedef std::vector<DisplaySnapshot*> DisplayStateList; | 63 typedef std::vector<DisplaySnapshot*> DisplayStateList; |
| 46 | 64 |
| 47 class Observer { | 65 class Observer { |
| 48 public: | 66 public: |
| 49 virtual ~Observer() {} | 67 virtual ~Observer() {} |
| 50 | 68 |
| 51 // Called after the display mode has been changed. |display| contains the | 69 // Called after the display mode has been changed. |display| contains the |
| 52 // just-applied configuration. Note that the X server is no longer grabbed | 70 // just-applied configuration. Note that the X server is no longer grabbed |
| 53 // when this method is called, so the actual configuration could've changed | 71 // when this method is called, so the actual configuration could've changed |
| 54 // already. | 72 // already. |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 // suspended. | 251 // suspended. |
| 234 void ResumeDisplays(); | 252 void ResumeDisplays(); |
| 235 | 253 |
| 236 // Registers a client for display protection and requests a client id. Returns | 254 // Registers a client for display protection and requests a client id. Returns |
| 237 // 0 if requesting failed. | 255 // 0 if requesting failed. |
| 238 ContentProtectionClientId RegisterContentProtectionClient(); | 256 ContentProtectionClientId RegisterContentProtectionClient(); |
| 239 | 257 |
| 240 // Unregisters the client. | 258 // Unregisters the client. |
| 241 void UnregisterContentProtectionClient(ContentProtectionClientId client_id); | 259 void UnregisterContentProtectionClient(ContentProtectionClientId client_id); |
| 242 | 260 |
| 243 // Queries link status and protection status. | 261 // Queries link status and protection status. |callback| is used to respond |
| 244 // |link_mask| is the type of connected display links, which is a bitmask of | 262 // to the query. |
| 245 // DisplayConnectionType values. |protection_mask| is the desired protection | 263 void QueryContentProtectionStatus(ContentProtectionClientId client_id, |
| 246 // methods, which is a bitmask of the ContentProtectionMethod values. | |
| 247 // Returns true on success. | |
| 248 bool QueryContentProtectionStatus(ContentProtectionClientId client_id, | |
| 249 int64_t display_id, | 264 int64_t display_id, |
| 250 uint32_t* link_mask, | 265 const QueryProtectionCallback& callback); |
| 251 uint32_t* protection_mask); | |
| 252 | 266 |
| 253 // Requests the desired protection methods. | 267 // Requests the desired protection methods. |
| 254 // |protection_mask| is the desired protection methods, which is a bitmask | 268 // |protection_mask| is the desired protection methods, which is a bitmask |
| 255 // of the ContentProtectionMethod values. | 269 // of the ContentProtectionMethod values. |
| 256 // Returns true when the protection request has been made. | 270 // Returns true when the protection request has been made. |
| 257 bool EnableContentProtection(ContentProtectionClientId client_id, | 271 void EnableContentProtection(ContentProtectionClientId client_id, |
| 258 int64_t display_id, | 272 int64_t display_id, |
| 259 uint32_t desired_protection_mask); | 273 uint32_t protection_mask, |
| 274 const EnableProtectionCallback& callback); |
| 260 | 275 |
| 261 // Checks the available color profiles for |display_id| and fills the result | 276 // Checks the available color profiles for |display_id| and fills the result |
| 262 // into |profiles|. | 277 // into |profiles|. |
| 263 std::vector<ui::ColorCalibrationProfile> GetAvailableColorCalibrationProfiles( | 278 std::vector<ui::ColorCalibrationProfile> GetAvailableColorCalibrationProfiles( |
| 264 int64_t display_id); | 279 int64_t display_id); |
| 265 | 280 |
| 266 // Updates the color calibration to |new_profile|. | 281 // Updates the color calibration to |new_profile|. |
| 267 bool SetColorCalibrationProfile(int64_t display_id, | 282 bool SetColorCalibrationProfile(int64_t display_id, |
| 268 ui::ColorCalibrationProfile new_profile); | 283 ui::ColorCalibrationProfile new_profile); |
| 269 | 284 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 | 417 |
| 403 // This must be the last variable. | 418 // This must be the last variable. |
| 404 base::WeakPtrFactory<DisplayConfigurator> weak_ptr_factory_; | 419 base::WeakPtrFactory<DisplayConfigurator> weak_ptr_factory_; |
| 405 | 420 |
| 406 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurator); | 421 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurator); |
| 407 }; | 422 }; |
| 408 | 423 |
| 409 } // namespace ui | 424 } // namespace ui |
| 410 | 425 |
| 411 #endif // UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ | 426 #endif // UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ |
| OLD | NEW |