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

Delta Between Two Patch Sets: lib/notificationHelper.js

Issue 6063199216467968: Issue 2642 - Moved notifications code to separate module (Closed)
Left Patch Set: Moved intilization code into module Created June 4, 2015, 9:35 p.m.
Right Patch Set: Fixed typo in comment Created June 5, 2015, 2:06 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « background.js ('k') | metadata.common » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17
18 /** @module notificationHelper */
17 19
18 let {startIconAnimation, stopIconAnimation} = require("icon"); 20 let {startIconAnimation, stopIconAnimation} = require("icon");
19 let {Utils} = require("utils"); 21 let {Utils} = require("utils");
20 let {Notification: NotificationStorage} = require("notification"); 22 let {Notification: NotificationStorage} = require("notification");
21 let {stringifyURL} = require("url"); 23 let {stringifyURL} = require("url");
22 let {initAntiAdblockNotification} = require("antiadblockInit"); 24 let {initAntiAdblockNotification} = require("antiadblockInit");
23 25
24 let activeNotification = null; 26 let activeNotification = null;
25 27
26 // Chrome on Linux does not fully support chrome.notifications until version 35 28 // Chrome on Linux does not fully support chrome.notifications until version 35
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 chrome.notifications.onButtonClicked.addListener(function(notificationId, butt onIndex) 123 chrome.notifications.onButtonClicked.addListener(function(notificationId, butt onIndex)
122 { 124 {
123 notificationButtonClick(buttonIndex); 125 notificationButtonClick(buttonIndex);
124 clearActiveNotification(notificationId); 126 clearActiveNotification(notificationId);
125 }); 127 });
126 chrome.notifications.onClicked.addListener(clearActiveNotification); 128 chrome.notifications.onClicked.addListener(clearActiveNotification);
127 chrome.notifications.onClosed.addListener(notificationClosed); 129 chrome.notifications.onClosed.addListener(notificationClosed);
128 } 130 }
129 131
130 /** 132 /**
131 * Initilizes the notification system. 133 * Initializes the notification system.
Thomas Greiner 2015/06/05 13:50:52 Replace "Initilizes" with "Initializes"
Sebastian Noack 2015/06/05 14:06:13 Done.
132 */ 134 */
133 exports.initNotifications = function() 135 exports.initNotifications = function()
134 { 136 {
135 if (canUseChromeNotifications) 137 if (canUseChromeNotifications)
136 initChromeNotifications(); 138 initChromeNotifications();
137 initAntiAdblockNotification(); 139 initAntiAdblockNotification();
138 }; 140 };
139 141
140 let showNextNotification = 142 let showNextNotification =
141 /** 143 /**
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 if (activeNotification.type == "question") 220 if (activeNotification.type == "question")
219 notificationButtonClick(approved ? 0 : 1); 221 notificationButtonClick(approved ? 0 : 1);
220 else if (approved) 222 else if (approved)
221 openNotificationLinks(); 223 openNotificationLinks();
222 } 224 }
223 } 225 }
224 prepareNotificationIconAndPopup(); 226 prepareNotificationIconAndPopup();
225 }; 227 };
226 228
227 setTimeout(showNextNotification, 3 * 60 * 1000); 229 setTimeout(showNextNotification, 3 * 60 * 1000);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld