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

Side by Side Diff: lib/notificationHelper.js

Issue 29567798: Noissue - Replace ext.pages.open with tabs.create (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created Oct. 6, 2017, 3:16 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 | lib/subscriptionInit.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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 98 }
99 99
100 return buttons; 100 return buttons;
101 } 101 }
102 102
103 function openNotificationLinks() 103 function openNotificationLinks()
104 { 104 {
105 if (activeNotification.links) 105 if (activeNotification.links)
106 { 106 {
107 for (let link of activeNotification.links) 107 for (let link of activeNotification.links)
108 ext.pages.open(Utils.getDocLink(link)); 108 chrome.tabs.create({url: Utils.getDocLink(link)});
109 } 109 }
110 } 110 }
111 111
112 function notificationButtonClick(buttonIndex) 112 function notificationButtonClick(buttonIndex)
113 { 113 {
114 if (!(activeButtons && buttonIndex in activeButtons)) 114 if (!(activeButtons && buttonIndex in activeButtons))
115 return; 115 return;
116 116
117 switch (activeButtons[buttonIndex].type) 117 switch (activeButtons[buttonIndex].type)
118 { 118 {
119 case "link": 119 case "link":
120 ext.pages.open(Utils.getDocLink(activeNotification.links[buttonIndex])); 120 chrome.tabs.create({
121 url: Utils.getDocLink(activeNotification.links[buttonIndex])
122 });
121 break; 123 break;
122 case "open-all": 124 case "open-all":
123 openNotificationLinks(); 125 openNotificationLinks();
124 break; 126 break;
125 case "configure": 127 case "configure":
126 Prefs.notifications_showui = true; 128 Prefs.notifications_showui = true;
127 showOptions(page => 129 showOptions(page =>
128 { 130 {
129 page.sendMessage({ 131 page.sendMessage({
130 type: "app.respond", 132 type: "app.respond",
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 let methods = displayMethods[notificationType] || defaultDisplayMethods; 275 let methods = displayMethods[notificationType] || defaultDisplayMethods;
274 return methods.includes(method); 276 return methods.includes(method);
275 }; 277 };
276 278
277 ext.pages.onLoading.addListener(page => 279 ext.pages.onLoading.addListener(page =>
278 { 280 {
279 NotificationStorage.showNext(stringifyURL(page.url)); 281 NotificationStorage.showNext(stringifyURL(page.url));
280 }); 282 });
281 283
282 NotificationStorage.addShowListener(showNotification); 284 NotificationStorage.addShowListener(showNotification);
OLDNEW
« no previous file with comments | « no previous file | lib/subscriptionInit.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld