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

Unified Diff: chrome/test/data/notifications/platform_notification_service.js

Issue 784383002: Support persistent notifications in the PlatformNotificationServiceImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-chrome-base
Patch Set: add copyright header Created 6 years 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
« no previous file with comments | « chrome/test/data/notifications/platform_notification_service.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/notifications/platform_notification_service.js
diff --git a/chrome/test/data/notifications/platform_notification_service.js b/chrome/test/data/notifications/platform_notification_service.js
new file mode 100644
index 0000000000000000000000000000000000000000..77816dd5a43dcaab5f50a003ecc0cd350baee6a6
--- /dev/null
+++ b/chrome/test/data/notifications/platform_notification_service.js
@@ -0,0 +1,21 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Service Worker to be used with the platform_notification_service.html page.
+var messagePort = null;
+
+addEventListener('message', function (event) {
+ messagePort = event.data;
+ messagePort.postMessage('ready');
+});
+
+// The notificationclick event will be invoked when a persistent notification
+// has been clicked on. When this happens, the title determines whether this
+// Service Worker has to act upon this.
+addEventListener('notificationclick', function (event) {
+ if (event.notification.title == 'action_close')
+ event.notification.close();
+
+ messagePort.postMessage(event.notification.title);
+});
« no previous file with comments | « chrome/test/data/notifications/platform_notification_service.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698