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

Side by Side Diff: lib/notificationHelper.js

Issue 29730611: Issue 6511 - Use messaging to register popup notification clicks (Closed)
Patch Set: Updated dependency Created March 23, 2018, 4:37 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 | « dependencies ('k') | popup.js » ('j') | 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-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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 case "link": 119 case "link":
120 browser.tabs.create({ 120 browser.tabs.create({
121 url: Utils.getDocLink(activeNotification.links[buttonIndex]) 121 url: Utils.getDocLink(activeNotification.links[buttonIndex])
122 }); 122 });
123 break; 123 break;
124 case "open-all": 124 case "open-all":
125 openNotificationLinks(); 125 openNotificationLinks();
126 break; 126 break;
127 case "configure": 127 case "configure":
128 Prefs.notifications_showui = true; 128 Prefs.notifications_showui = true;
129 showOptions((page, port) => 129 showOptions((page, port) =>
kzar 2018/03/23 16:41:52 Due to rebase, from #6476.
130 { 130 {
131 port.postMessage({ 131 port.postMessage({
132 type: "app.respond", 132 type: "app.respond",
133 action: "focusSection", 133 action: "focusSection",
134 args: ["notifications"] 134 args: ["notifications"]
135 }); 135 });
136 }); 136 });
137 break; 137 break;
138 case "question": 138 case "question":
139 NotificationStorage.triggerQuestionListeners(activeNotification.id, 139 NotificationStorage.triggerQuestionListeners(activeNotification.id,
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 * @param {string} method Display method: icon, notification or popup 287 * @param {string} method Display method: icon, notification or popup
288 * @param {string} notificationType 288 * @param {string} notificationType
289 * @return {boolean} 289 * @return {boolean}
290 */ 290 */
291 exports.shouldDisplay = (method, notificationType) => 291 exports.shouldDisplay = (method, notificationType) =>
292 { 292 {
293 let methods = displayMethods[notificationType] || defaultDisplayMethods; 293 let methods = displayMethods[notificationType] || defaultDisplayMethods;
294 return methods.includes(method); 294 return methods.includes(method);
295 }; 295 };
296 296
297 /**
298 * Tidies up after a notification was clicked.
299 */
300 exports.notificationClicked = () =>
301 {
302 if (activeNotification)
303 activeNotification.onClicked();
304 };
305
297 ext.pages.onLoading.addListener(page => 306 ext.pages.onLoading.addListener(page =>
298 { 307 {
299 NotificationStorage.showNext(stringifyURL(page.url)); 308 NotificationStorage.showNext(stringifyURL(page.url));
300 }); 309 });
301 310
302 NotificationStorage.addShowListener(showNotification); 311 NotificationStorage.addShowListener(showNotification);
OLDNEW
« no previous file with comments | « dependencies ('k') | popup.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld