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

Unified Diff: chrome/common/extensions/docs/examples/extensions/irc/servlet/index.html

Issue 418173006: extensions: Migrate other uses of webkitNotifications to Web Notifications API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
Index: chrome/common/extensions/docs/examples/extensions/irc/servlet/index.html
diff --git a/chrome/common/extensions/docs/examples/extensions/irc/servlet/index.html b/chrome/common/extensions/docs/examples/extensions/irc/servlet/index.html
index 17fb215baaa11da3be9f64f646a5a35fae86f23b..8b0d43ddb6786992003feb4d8cd91e40a4b06121 100644
--- a/chrome/common/extensions/docs/examples/extensions/irc/servlet/index.html
+++ b/chrome/common/extensions/docs/examples/extensions/irc/servlet/index.html
@@ -327,28 +327,24 @@ function checkForNickReference(server, channel, nick, message) {
}
// Notifications will be enabled by the app install. Otherwise, don't notity.
- if (window.webkitNotifications.checkPermission() != 0) {
+ if (Notification.permission == "denied") {
Peter Beverloo 2014/08/01 08:46:06 It's possible for |permission| to be "default" her
tfarina 2014/08/02 00:54:05 Done.
return;
}
-
+
// Remove a previous notification from the same channel. Show the newer one.
if (notifications[server.name + channel]) {
- notifications[server.name + channel].cancel();
+ notifications[server.name + channel].close();
}
- var title = "On " + server.name + channel;
- var icon = "http://www.google.com/favicon.ico";
- var text = nick + ": " + message;
- var url = location.protocol + "//" + location.host + "/notification.html";
- url += "?title=" + encodeURIComponent(title) +
- "&content=" + encodeURIComponent(text);
+ var n = new Notification("On " + server.name + changel, {
Peter Beverloo 2014/08/01 08:46:06 s/changel/channel/
tfarina 2014/08/02 00:54:05 Done.
+ icon: "http://www.google.com/favicon.icon",
Peter Beverloo 2014/08/01 08:46:06 That file doesn't actually exist :-). Not your bad
tfarina 2014/08/02 00:54:06 Done.
+ body: nick + ": " + message,
+ });
- var n = window.webkitNotifications.createHTMLNotification(url);
- n.ondisplay = function() {};
+ n.onshow = function() {};
not at google - send to devlin 2014/08/01 16:52:29 do you need to set this?
Peter Beverloo 2014/08/01 16:53:34 I figured that it's for demonstrative purposes giv
not at google - send to devlin 2014/08/01 16:59:51 Good point. Leaving it in SGTM.
tfarina 2014/08/02 00:54:06 Done.
n.onclose = function() {
delete notifications[server.name + channel];
};
- n.show();
notifications[server.name + channel] = n;
}

Powered by Google App Engine
This is Rietveld 408576698