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: Description to getAddonsByTypes method and minore changes Created May 8, 2014, 2: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 | « 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 // The page won't be ready until the add-on manager data is loaded so we call this method
934 // to know when the data will be ready.
935 AddonManager.getAddonsByTypes(["extension", "theme", "locale"], functi on()
936 {
937 let event = new Event("Event");
938 event.initEvent("popstate", true, false);
939 event.state = {id: require("info").addonID};
940 browser._contentWindow.dispatchEvent(event);
941 });
942 });
943 }, true);
944 };
919 945
920 break; 946 break;
921 } 947 }
922 } 948 }
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