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

Delta Between Two Patch Sets: lib/uninstall.js

Issue 29332492: Issue 3269 - Display uninstallation page when uninstalled (Closed)
Left Patch Set: Created Dec. 9, 2015, 3:11 p.m.
Right Patch Set: Check the API exists before using it Created Dec. 15, 2015, 11:32 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | metadata.common » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 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 uninstall */
19
20 let info = require("info");
21 let {Prefs} = require("prefs");
22 let {Utils} = require("utils");
23
24 function setUninstallURL()
25 {
26 let search = [];
27 let keys = ["addonName", "addonVersion", "application", "applicationVersion",
28 "platform", "platformVersion"];
29 for (let key of keys)
30 search.push(key + "=" + encodeURIComponent(info[key]));
31
32 let downlCount = Prefs.notificationdata.downloadCount || 0;
33 search.push("notificationDownloadCount=" + encodeURIComponent(downlCount));
34
35 chrome.runtime.setUninstallURL(Utils.getDocLink("uninstalled") + "&" +
36 search.join("&"));
37 }
38
39 function onPrefsLoaded()
40 {
41 Prefs.onLoaded.removeListener(onPrefsLoaded);
42 setUninstallURL();
43 }
44
45 // The uninstall URL contains the notification download count as a parameter,
46 // therefore we must wait for preferences to be loaded before generating the
47 // URL and we need to re-generate it each time the notification data changes.
48 if ("setUninstallURL" in chrome.runtime)
49 {
50 Prefs.onLoaded.addListener(onPrefsLoaded);
51 Prefs.onChanged.addListener(function(name)
52 {
53 if (name == "notificationdata")
54 setUninstallURL();
55 });
56 }
LEFTRIGHT
« no previous file | metadata.common » ('j') | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld