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

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

Issue 2473813002: Notify GCMAppHandlers when the store is reset, so they clear cached IDs (Closed)
Patch Set: Update Cryptauth comment Created 4 years, 1 month 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.cc
diff --git a/chrome/browser/push_messaging/push_messaging_service_impl.cc b/chrome/browser/push_messaging/push_messaging_service_impl.cc
index 01be33903bd19535549242edf370a773f88fc19c..11c16f159f3b26278880eeffc71a63d486eb2cd8 100644
--- a/chrome/browser/push_messaging/push_messaging_service_impl.cc
+++ b/chrome/browser/push_messaging/push_messaging_service_impl.cc
@@ -252,6 +252,19 @@ void PushMessagingServiceImpl::ShutdownHandler() {
NOTREACHED();
}
+void PushMessagingServiceImpl::OnStoreReset() {
+ // Delete all cached subscriptions, since they are now invalid.
+ for (const auto& identifier : PushMessagingAppIdentifier::GetAll(profile_)) {
+ // Clear all the subscriptions in parallel, to reduce risk that shutdown
+ // occurs before we finish clearing them.
+ ClearPushSubscriptionId(profile_, identifier.origin(),
+ identifier.service_worker_registration_id(),
+ base::Bind(&base::DoNothing));
+ // TODO(johnme): Fire pushsubscriptionchange/pushsubscriptionlost SW event.
+ }
+ PushMessagingAppIdentifier::DeleteAllFromPrefs(profile_);
+}
+
// OnMessage methods -----------------------------------------------------------
void PushMessagingServiceImpl::OnMessage(const std::string& app_id,
« no previous file with comments | « chrome/browser/push_messaging/push_messaging_service_impl.h ('k') | components/gcm_driver/default_gcm_app_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698