Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/notificationHelper.js

Issue 29371739: Issue 4722 - Remove old check for Chrome notification API (Closed)
Patch Set: Remove chrome check Created Jan. 16, 2017, 1:49 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 15 matching lines...) Expand all
26 26
27 let activeNotification = null; 27 let activeNotification = null;
28 let activeButtons = null; 28 let activeButtons = null;
29 let defaultDisplayMethods = ["popup"]; 29 let defaultDisplayMethods = ["popup"];
30 let displayMethods = Object.create(null); 30 let displayMethods = Object.create(null);
31 displayMethods.critical = ["icon", "notification", "popup"]; 31 displayMethods.critical = ["icon", "notification", "popup"];
32 displayMethods.question = ["notification"]; 32 displayMethods.question = ["notification"];
33 displayMethods.normal = ["notification"]; 33 displayMethods.normal = ["notification"];
34 displayMethods.information = ["icon", "popup"]; 34 displayMethods.information = ["icon", "popup"];
35 35
36 // Chrome on Linux does not fully support chrome.notifications until version 35 36 let canUseChromeNotifications = "notifications" in chrome;
Sebastian Noack 2017/01/16 14:08:28 How about inlining this check, now. It isn't any m
kzar 2017/01/16 14:28:42 Done.
37 // https://code.google.com/p/chromium/issues/detail?id=291485
38 let canUseChromeNotifications = (function()
39 {
40 let info = require("info");
41 if (info.platform == "chromium" && "notifications" in chrome)
42 {
43 if (navigator.platform.indexOf("Linux") == -1)
44 return true;
45 if (Services.vc.compare(info.applicationVersion, "35") >= 0)
46 return true;
47 }
48 return false;
49 })();
50 37
51 function prepareNotificationIconAndPopup() 38 function prepareNotificationIconAndPopup()
52 { 39 {
53 let animateIcon = shouldDisplay("icon", activeNotification.type); 40 let animateIcon = shouldDisplay("icon", activeNotification.type);
54 activeNotification.onClicked = function() 41 activeNotification.onClicked = function()
55 { 42 {
56 if (animateIcon) 43 if (animateIcon)
57 stopIconAnimation(); 44 stopIconAnimation();
58 notificationClosed(); 45 notificationClosed();
59 }; 46 };
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 let methods = displayMethods[notificationType] || defaultDisplayMethods; 262 let methods = displayMethods[notificationType] || defaultDisplayMethods;
276 return methods.indexOf(method) > -1; 263 return methods.indexOf(method) > -1;
277 }; 264 };
278 265
279 ext.pages.onLoading.addListener(page => 266 ext.pages.onLoading.addListener(page =>
280 { 267 {
281 NotificationStorage.showNext(stringifyURL(page.url)); 268 NotificationStorage.showNext(stringifyURL(page.url));
282 }); 269 });
283 270
284 NotificationStorage.addShowListener(showNotification); 271 NotificationStorage.addShowListener(showNotification);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld