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

Unified Diff: chrome/browser/notifications/notification_platform_bridge_android.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: chrome/browser/notifications/notification_platform_bridge_android.cc
diff --git a/chrome/browser/notifications/notification_platform_bridge_android.cc b/chrome/browser/notifications/notification_platform_bridge_android.cc
index 8fc3e89530fa36340f668df7df1343ca455f1c55..4261433520eb7502db97d714839430e8962239bb 100644
--- a/chrome/browser/notifications/notification_platform_bridge_android.cc
+++ b/chrome/browser/notifications/notification_platform_bridge_android.cc
@@ -182,21 +182,24 @@ void NotificationPlatformBridgeAndroid::Display(
DCHECK_EQ(notification_type, NotificationCommon::PERSISTENT);
GURL origin_url(notification.origin_url().GetOrigin());
-
- ScopedJavaLocalRef<jstring> origin =
- ConvertUTF8ToJavaString(env, origin_url.spec());
-
ScopedJavaLocalRef<jstring> webapk_package;
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableWebApk)) {
+ GURL scope_url(notification.service_worker_scope());
+ if (!scope_url.is_valid())
+ scope_url = origin_url;
+ ScopedJavaLocalRef<jstring> j_scope_url =
+ ConvertUTF8ToJavaString(env, scope_url.spec());
webapk_package = Java_NotificationPlatformBridge_queryWebApkPackage(
- env, java_object_.obj(), origin.obj());
+ env, java_object_.obj(), j_scope_url.obj());
} else {
webapk_package = ConvertUTF8ToJavaString(env, "");
}
ScopedJavaLocalRef<jstring> j_notification_id =
ConvertUTF8ToJavaString(env, notification_id);
+ ScopedJavaLocalRef<jstring> j_origin =
+ ConvertUTF8ToJavaString(env, origin_url.spec());
ScopedJavaLocalRef<jstring> tag =
ConvertUTF8ToJavaString(env, notification.tag());
ScopedJavaLocalRef<jstring> title =
@@ -230,7 +233,7 @@ void NotificationPlatformBridgeAndroid::Display(
ConvertUTF8ToJavaString(env, profile_id);
Java_NotificationPlatformBridge_displayNotification(
- env, java_object_.obj(), j_notification_id.obj(), origin.obj(),
+ env, java_object_.obj(), j_notification_id.obj(), j_origin.obj(),
j_profile_id.obj(), incognito, tag.obj(), webapk_package.obj(),
title.obj(), body.obj(), notification_icon.obj(), badge.obj(),
vibration_pattern.obj(), notification.timestamp().ToJavaTime(),
« no previous file with comments | « chrome/browser/notifications/notification.cc ('k') | chrome/browser/notifications/platform_notification_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698