Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(837)

Unified Diff: components/gcm_driver/gcm_driver.h

Issue 2697793004: Push API: Validate storage before returning cached subscriptions (Closed)
Patch Set: Comment out PUSH_GETREGISTRATION_STATUS_PUBLIC_KEY_UNAVAILABLE Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.

Powered by Google App Engine
This is Rietveld 408576698