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

Side by Side Diff: lib/notificationHelper.js

Issue 29317071: Issue 2368 - Cleanup code adapted with the previous dependency update (Closed)
Patch Set: Created June 18, 2015, 12:30 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-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
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 { 124 {
125 notificationButtonClick(buttonIndex); 125 notificationButtonClick(buttonIndex);
126 clearActiveNotification(notificationId); 126 clearActiveNotification(notificationId);
127 }); 127 });
128 chrome.notifications.onClicked.addListener(clearActiveNotification); 128 chrome.notifications.onClicked.addListener(clearActiveNotification);
129 chrome.notifications.onClosed.addListener(notificationClosed); 129 chrome.notifications.onClosed.addListener(notificationClosed);
130 } 130 }
131 131
132 function showNotification(notification) 132 function showNotification(notification)
133 { 133 {
134 if (!notification || activeNotification && activeNotification.id == notificati on.id) 134 if (activeNotification && activeNotification.id == notification.id)
135 return; 135 return;
136 136
137 activeNotification = notification; 137 activeNotification = notification;
138 if (activeNotification.type == "critical" || activeNotification.type == "quest ion") 138 if (activeNotification.type == "critical" || activeNotification.type == "quest ion")
139 { 139 {
140 let texts = NotificationStorage.getLocalizedTexts(notification); 140 let texts = NotificationStorage.getLocalizedTexts(notification);
141 let title = texts.title || ""; 141 let title = texts.title || "";
142 let message = texts.message ? texts.message.replace(/<\/?(a|strong)>/g, "") : ""; 142 let message = texts.message ? texts.message.replace(/<\/?(a|strong)>/g, "") : "";
143 let iconUrl = ext.getURL("icons/detailed/abp-128.png"); 143 let iconUrl = ext.getURL("icons/detailed/abp-128.png");
144 let hasLinks = activeNotification.links && activeNotification.links.length > 0; 144 let hasLinks = activeNotification.links && activeNotification.links.length > 0;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 /** 232 /**
233 * Gets the active notification to be shown if any. 233 * Gets the active notification to be shown if any.
234 * 234 *
235 * @return {?object} 235 * @return {?object}
236 */ 236 */
237 exports.getActiveNotification = function() 237 exports.getActiveNotification = function()
238 { 238 {
239 return activeNotification; 239 return activeNotification;
240 }; 240 };
241 241
242 NotificationStorage.addShowListener(function(notification) 242 NotificationStorage.addShowListener(showNotification);
243 {
244 showNotification(notification);
245 });
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