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

Unified Diff: chrome/browser/push_messaging/push_messaging_service_impl.h

Issue 1851423003: Make Web Push use InstanceID tokens instead of GCM registrations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@iid4default
Patch Set: Rebase (main conflics in browsertest and PMMF) Created 4 years, 7 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: chrome/browser/push_messaging/push_messaging_service_impl.h
diff --git a/chrome/browser/push_messaging/push_messaging_service_impl.h b/chrome/browser/push_messaging/push_messaging_service_impl.h
index 483e9a96138905a2a8a9e674d7096bb4ec6f12ec..e4b405e433596e16e5d14e71a6bb874c9fbbfcdb 100644
--- a/chrome/browser/push_messaging/push_messaging_service_impl.h
+++ b/chrome/browser/push_messaging/push_messaging_service_impl.h
@@ -22,6 +22,7 @@
#include "components/gcm_driver/common/gcm_messages.h"
#include "components/gcm_driver/gcm_app_handler.h"
#include "components/gcm_driver/gcm_client.h"
+#include "components/gcm_driver/instance_id/instance_id.h"
#include "components/keyed_service/core/keyed_service.h"
#include "content/public/browser/push_messaging_service.h"
#include "content/public/common/push_event_payload.h"
@@ -36,12 +37,15 @@
class Profile;
class PushMessagingAppIdentifier;
class PushMessagingServiceObserver;
+class PushMessagingServiceTest;
class ScopedKeepAlive;
struct PushSubscriptionOptions;
namespace gcm {
class GCMDriver;
-class GCMProfileService;
+}
+namespace instance_id {
+class InstanceIDDriver;
}
namespace user_prefs {
@@ -89,6 +93,7 @@ class PushMessagingServiceImpl : public content::PushMessagingService,
void GetEncryptionInfo(
const GURL& origin,
int64_t service_worker_registration_id,
+ const std::string& sender_id,
const content::PushMessagingService::EncryptionInfoCallback& callback)
override;
void Unsubscribe(
@@ -120,6 +125,7 @@ class PushMessagingServiceImpl : public content::PushMessagingService,
const base::Closure& callback);
private:
+ friend class PushMessagingBrowserTest;
FRIEND_TEST_ALL_PREFIXES(PushMessagingServiceTest, NormalizeSenderInfo);
FRIEND_TEST_ALL_PREFIXES(PushMessagingServiceTest, PayloadEncryptionTest);
@@ -141,6 +147,12 @@ class PushMessagingServiceImpl : public content::PushMessagingService,
// Subscribe methods ---------------------------------------------------------
+ void DoSubscribe(
+ const PushMessagingAppIdentifier& app_identifier,
+ const content::PushSubscriptionOptions& options,
+ const content::PushMessagingService::RegisterCallback& callback,
+ blink::mojom::PermissionStatus permission_status);
+
void SubscribeEnd(
const content::PushMessagingService::RegisterCallback& callback,
const std::string& subscription_id,
@@ -154,9 +166,10 @@ class PushMessagingServiceImpl : public content::PushMessagingService,
void DidSubscribe(
const PushMessagingAppIdentifier& app_identifier,
+ const std::string& sender_id,
const content::PushMessagingService::RegisterCallback& callback,
const std::string& subscription_id,
- gcm::GCMClient::Result result);
+ instance_id::InstanceID::Result result);
void DidSubscribeWithEncryptionInfo(
const PushMessagingAppIdentifier& app_identifier,
@@ -165,12 +178,6 @@ class PushMessagingServiceImpl : public content::PushMessagingService,
const std::string& p256dh,
const std::string& auth_secret);
- void DidRequestPermission(
- const PushMessagingAppIdentifier& app_identifier,
- const content::PushSubscriptionOptions& options,
- const content::PushMessagingService::RegisterCallback& callback,
- blink::mojom::PermissionStatus permission_status);
-
// GetEncryptionInfo method --------------------------------------------------
void DidGetEncryptionInfo(
@@ -184,6 +191,17 @@ class PushMessagingServiceImpl : public content::PushMessagingService,
const std::string& sender_id,
const content::PushMessagingService::UnregisterCallback&);
+ void DidDeleteID(const std::string& app_id,
+ bool was_subscribed,
+ const content::PushMessagingService::UnregisterCallback&,
+ instance_id::InstanceID::Result result);
+
+ void DidUnsubscribeInstanceID(
+ const std::string& app_id,
+ bool was_subscribed,
+ const content::PushMessagingService::UnregisterCallback&,
+ instance_id::InstanceID::Result result);
+
void DidUnsubscribe(bool was_subscribed,
const content::PushMessagingService::UnregisterCallback&,
gcm::GCMClient::Result result);
@@ -207,8 +225,16 @@ class PushMessagingServiceImpl : public content::PushMessagingService,
// Checks if a given origin is allowed to use Push.
bool IsPermissionSet(const GURL& origin);
+ // Wrapper around {GCMDriver, InstanceID}::GetEncryptionInfo.
+ void GetEncryptionInfoImpl(
+ const std::string& app_id,
+ const std::string& sender_id,
+ gcm::GCMEncryptionProvider::EncryptionInfoCallback callback);
+
gcm::GCMDriver* GetGCMDriver() const;
+ instance_id::InstanceIDDriver* GetInstanceIDDriver() const;
+
// Testing methods -----------------------------------------------------------
// Callback to be invoked when a message has been dispatched. Enables tests to

Powered by Google App Engine
This is Rietveld 408576698