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

Unified Diff: content/browser/push_messaging/push_messaging_message_filter.cc

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: Fix GN/GYP Created 4 years, 8 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: content/browser/push_messaging/push_messaging_message_filter.cc
diff --git a/content/browser/push_messaging/push_messaging_message_filter.cc b/content/browser/push_messaging/push_messaging_message_filter.cc
index 26184cf0867fc6a874fd5244debacd341f5a8a94..6456dd52fc536ee80cfd3929ac8b5dc1de2d0e2c 100644
--- a/content/browser/push_messaging/push_messaging_message_filter.cc
+++ b/content/browser/push_messaging/push_messaging_message_filter.cc
@@ -116,8 +116,7 @@ class PushMessagingMessageFilter::Core {
// Called via PostTask from IO thread.
void UnregisterFromService(int request_id,
int64_t service_worker_registration_id,
- const GURL& requesting_origin,
- const std::string& sender_id);
+ const GURL& requesting_origin);
// Public GetPermission methods on UI thread ---------------------------------
@@ -407,6 +406,8 @@ void PushMessagingMessageFilter::Core::RegisterOnUI(
PushMessagingService* push_service = service();
if (!push_service) {
if (!is_incognito()) {
+ // This might happen if InstanceIDProfileService::IsInstanceIDEnabled
+ // returns false because the Instance ID kill switch was enabled.
// TODO(johnme): Might be better not to expose the API in this case.
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
@@ -603,37 +604,13 @@ void PushMessagingMessageFilter::UnsubscribeHavingGottenPushSubscriptionId(
ServiceWorkerStatusCode service_worker_status) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- if (service_worker_status == SERVICE_WORKER_OK) {
- service_worker_context_->GetRegistrationUserData(
- service_worker_registration_id, kPushSenderIdServiceWorkerKey,
- base::Bind(&PushMessagingMessageFilter::UnsubscribeHavingGottenSenderId,
- weak_factory_io_to_io_.GetWeakPtr(), request_id,
- service_worker_registration_id, requesting_origin));
- } else {
- // Errors are handled the same, whether we were trying to get the
- // push_subscription_id or the sender_id.
- UnsubscribeHavingGottenSenderId(
- request_id, service_worker_registration_id, requesting_origin,
- std::string() /* sender_id */, service_worker_status);
- }
-}
-
-void PushMessagingMessageFilter::UnsubscribeHavingGottenSenderId(
- int request_id,
- int64_t service_worker_registration_id,
- const GURL& requesting_origin,
- const std::string& sender_id,
- ServiceWorkerStatusCode service_worker_status) {
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
-
switch (service_worker_status) {
case SERVICE_WORKER_OK:
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&Core::UnregisterFromService,
base::Unretained(ui_core_.get()), request_id,
- service_worker_registration_id, requesting_origin,
- sender_id));
+ service_worker_registration_id, requesting_origin));
break;
case SERVICE_WORKER_ERROR_NOT_FOUND:
// We did not find a registration, stop here and notify the renderer that
@@ -671,8 +648,7 @@ void PushMessagingMessageFilter::UnsubscribeHavingGottenSenderId(
void PushMessagingMessageFilter::Core::UnregisterFromService(
int request_id,
int64_t service_worker_registration_id,
- const GURL& requesting_origin,
- const std::string& sender_id) {
+ const GURL& requesting_origin) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
PushMessagingService* push_service = service();
if (!push_service) {
@@ -688,7 +664,7 @@ void PushMessagingMessageFilter::Core::UnregisterFromService(
}
push_service->Unsubscribe(
- requesting_origin, service_worker_registration_id, sender_id,
+ requesting_origin, service_worker_registration_id,
base::Bind(&Core::DidUnregisterFromService,
weak_factory_ui_to_ui_.GetWeakPtr(), request_id,
service_worker_registration_id));

Powered by Google App Engine
This is Rietveld 408576698