 Issue 29570614:
  Issue 5028 - Use browser namespace  (Closed) 
  Base URL: https://hg.adblockplus.org/adblockpluschrome/
    
  
    Issue 29570614:
  Issue 5028 - Use browser namespace  (Closed) 
  Base URL: https://hg.adblockplus.org/adblockpluschrome/| Left: | ||
| Right: | 
| LEFT | RIGHT | 
|---|---|
| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 // We use the highest priority to prevent the notification | 205 // We use the highest priority to prevent the notification | 
| 206 // from closing automatically. | 206 // from closing automatically. | 
| 207 priority: 2 | 207 priority: 2 | 
| 208 }); | 208 }); | 
| 209 } | 209 } | 
| 210 else if ("Notification" in window && activeNotification.type != "question") | 210 else if ("Notification" in window && activeNotification.type != "question") | 
| 211 { | 211 { | 
| 212 if (linkCount > 0) | 212 if (linkCount > 0) | 
| 213 { | 213 { | 
| 214 message += " " + browser.i18n.getMessage( | 214 message += " " + browser.i18n.getMessage( | 
| 215 "notification_without_buttons"); | 215 "notification_without_buttons" | 
| 
kzar
2017/10/16 10:35:51
Nit: IMO it looks weird having the indentation lik
 
Manish Jethani
2017/10/16 12:17:35
Done.
 | |
| 216 ); | |
| 216 } | 217 } | 
| 217 | 218 | 
| 218 let widget = new Notification( | 219 let widget = new Notification( | 
| 219 title, | 220 title, | 
| 220 { | 221 { | 
| 221 lang: Utils.appLocale, | 222 lang: Utils.appLocale, | 
| 222 dir: Utils.readingDirection, | 223 dir: Utils.readingDirection, | 
| 223 body: message, | 224 body: message, | 
| 224 icon: iconUrl | 225 icon: iconUrl | 
| 225 } | 226 } | 
| 226 ); | 227 ); | 
| 227 | 228 | 
| 228 widget.addEventListener("click", openNotificationLinks); | 229 widget.addEventListener("click", openNotificationLinks); | 
| 229 widget.addEventListener("close", notificationClosed); | 230 widget.addEventListener("close", notificationClosed); | 
| 230 } | 231 } | 
| 231 else | 232 else | 
| 232 { | 233 { | 
| 233 message = title + "\n" + message; | 234 message = title + "\n" + message; | 
| 234 if (linkCount > 0) | 235 if (linkCount > 0) | 
| 235 { | 236 { | 
| 236 message += "\n\n" + browser.i18n.getMessage( | 237 message += "\n\n" + browser.i18n.getMessage( | 
| 237 "notification_with_buttons"); | 238 "notification_with_buttons" | 
| 239 ); | |
| 238 } | 240 } | 
| 239 | 241 | 
| 240 let approved = confirm(message); | 242 let approved = confirm(message); | 
| 241 if (activeNotification.type == "question") | 243 if (activeNotification.type == "question") | 
| 242 notificationButtonClick(approved ? 0 : 1); | 244 notificationButtonClick(approved ? 0 : 1); | 
| 243 else if (approved) | 245 else if (approved) | 
| 244 openNotificationLinks(); | 246 openNotificationLinks(); | 
| 245 } | 247 } | 
| 246 } | 248 } | 
| 247 prepareNotificationIconAndPopup(); | 249 prepareNotificationIconAndPopup(); | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 let methods = displayMethods[notificationType] || defaultDisplayMethods; | 283 let methods = displayMethods[notificationType] || defaultDisplayMethods; | 
| 282 return methods.includes(method); | 284 return methods.includes(method); | 
| 283 }; | 285 }; | 
| 284 | 286 | 
| 285 ext.pages.onLoading.addListener(page => | 287 ext.pages.onLoading.addListener(page => | 
| 286 { | 288 { | 
| 287 NotificationStorage.showNext(stringifyURL(page.url)); | 289 NotificationStorage.showNext(stringifyURL(page.url)); | 
| 288 }); | 290 }); | 
| 289 | 291 | 
| 290 NotificationStorage.addShowListener(showNotification); | 292 NotificationStorage.addShowListener(showNotification); | 
| LEFT | RIGHT |