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

Unified Diff: chrome/common/extensions/docs/examples/api/notifications/background.js

Issue 418173006: extensions: Migrate other uses of webkitNotifications to Web Notifications API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 6 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
« no previous file with comments | « no previous file | chrome/common/extensions/docs/examples/extensions/irc/servlet/index.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/examples/api/notifications/background.js
diff --git a/chrome/common/extensions/docs/examples/api/notifications/background.js b/chrome/common/extensions/docs/examples/api/notifications/background.js
index 646063ee9c6b9e35582ca6de563469f19317cf2f..cbe9d53d6d66d0c6b9713e0d5a05a25846c6c1b1 100644
--- a/chrome/common/extensions/docs/examples/api/notifications/background.js
+++ b/chrome/common/extensions/docs/examples/api/notifications/background.js
@@ -5,18 +5,16 @@
/*
Displays a notification with the current time. Requires "notifications"
permission in the manifest file (or calling
- "webkitNotifications.requestPermission" beforehand).
+ "Notification.requestPermission" beforehand).
*/
function show() {
var time = /(..)(:..)/.exec(new Date()); // The prettyprinted time.
var hour = time[1] % 12 || 12; // The prettyprinted hour.
var period = time[1] < 12 ? 'a.m.' : 'p.m.'; // The period of the day.
- var notification = window.webkitNotifications.createNotification(
- '48.png', // The image.
- hour + time[2] + ' ' + period, // The title.
- 'Time to make the toast.' // The body.
- );
- notification.show();
+ new Notification(hour + time[2] + ' ' + period, {
+ icon: '48.png',
+ body: 'Time to make the toast.'
+ });
}
// Conditionally initialize the options.
@@ -27,7 +25,7 @@ if (!localStorage.isInitialized) {
}
// Test for notification support.
-if (window.webkitNotifications) {
+if (window.Notification) {
// While activated, show notifications at the display frequency.
if (JSON.parse(localStorage.isActivated)) { show(); }
« no previous file with comments | « no previous file | chrome/common/extensions/docs/examples/extensions/irc/servlet/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698