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

Side by Side Diff: lib/options.js

Issue 29569615: Noissue - Replace ext.pages.query with tabs.query (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created Oct. 8, 2017, 11: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 | « lib/icon.js ('k') | lib/stats.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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 returnShowOptionsCall(optionsTab, callback); 121 returnShowOptionsCall(optionsTab, callback);
122 }); 122 });
123 } 123 }
124 }); 124 });
125 }; 125 };
126 126
127 // On Firefox for Android, open the options page directly when the browser 127 // On Firefox for Android, open the options page directly when the browser
128 // action is clicked. 128 // action is clicked.
129 chrome.browserAction.onClicked.addListener(() => 129 chrome.browserAction.onClicked.addListener(() =>
130 { 130 {
131 ext.pages.query({active: true, lastFocusedWindow: true}, pages => 131 chrome.tabs.query({active: true, lastFocusedWindow: true}, ([tab]) =>
132 { 132 {
133 let currentPage = pages[0]; 133 let currentPage = new ext.Page(tab);
134 134
135 showOptions(optionsPage => 135 showOptions(optionsPage =>
136 { 136 {
137 if (!/^https?:$/.test(currentPage.url.protocol)) 137 if (!/^https?:$/.test(currentPage.url.protocol))
138 return; 138 return;
139 139
140 optionsPage.sendMessage({ 140 optionsPage.sendMessage({
141 type: "app.respond", 141 type: "app.respond",
142 action: "showPageOptions", 142 action: "showPageOptions",
143 args: [ 143 args: [
144 { 144 {
145 host: getDecodedHostname(currentPage.url).replace(/^www\./, ""), 145 host: getDecodedHostname(currentPage.url).replace(/^www\./, ""),
146 whitelisted: !!checkWhitelisted(currentPage) 146 whitelisted: !!checkWhitelisted(currentPage)
147 } 147 }
148 ] 148 ]
149 }); 149 });
150 }); 150 });
151 }); 151 });
152 }); 152 });
OLDNEW
« no previous file with comments | « lib/icon.js ('k') | lib/stats.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld