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

Side by Side Diff: lib/appSupport.js

Issue 6286955629248512: disable acceptable ads from first run page (Closed)
Patch Set: call getAddonsByTypes method Created May 4, 2014, 1:42 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 | no next file » | 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 <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 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/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 /** 18 /**
19 * @fileOverview Various application-specific functions. 19 * @fileOverview Various application-specific functions.
20 */ 20 */
21 21
22 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); 22 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
23 Cu.import("resource://gre/modules/Services.jsm"); 23 Cu.import("resource://gre/modules/Services.jsm");
24 Cu.import("resource://gre/modules/AddonManager.jsm");
24 25
25 /** 26 /**
26 * Checks whether an application window is known and should get Adblock Plus 27 * Checks whether an application window is known and should get Adblock Plus
27 * user interface elements. 28 * user interface elements.
28 * @result Boolean 29 * @result Boolean
29 */ 30 */
30 exports.isKnownWindow = function isKnownWindow(/**Window*/ window) false; 31 exports.isKnownWindow = function isKnownWindow(/**Window*/ window) false;
31 32
32 /** 33 /**
33 * HACK: In some applications the window finishes initialization during load 34 * HACK: In some applications the window finishes initialization during load
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 menuItem = window.NativeWindow.menu.add(actionText, iconUrl, toggleWhiteli st.bind(null, window)); 910 menuItem = window.NativeWindow.menu.add(actionText, iconUrl, toggleWhiteli st.bind(null, window));
910 }; 911 };
911 912
912 UI.openSubscriptionDialog = function(window, url, title, mainURL, mainTitle) 913 UI.openSubscriptionDialog = function(window, url, title, mainURL, mainTitle)
913 { 914 {
914 let dialogTitle = this.overlay.attributes.subscriptionDialogTitle; 915 let dialogTitle = this.overlay.attributes.subscriptionDialogTitle;
915 let dialogMessage = this.overlay.attributes.subscriptionDialogMessage.repl ace(/\?1\?/, title).replace(/\?2\?/, url); 916 let dialogMessage = this.overlay.attributes.subscriptionDialogMessage.repl ace(/\?1\?/, title).replace(/\?2\?/, url);
916 if (Utils.confirm(window, dialogMessage, dialogTitle)) 917 if (Utils.confirm(window, dialogMessage, dialogTitle))
917 this.setSubscription(url, title); 918 this.setSubscription(url, title);
918 }; 919 };
920
921 UI.openFiltersDialog = function()
922 {
923 let window = UI.currentWindow;
924 if (!window)
925 return
926
927 let browser = exports.addTab(window, "about:addons").browser;
928 browser.addEventListener("load", function openAddonPrefs(event)
929 {
930 browser.removeEventListener("load", openAddonPrefs, true);
931 Utils.runAsync(function()
932 {
933 AddonManager.getAddonsByTypes(["extension", "theme", "locale"], functi on()
Wladimir Palant 2014/05/08 13:38:00 Please add a comment on why we are doing this. E.g
saroyanm 2014/05/08 14:42:11 Done.
934 {
935 let {addonID} = require("info");
936 let addonItem = browser._contentWindow.document.querySelector("#addo ns-list div[addonID='" + addonID + "']");
937 if (addonItem)
938 {
939 let event = new Event("Event");
940 event.initEvent("popstate", true, false);
941 event.state = {id: addonID};
942 browser._contentWindow.dispatchEvent(event);
943 }
944 });
945 });
946 }, true);
947 };
919 948
920 break; 949 break;
921 } 950 }
922 } 951 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld