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

Side by Side Diff: desktop-options.js

Issue 29573726: Issue 4580 - Replace ext.backgroundPage.sendMessage with runtime.sendMessage (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Update dependency Created Oct. 11, 2017, 4:56 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') | ext/common.js » ('j') | ext/common.js » ('J')
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 if (paramValues.length > 0) 43 if (paramValues.length > 0)
44 { 44 {
45 let lastArg = paramValues[paramValues.length - 1]; 45 let lastArg = paramValues[paramValues.length - 1];
46 if (typeof lastArg == "function") 46 if (typeof lastArg == "function")
47 callback = lastArg; 47 callback = lastArg;
48 48
49 for (let i = 0; i < paramValues.length - (callback ? 1 : 0); i++) 49 for (let i = 0; i < paramValues.length - (callback ? 1 : 0); i++)
50 message[paramKeys[i]] = paramValues[i]; 50 message[paramKeys[i]] = paramValues[i];
51 } 51 }
52 52
53 ext.backgroundPage.sendMessage(message, callback); 53 chrome.runtime.sendMessage(message, callback);
54 }; 54 };
55 } 55 }
56 56
57 const getDocLink = wrapper({type: "app.get", what: "doclink"}, "link"); 57 const getDocLink = wrapper({type: "app.get", what: "doclink"}, "link");
58 const getInfo = wrapper({type: "app.get"}, "what"); 58 const getInfo = wrapper({type: "app.get"}, "what");
59 const getPref = wrapper({type: "prefs.get"}, "key"); 59 const getPref = wrapper({type: "prefs.get"}, "key");
60 const togglePref = wrapper({type: "prefs.toggle"}, "key"); 60 const togglePref = wrapper({type: "prefs.toggle"}, "key");
61 const getSubscriptions = wrapper({type: "subscriptions.get"}, 61 const getSubscriptions = wrapper({type: "subscriptions.get"},
62 "downloadable", "special"); 62 "downloadable", "special");
63 const removeSubscription = wrapper({type: "subscriptions.remove"}, "url"); 63 const removeSubscription = wrapper({type: "subscriptions.remove"}, "url");
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 if (!features.devToolsPanel) 154 if (!features.devToolsPanel)
155 document.getElementById("showDevtoolsPanelContainer").hidden = true; 155 document.getElementById("showDevtoolsPanelContainer").hidden = true;
156 }); 156 });
157 getPref("notifications_showui", showNotificationsUI => 157 getPref("notifications_showui", showNotificationsUI =>
158 { 158 {
159 if (!showNotificationsUI) 159 if (!showNotificationsUI)
160 document.getElementById("shouldShowNotificationsContainer").hidden = true; 160 document.getElementById("shouldShowNotificationsContainer").hidden = true;
161 }); 161 });
162 162
163 // Register listeners in the background message responder 163 // Register listeners in the background message responder
164 ext.backgroundPage.sendMessage({ 164 chrome.runtime.sendMessage({
165 type: "app.listen", 165 type: "app.listen",
166 filter: ["addSubscription", "focusSection"] 166 filter: ["addSubscription", "focusSection"]
167 }); 167 });
168 ext.backgroundPage.sendMessage({ 168 chrome.runtime.sendMessage({
169 type: "filters.listen", 169 type: "filters.listen",
170 filter: ["added", "loaded", "removed"] 170 filter: ["added", "loaded", "removed"]
171 }); 171 });
172 ext.backgroundPage.sendMessage({ 172 chrome.runtime.sendMessage({
173 type: "prefs.listen", 173 type: "prefs.listen",
174 filter: ["notifications_ignoredcategories", "notifications_showui", 174 filter: ["notifications_ignoredcategories", "notifications_showui",
175 "show_devtools_panel", "shouldShowBlockElementMenu"] 175 "show_devtools_panel", "shouldShowBlockElementMenu"]
176 }); 176 });
177 ext.backgroundPage.sendMessage({ 177 chrome.runtime.sendMessage({
178 type: "subscriptions.listen", 178 type: "subscriptions.listen",
179 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 179 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
180 "title", "downloadStatus", "downloading"] 180 "title", "downloadStatus", "downloading"]
181 }); 181 });
182 182
183 // Load recommended subscriptions 183 // Load recommended subscriptions
184 loadRecommendations(); 184 loadRecommendations();
185 185
186 // Show user's filters 186 // Show user's filters
187 reloadFilters(); 187 reloadFilters();
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 onFilterMessage(message.action, message.args[0]); 739 onFilterMessage(message.action, message.args[0]);
740 break; 740 break;
741 case "prefs.respond": 741 case "prefs.respond":
742 onPrefMessage(message.action, message.args[0]); 742 onPrefMessage(message.action, message.args[0]);
743 break; 743 break;
744 case "subscriptions.respond": 744 case "subscriptions.respond":
745 onSubscriptionMessage(message.action, message.args[0]); 745 onSubscriptionMessage(message.action, message.args[0]);
746 break; 746 break;
747 } 747 }
748 }); 748 });
OLDNEW
« no previous file with comments | « dependencies ('k') | ext/common.js » ('j') | ext/common.js » ('J')

Powered by Google App Engine
This is Rietveld