OLD | NEW |
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 19 matching lines...) Expand all Loading... |
30 displayMethods.critical = ["icon", "notification", "popup"]; | 30 displayMethods.critical = ["icon", "notification", "popup"]; |
31 displayMethods.question = ["notification"]; | 31 displayMethods.question = ["notification"]; |
32 displayMethods.normal = ["notification"]; | 32 displayMethods.normal = ["notification"]; |
33 displayMethods.information = ["icon", "popup"]; | 33 displayMethods.information = ["icon", "popup"]; |
34 | 34 |
35 // Chrome on Linux does not fully support chrome.notifications until version 35 | 35 // Chrome on Linux does not fully support chrome.notifications until version 35 |
36 // https://code.google.com/p/chromium/issues/detail?id=291485 | 36 // https://code.google.com/p/chromium/issues/detail?id=291485 |
37 let canUseChromeNotifications = (function() | 37 let canUseChromeNotifications = (function() |
38 { | 38 { |
39 let info = require("info"); | 39 let info = require("info"); |
40 if (info.platform == "chromium" && "notifications" in chrome) | 40 if (typeof chrome == "object" && "notifications" in chrome) |
41 { | 41 { |
42 if (navigator.platform.indexOf("Linux") == -1) | 42 if (navigator.platform.indexOf("Linux") == -1) |
43 return true; | 43 return true; |
44 if (Services.vc.compare(info.applicationVersion, "35") >= 0) | 44 if (Services.vc.compare(info.applicationVersion, "35") >= 0) |
45 return true; | 45 return true; |
46 } | 46 } |
47 return false; | 47 return false; |
48 })(); | 48 })(); |
49 | 49 |
50 function prepareNotificationIconAndPopup() | 50 function prepareNotificationIconAndPopup() |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 * @param {string} notificationType | 275 * @param {string} notificationType |
276 * @return {boolean} | 276 * @return {boolean} |
277 */ | 277 */ |
278 exports.shouldDisplay = function(method, notificationType) | 278 exports.shouldDisplay = function(method, notificationType) |
279 { | 279 { |
280 let methods = displayMethods[notificationType] || defaultDisplayMethods; | 280 let methods = displayMethods[notificationType] || defaultDisplayMethods; |
281 return methods.indexOf(method) > -1; | 281 return methods.indexOf(method) > -1; |
282 }; | 282 }; |
283 | 283 |
284 NotificationStorage.addShowListener(showNotification); | 284 NotificationStorage.addShowListener(showNotification); |
OLD | NEW |