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

Side by Side Diff: lib/browserAction.js

Issue 29536764: Issue 5587, 5748 - Use mobile options page on Firefox for Android (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Use runtime.openOptionsPage on Firefox 57+ Created Sept. 12, 2017, 12: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 | « ext/background.js ('k') | metadata.chrome » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 /** @module browserAction */
19
20 "use strict";
21
22 const {getDecodedHostname} = require("url");
23 const {checkWhitelisted} = require("whitelisting");
24
25 // On Firefox for Android, open the options page directly when the browser
26 // action is clicked.
27 chrome.browserAction.onClicked.addListener(() =>
28 {
29 ext.pages.query({active: true, lastFocusedWindow: true}, pages =>
30 {
31 let currentPage = pages[0];
32
33 ext.showOptions(optionsPage =>
34 {
35 if (!["http:", "https:"].includes(currentPage.url.protocol))
36 return;
37
38 optionsPage.sendMessage({
39 type: "app.respond",
40 action: "showPageOptions",
41 args: [
42 {
43 host: getDecodedHostname(currentPage.url).replace(/^www\./, ""),
44 whitelisted: !!checkWhitelisted(currentPage)
45 }
46 ]
47 });
48 });
49 });
50 });
OLDNEW
« no previous file with comments | « ext/background.js ('k') | metadata.chrome » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld