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

Unified Diff: chrome/browser/services/gcm/push_messaging_service_impl.cc

Issue 914693002: Push API: Fix unsubscribing from GCM on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Now compiles and passes tests (and uses CHECK_EQ) Created 5 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: chrome/browser/services/gcm/push_messaging_service_impl.cc
diff --git a/chrome/browser/services/gcm/push_messaging_service_impl.cc b/chrome/browser/services/gcm/push_messaging_service_impl.cc
index e8d111b8b44e77a8d4e09857a9b96f6732ecea55..7e7afac7fe32375252bb26a0911183636222d6d7 100644
--- a/chrome/browser/services/gcm/push_messaging_service_impl.cc
+++ b/chrome/browser/services/gcm/push_messaging_service_impl.cc
@@ -198,7 +198,7 @@ void PushMessagingServiceImpl::OnMessage(
// |origin| may have lost push permission. Unregister and drop this message.
if (!HasPermission(application_id.origin)) {
- Unregister(application_id, UnregisterCallback());
+ Unregister(application_id, message.sender_id, UnregisterCallback());
return;
}
@@ -248,7 +248,7 @@ void PushMessagingServiceImpl::DeliverMessageCallback(
case content::PUSH_DELIVERY_STATUS_SERVICE_WORKER_ERROR:
break;
case content::PUSH_DELIVERY_STATUS_NO_SERVICE_WORKER:
- Unregister(application_id, UnregisterCallback());
+ Unregister(application_id, message.sender_id, UnregisterCallback());
break;
}
}
@@ -580,6 +580,7 @@ void PushMessagingServiceImpl::DidRequestPermission(
void PushMessagingServiceImpl::Unregister(
const GURL& requesting_origin,
int64 service_worker_registration_id,
+ const std::string& sender_id,
const content::PushMessagingService::UnregisterCallback& callback) {
DCHECK(gcm_profile_service_->driver());
@@ -587,16 +588,18 @@ void PushMessagingServiceImpl::Unregister(
requesting_origin, service_worker_registration_id);
DCHECK(application_id.IsValid());
- Unregister(application_id, callback);
+ Unregister(application_id, sender_id, callback);
}
void PushMessagingServiceImpl::Unregister(
const PushMessagingApplicationId& application_id,
+ const std::string& sender_id,
const content::PushMessagingService::UnregisterCallback& callback) {
DCHECK(gcm_profile_service_->driver());
gcm_profile_service_->driver()->Unregister(
application_id.ToString(),
+ std::vector<std::string>(1, sender_id),
base::Bind(&PushMessagingServiceImpl::DidUnregister,
weak_factory_.GetWeakPtr(), callback));
}

Powered by Google App Engine
This is Rietveld 408576698