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

Unified Diff: content/browser/notifications/notification_message_filter.cc

Issue 2151993002: [WebAPKs] Plumb service worker scope to notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into notification_scope Created 4 years, 5 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/notifications/notification_message_filter.cc
diff --git a/content/browser/notifications/notification_message_filter.cc b/content/browser/notifications/notification_message_filter.cc
index d522e75f7d54a3c98f5fc561aad7f0828ab5368a..5a694c883ae9103d47a0b52f66e1d993dbdc3f89 100644
--- a/content/browser/notifications/notification_message_filter.cc
+++ b/content/browser/notifications/notification_message_filter.cc
@@ -153,29 +153,27 @@ void NotificationMessageFilter::OnShowPlatformNotification(
}
void NotificationMessageFilter::OnShowPersistentNotification(
- int request_id,
- int64_t service_worker_registration_id,
- const GURL& origin,
- const PlatformNotificationData& notification_data,
- const NotificationResources& notification_resources) {
+ const PlatformNotificationHostMsg_ShowPersistent_Params& params) {
Peter Beverloo 2016/07/15 13:40:11 I don't think you have to make this change. Inste
DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ GURL origin = params.origin;
if (GetPermissionForOriginOnIO(origin) !=
blink::mojom::PermissionStatus::GRANTED) {
bad_message::ReceivedBadMessage(this, bad_message::NMF_NO_PERMISSION_SHOW);
return;
}
- if (!ValidateNotificationResources(notification_resources)) {
+ if (!ValidateNotificationResources(params.notification_resources)) {
bad_message::ReceivedBadMessage(this, bad_message::NMF_INVALID_ARGUMENT);
return;
}
NotificationDatabaseData database_data;
database_data.origin = origin;
- database_data.service_worker_registration_id = service_worker_registration_id;
+ database_data.service_worker_registration_id =
+ params.service_worker_registration_id;
PlatformNotificationData sanitized_notification_data =
- SanitizeNotificationData(notification_data);
+ SanitizeNotificationData(params.notification_data);
database_data.notification_data = sanitized_notification_data;
// TODO(peter): Significantly reduce the amount of information we need to
@@ -183,12 +181,14 @@ void NotificationMessageFilter::OnShowPersistentNotification(
notification_context_->WriteNotificationData(
origin, database_data,
base::Bind(&NotificationMessageFilter::DidWritePersistentNotificationData,
- weak_factory_io_.GetWeakPtr(), request_id, origin,
- sanitized_notification_data, notification_resources));
+ weak_factory_io_.GetWeakPtr(), params.request_id,
+ params.service_worker_scope, origin,
+ sanitized_notification_data, params.notification_resources));
}
void NotificationMessageFilter::DidWritePersistentNotificationData(
int request_id,
+ const GURL& service_worker_scope,
const GURL& origin,
const PlatformNotificationData& notification_data,
const NotificationResources& notification_resources,
@@ -205,8 +205,9 @@ void NotificationMessageFilter::DidWritePersistentNotificationData(
BrowserThread::UI, FROM_HERE,
base::Bind(&PlatformNotificationService::DisplayPersistentNotification,
base::Unretained(service), // The service is a singleton.
- browser_context_, persistent_notification_id, origin,
- notification_data, notification_resources));
+ browser_context_, persistent_notification_id,
+ service_worker_scope, origin, notification_data,
+ notification_resources));
}
Send(new PlatformNotificationMsg_DidShowPersistent(request_id, success));

Powered by Google App Engine
This is Rietveld 408576698