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

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

Issue 1816123002: Add testing for subscription from service workers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix asan errors Created 4 years, 9 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 093400854fe0515a5980c3546a4da03fa4a491ea..9390a0673d8c18c87391baa3cab57106b013dc2f 100644
--- a/content/browser/push_messaging/push_messaging_message_filter.cc
+++ b/content/browser/push_messaging/push_messaging_message_filter.cc
@@ -298,9 +298,17 @@ void PushMessagingMessageFilter::OnSubscribeFromWorker(
}
data.requesting_origin = service_worker_registration->pattern().GetOrigin();
- // If there is a sender_info in the subscription options, it will be used,
- // otherwise the registration sender_info will be used.
- CheckForExistingRegistration(data, options);
+ if (!options.sender_info.empty()) {
+ service_worker_context_->StoreRegistrationUserData(
+ service_worker_registration_id, data.requesting_origin,
+ kPushSenderIdServiceWorkerKey, options.sender_info,
+ base::Bind(&PushMessagingMessageFilter::DidPersistSenderInfo,
+ weak_factory_io_to_io_.GetWeakPtr(), data, options));
+ } else {
+ // If there is a sender_info in the subscription options, it will be used,
+ // otherwise the registration sender_info will be used.
+ CheckForExistingRegistration(data, options);
+ }
}
void PushMessagingMessageFilter::DidPersistSenderInfo(
« no previous file with comments | « chrome/test/data/push_messaging/test_no_subscription_options.html ('k') | content/child/push_messaging/push_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698