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

Side by Side Diff: background.js

Issue 5251132066627584: Issue 1488 - Add pre-configurable preference to suppress first run page (Closed)
Patch Set: Don't dispatch onChanged before loading is complete Created March 20, 2015, 4:13 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 | chrome/managed-storage-schema.json » ('j') | lib/prefs.js » ('J')
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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // The "Hide placeholders" option has been removed from the UI in 1.8.8.1285 91 // The "Hide placeholders" option has been removed from the UI in 1.8.8.1285
92 // So we reset the option for users updating from older versions. 92 // So we reset the option for users updating from older versions.
93 if (previousVersion && Services.vc.compare(previousVersion, "1.8.8.1285") < 0) 93 if (previousVersion && Services.vc.compare(previousVersion, "1.8.8.1285") < 0)
94 Prefs.hidePlaceholders = true; 94 Prefs.hidePlaceholders = true;
95 95
96 // Chrome on Linux does not fully support chrome.notifications until version 35 96 // Chrome on Linux does not fully support chrome.notifications until version 35
97 // https://code.google.com/p/chromium/issues/detail?id=291485 97 // https://code.google.com/p/chromium/issues/detail?id=291485
98 if (info.platform == "chromium" && "notifications" in chrome && 98 if (info.platform == "chromium" && "notifications" in chrome &&
99 (navigator.platform.indexOf("Linux") == -1 || 99 (navigator.platform.indexOf("Linux") == -1 ||
100 Services.vc.compare(info.applicationVersion, "35") >= 0)) 100 Services.vc.compare(info.applicationVersion, "35") >= 0))
101 initChromeNotifications(); 101 initChromeNotifications();
kzar 2015/04/08 13:55:45 Nit: IMHO should be a newline between initChromeNo
Sebastian Noack 2015/04/08 15:11:20 Well, this code belongs together. So I'd prefer to
kzar 2015/04/09 10:12:10 No they don't, well not right together at least. T
Sebastian Noack 2015/04/09 10:34:29 Again, those lines aren't even remotely related to
Wladimir Palant 2015/04/09 18:32:42 While I agree that a newline might improve code re
Wladimir Palant 2015/04/09 18:32:42 While I agree that a newline might improve code re
102 initAntiAdblockNotification(); 102 initAntiAdblockNotification();
103 103
104 // Update browser actions and context menus when whitelisting might have 104 // Update browser actions and context menus when whitelisting might have
105 // changed. That is now when initally loading the filters and later when 105 // changed. That is now when initally loading the filters and later when
106 // importing backups or saving filter changes. 106 // importing backups or saving filter changes.
107 FilterNotifier.addListener(function(action) 107 FilterNotifier.addListener(function(action)
108 { 108 {
109 if (action == "load" || action == "save") 109 if (action == "load" || action == "save")
110 refreshIconAndContextMenuForAllPages(); 110 refreshIconAndContextMenuForAllPages();
111 }); 111 });
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 if (subscription instanceof DownloadableSubscription && !subscription.last Download) 235 if (subscription instanceof DownloadableSubscription && !subscription.last Download)
236 Synchronizer.execute(subscription); 236 Synchronizer.execute(subscription);
237 } 237 }
238 } 238 }
239 239
240 if (!addSubscription && !addAcceptable) 240 if (!addSubscription && !addAcceptable)
241 return; 241 return;
242 242
243 function notifyUser() 243 function notifyUser()
244 { 244 {
245 ext.pages.open(ext.getURL("firstRun.html")); 245 if (!Prefs.suppress_first_run_page)
246 ext.pages.open(ext.getURL("firstRun.html"));
246 } 247 }
247 248
248 if (addSubscription) 249 if (addSubscription)
249 { 250 {
250 // Load subscriptions data 251 // Load subscriptions data
251 var request = new XMLHttpRequest(); 252 var request = new XMLHttpRequest();
252 request.open("GET", "subscriptions.xml"); 253 request.open("GET", "subscriptions.xml");
253 request.addEventListener("load", function() 254 request.addEventListener("load", function()
254 { 255 {
255 var node = Utils.chooseFilterSubscription(request.responseXML.getElementsB yTagName("subscription")); 256 var node = Utils.chooseFilterSubscription(request.responseXML.getElementsB yTagName("subscription"));
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 page.sendMessage({type: "clickhide-deactivate"}); 606 page.sendMessage({type: "clickhide-deactivate"});
606 refreshIconAndContextMenu(page); 607 refreshIconAndContextMenu(page);
607 }); 608 });
608 609
609 setTimeout(function() 610 setTimeout(function()
610 { 611 {
611 var notificationToShow = NotificationStorage.getNextToShow(); 612 var notificationToShow = NotificationStorage.getNextToShow();
612 if (notificationToShow) 613 if (notificationToShow)
613 showNotification(notificationToShow); 614 showNotification(notificationToShow);
614 }, 3 * 60 * 1000); 615 }, 3 * 60 * 1000);
OLDNEW
« no previous file with comments | « no previous file | chrome/managed-storage-schema.json » ('j') | lib/prefs.js » ('J')

Powered by Google App Engine
This is Rietveld