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

Unified Diff: Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp

Issue 1226613002: [WIP] Implement sound attr in notification Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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: Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp
diff --git a/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp b/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp
index 9b1da2f0d7ec9461c7f9d9284534d0f288aa0c06..f3de3231510b95c68b30d6feee7e0e36e54f637a 100644
--- a/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp
+++ b/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp
@@ -92,9 +92,16 @@ ScriptPromise ServiceWorkerRegistrationNotifications::showNotification(ScriptSta
iconUrl = KURL();
}
+ KURL soundUrl;
+ if (options.hasSound() && !options.sound().isEmpty()) {
+ soundUrl = executionContext->completeURL(options.sound());
+ if (!soundUrl.isValid())
+ soundUrl = KURL();
+ }
+
WebNotificationData::Direction dir = options.dir() == "rtl" ? WebNotificationData::DirectionRightToLeft : WebNotificationData::DirectionLeftToRight;
NavigatorVibration::VibrationPattern vibrate = NavigatorVibration::sanitizeVibrationPattern(options.vibrate());
- WebNotificationData notification(title, dir, options.lang(), options.body(), options.tag(), iconUrl, vibrate, options.silent(), dataAsWireBytes);
+ WebNotificationData notification(title, dir, options.lang(), options.body(), options.tag(), iconUrl, soundUrl, vibrate, options.silent(), dataAsWireBytes);
WebNotificationShowCallbacks* callbacks = new CallbackPromiseAdapter<void, void>(resolver);
SecurityOrigin* origin = executionContext->securityOrigin();
« no previous file with comments | « Source/modules/notifications/NotificationOptions.idl ('k') | public/platform/modules/notifications/WebNotificationData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698