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: Created Jan. 13, 2017, 11:27 a.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 platform = require("info").platform;
37 // https://code.google.com/p/chromium/issues/detail?id=291485 37 let canUseChromeNotifications = platform == "chromium" && "notifications" in chr ome;
Sebastian Noack 2017/01/13 11:43:23 Any reason to still check for the platform? This w
kzar 2017/01/16 04:15:37 Not really but IMO that change is for when we swit
Sebastian Noack 2017/01/16 13:39:59 Well, when we switch to the browser.* API we would
kzar 2017/01/16 13:50:22 I guess not, Done.
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 38
51 function prepareNotificationIconAndPopup() 39 function prepareNotificationIconAndPopup()
52 { 40 {
53 let animateIcon = shouldDisplay("icon", activeNotification.type); 41 let animateIcon = shouldDisplay("icon", activeNotification.type);
54 activeNotification.onClicked = function() 42 activeNotification.onClicked = function()
55 { 43 {
56 if (animateIcon) 44 if (animateIcon)
57 stopIconAnimation(); 45 stopIconAnimation();
58 notificationClosed(); 46 notificationClosed();
59 }; 47 };
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 let methods = displayMethods[notificationType] || defaultDisplayMethods; 263 let methods = displayMethods[notificationType] || defaultDisplayMethods;
276 return methods.indexOf(method) > -1; 264 return methods.indexOf(method) > -1;
277 }; 265 };
278 266
279 ext.pages.onLoading.addListener(page => 267 ext.pages.onLoading.addListener(page =>
280 { 268 {
281 NotificationStorage.showNext(stringifyURL(page.url)); 269 NotificationStorage.showNext(stringifyURL(page.url));
282 }); 270 });
283 271
284 NotificationStorage.addShowListener(showNotification); 272 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