Chromium Code Reviews| Index: ui/display/manager/chromeos/display_configurator.h |
| diff --git a/ui/display/manager/chromeos/display_configurator.h b/ui/display/manager/chromeos/display_configurator.h |
| index c9034adf3609d7771818fea79a7d42eaebf79694..d6e86d744f3799a3d6ce12b0729125752391fcc6 100644 |
| --- a/ui/display/manager/chromeos/display_configurator.h |
| +++ b/ui/display/manager/chromeos/display_configurator.h |
| @@ -44,35 +44,28 @@ class UpdateDisplayConfigurationTask; |
| class DISPLAY_MANAGER_EXPORT DisplayConfigurator |
| : public NativeDisplayObserver { |
| public: |
| - typedef uint64_t ContentProtectionClientId; |
| - static const ContentProtectionClientId kInvalidClientId = 0; |
| - |
| - typedef base::Callback<void(bool /* success */)> ConfigurationCallback; |
| - |
| - typedef base::Callback<void(bool /* success */)> EnableProtectionCallback; |
| - |
| - struct QueryProtectionResponse { |
| - // True if the query succeeded, false otherwise. |
| - bool success = false; |
| - |
| - // The type of connected display links, which is a bitmask of |
| - // DisplayConnectionType values. |
| - uint32_t link_mask = 0; |
| - |
| - // The desired protection methods, which is a bitmask of the |
| - // ContentProtectionMethod values. |
| - uint32_t protection_mask = 0; |
| + enum : uint64_t { |
|
kcwu
2017/02/11 01:45:21
Why use enum instead of a constant? And why use ui
Peng
2017/02/13 21:14:47
The static constant member value causes the link e
|
| + INVALID_CLIENT_ID = 0, |
| }; |
| - typedef base::Callback<void(const QueryProtectionResponse&)> |
| - QueryProtectionCallback; |
| + using ConfigurationCallback = base::Callback<void(bool /* success */)>; |
| + |
| + using EnableProtectionCallback = base::Callback<void(bool /* success */)>; |
| - typedef base::Callback<void(bool /* success */)> DisplayControlCallback; |
| + // link_mask: The type of connected display links, which is a bitmask of |
| + // DisplayConnectionType values. |
| + // protection_mask: The desired protection methods, which is a bitmask of the |
| + // ContentProtectionMethod values. |
| + using QueryProtectionCallback = |
| + base::Callback<void(bool /* success */, |
| + uint32_t /* link_mask */, |
| + uint32_t /* protection_mask */)>; |
| + using DisplayControlCallback = base::Callback<void(bool /* success */)>; |
| - typedef std::vector<DisplaySnapshot*> DisplayStateList; |
| + using DisplayStateList = std::vector<DisplaySnapshot*>; |
| // Mapping a display_id to a protection request bitmask. |
| - typedef std::map<int64_t, uint32_t> ContentProtections; |
| + using ContentProtections = std::map<int64_t, uint32_t>; |
| class Observer { |
| public: |
| @@ -263,14 +256,14 @@ class DISPLAY_MANAGER_EXPORT DisplayConfigurator |
| // Registers a client for display protection and requests a client id. Returns |
| // 0 if requesting failed. |
| - ContentProtectionClientId RegisterContentProtectionClient(); |
| + uint64_t RegisterContentProtectionClient(); |
| // Unregisters the client. |
| - void UnregisterContentProtectionClient(ContentProtectionClientId client_id); |
| + void UnregisterContentProtectionClient(uint64_t client_id); |
| // Queries link status and protection status. |callback| is used to respond |
| // to the query. |
| - void QueryContentProtectionStatus(ContentProtectionClientId client_id, |
| + void QueryContentProtectionStatus(uint64_t client_id, |
| int64_t display_id, |
| const QueryProtectionCallback& callback); |
| @@ -278,7 +271,7 @@ class DISPLAY_MANAGER_EXPORT DisplayConfigurator |
| // |protection_mask| is the desired protection methods, which is a bitmask |
| // of the ContentProtectionMethod values. |
| // Returns true when the protection request has been made. |
| - void EnableContentProtection(ContentProtectionClientId client_id, |
| + void EnableContentProtection(uint64_t client_id, |
| int64_t display_id, |
| uint32_t protection_mask, |
| const EnableProtectionCallback& callback); |
| @@ -310,8 +303,7 @@ class DISPLAY_MANAGER_EXPORT DisplayConfigurator |
| class DisplayLayoutManagerImpl; |
| // Mapping a client to its protection request. |
| - typedef std::map<ContentProtectionClientId, ContentProtections> |
| - ProtectionRequests; |
| + using ProtectionRequests = std::map<uint64_t, ContentProtections>; |
| // Updates |pending_*| members and applies the passed-in state. |callback| is |
| // invoked (perhaps synchronously) on completion. |
| @@ -365,10 +357,10 @@ class DISPLAY_MANAGER_EXPORT DisplayConfigurator |
| // are responsible for destroying the task, replying to the caller that made |
| // the task and starting the a new content protection task if one is queued. |
| void OnContentProtectionQueried( |
| - ContentProtectionClientId client_id, |
| + uint64_t client_id, |
| int64_t display_id, |
| QueryContentProtectionTask::Response response); |
| - void OnContentProtectionEnabled(ContentProtectionClientId client_id, |
| + void OnContentProtectionEnabled(uint64_t client_id, |
| int64_t display_id, |
| uint32_t desired_method_mask, |
| bool success); |
| @@ -457,7 +449,7 @@ class DISPLAY_MANAGER_EXPORT DisplayConfigurator |
| base::OneShotTimer configure_timer_; |
| // Id for next display protection client. |
| - ContentProtectionClientId next_display_protection_client_id_; |
| + uint64_t next_display_protection_client_id_; |
| // Display protection requests of each client. |
| ProtectionRequests client_protection_requests_; |