Chromium Code Reviews| Index: components/gcm_driver/gcm_driver.h |
| diff --git a/components/gcm_driver/gcm_driver.h b/components/gcm_driver/gcm_driver.h |
| index f115d16562a00f5259063fee96ca738bf8819c74..c4f159410d051cc20eebf3a64ffbd0228cd6bda0 100644 |
| --- a/components/gcm_driver/gcm_driver.h |
| +++ b/components/gcm_driver/gcm_driver.h |
| @@ -33,12 +33,13 @@ struct AccountMapping; |
| // Provides the InstanceID support via GCMDriver. |
| class InstanceIDHandler { |
| public: |
| - typedef base::Callback<void(const std::string& token, |
| - GCMClient::Result result)> GetTokenCallback; |
| - typedef base::Callback<void(GCMClient::Result result)> DeleteTokenCallback; |
| - typedef base::Callback<void(const std::string& instance_id, |
| - const std::string& extra_data)> |
| - GetInstanceIDDataCallback; |
| + using GetTokenCallback = |
| + base::Callback<void(const std::string& token, GCMClient::Result result)>; |
| + using ValidateTokenCallback = base::Callback<void(bool is_valid)>; |
| + using DeleteTokenCallback = base::Callback<void(GCMClient::Result result)>; |
| + using GetInstanceIDDataCallback = |
| + base::Callback<void(const std::string& instance_id, |
| + const std::string& extra_data)>; |
| InstanceIDHandler(); |
| virtual ~InstanceIDHandler(); |
| @@ -49,6 +50,11 @@ class InstanceIDHandler { |
| const std::string& scope, |
| const std::map<std::string, std::string>& options, |
| const GetTokenCallback& callback) = 0; |
| + virtual void ValidateToken(const std::string& app_id, |
| + const std::string& authorized_entity, |
| + const std::string& scope, |
| + const std::string& token, |
| + const ValidateTokenCallback& callback) = 0; |
| virtual void DeleteToken(const std::string& app_id, |
| const std::string& authorized_entity, |
| const std::string& scope, |
| @@ -72,16 +78,20 @@ class InstanceIDHandler { |
| // Bridge between GCM users in Chrome and the platform-specific implementation. |
| class GCMDriver { |
| public: |
| - typedef std::map<std::string, GCMAppHandler*> GCMAppHandlerMap; |
| - typedef base::Callback<void(const std::string& registration_id, |
| - GCMClient::Result result)> RegisterCallback; |
| - typedef base::Callback<void(const std::string& message_id, |
| - GCMClient::Result result)> SendCallback; |
| - typedef base::Callback<void(const std::string&, const std::string&)> |
| - GetEncryptionInfoCallback; |
| - typedef base::Callback<void(GCMClient::Result result)> UnregisterCallback; |
| - typedef base::Callback<void(const GCMClient::GCMStatistics& stats)> |
| - GetGCMStatisticsCallback; |
| + static const size_t kMaxSenders; |
|
Peter Beverloo
2017/03/20 23:50:13
It seems to me like making this protected would be
johnme
2017/03/30 18:36:38
Doneish. I kept it public as I feel the limit is p
|
| + |
| + using GCMAppHandlerMap = std::map<std::string, GCMAppHandler*>; |
| + using RegisterCallback = |
| + base::Callback<void(const std::string& registration_id, |
| + GCMClient::Result result)>; |
| + using ValidateRegistrationCallback = base::Callback<void(bool is_valid)>; |
| + using UnregisterCallback = base::Callback<void(GCMClient::Result result)>; |
| + using SendCallback = base::Callback<void(const std::string& message_id, |
| + GCMClient::Result result)>; |
| + using GetEncryptionInfoCallback = |
| + base::Callback<void(const std::string&, const std::string&)>; |
| + using GetGCMStatisticsCallback = |
| + base::Callback<void(const GCMClient::GCMStatistics& stats)>; |
| // Enumeration to be used with GetGCMStatistics() for indicating whether the |
| // existing logs should be cleared or kept. |
| @@ -107,6 +117,14 @@ class GCMDriver { |
| const std::vector<std::string>& sender_ids, |
| const RegisterCallback& callback); |
| + // Checks that the provided |sender_ids| and |registration_id| matches the |
| + // stored registration info for |app_id|. |
| + virtual void ValidateRegistration( |
| + const std::string& app_id, |
| + const std::vector<std::string>& sender_ids, |
| + const std::string& registration_id, |
| + const ValidateRegistrationCallback& callback) = 0; |
| + |
| // Unregisters all sender_ids for an app. Only works on non-Android. Will also |
| // remove any encryption keys associated with the |app_id|. |
| // |app_id|: application ID. |