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

Delta Between Two Patch Sets: background.js

Issue 6063199216467968: Issue 2642 - Moved notifications code to separate module (Closed)
Left Patch Set: Created June 4, 2015, 9:31 p.m.
Right Patch Set: Fixed typo in comment Created June 5, 2015, 2:06 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | lib/notificationHelper.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 29 matching lines...) Expand all
40 this.isThirdParty = isThirdParty; 40 this.isThirdParty = isThirdParty;
41 this.extractHostFromFrame = extractHostFromFrame; 41 this.extractHostFromFrame = extractHostFromFrame;
42 } 42 }
43 var FilterStorage = require("filterStorage").FilterStorage; 43 var FilterStorage = require("filterStorage").FilterStorage;
44 var FilterNotifier = require("filterNotifier").FilterNotifier; 44 var FilterNotifier = require("filterNotifier").FilterNotifier;
45 var ElemHide = require("elemHide").ElemHide; 45 var ElemHide = require("elemHide").ElemHide;
46 var defaultMatcher = require("matcher").defaultMatcher; 46 var defaultMatcher = require("matcher").defaultMatcher;
47 var Prefs = require("prefs").Prefs; 47 var Prefs = require("prefs").Prefs;
48 var Synchronizer = require("synchronizer").Synchronizer; 48 var Synchronizer = require("synchronizer").Synchronizer;
49 var Utils = require("utils").Utils; 49 var Utils = require("utils").Utils;
50 var initAntiAdblockNotification = require("antiadblockInit").initAntiAdblockNoti fication;
51 var parseFilters = require("filterValidation").parseFilters; 50 var parseFilters = require("filterValidation").parseFilters;
52 var composeFilters = require("filterComposer").composeFilters; 51 var composeFilters = require("filterComposer").composeFilters;
53 var updateIcon = require("icon").updateIcon; 52 var updateIcon = require("icon").updateIcon;
53 var initNotifications = require("notificationHelper").initNotifications;
54 54
55 var seenDataCorruption = false; 55 var seenDataCorruption = false;
56 var filterlistsReinitialized = false; 56 var filterlistsReinitialized = false;
57 57
58 function init() 58 function init()
59 { 59 {
60 var filtersLoaded = false; 60 var filtersLoaded = false;
61 var prefsLoaded = false; 61 var prefsLoaded = false;
62 62
63 var checkLoaded = function() 63 var checkLoaded = function()
(...skipping 16 matching lines...) Expand all
80 seenDataCorruption = previousVersion && FilterStorage.firstRun; 80 seenDataCorruption = previousVersion && FilterStorage.firstRun;
81 Prefs.currentVersion = info.addonVersion; 81 Prefs.currentVersion = info.addonVersion;
82 addSubscription(previousVersion); 82 addSubscription(previousVersion);
83 } 83 }
84 84
85 // The "Hide placeholders" option has been removed from the UI in 1.8.8.1285 85 // The "Hide placeholders" option has been removed from the UI in 1.8.8.1285
86 // So we reset the option for users updating from older versions. 86 // So we reset the option for users updating from older versions.
87 if (previousVersion && Services.vc.compare(previousVersion, "1.8.8.1285") < 0) 87 if (previousVersion && Services.vc.compare(previousVersion, "1.8.8.1285") < 0)
88 Prefs.hidePlaceholders = true; 88 Prefs.hidePlaceholders = true;
89 89
90 if (canUseChromeNotifications) 90 initNotifications();
91 initChromeNotifications();
92 initAntiAdblockNotification();
93 91
94 // Update browser actions and context menus when whitelisting might have 92 // Update browser actions and context menus when whitelisting might have
95 // changed. That is now when initally loading the filters and later when 93 // changed. That is now when initally loading the filters and later when
96 // importing backups or saving filter changes. 94 // importing backups or saving filter changes.
97 FilterNotifier.addListener(function(action) 95 FilterNotifier.addListener(function(action)
98 { 96 {
99 if (action == "load" || action == "save") 97 if (action == "load" || action == "save")
100 refreshIconAndContextMenuForAllPages(); 98 refreshIconAndContextMenuForAllPages();
101 }); 99 });
102 refreshIconAndContextMenuForAllPages(); 100 refreshIconAndContextMenuForAllPages();
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 break; 417 break;
420 } 418 }
421 }); 419 });
422 420
423 // update icon when page changes location 421 // update icon when page changes location
424 ext.pages.onLoading.addListener(function(page) 422 ext.pages.onLoading.addListener(function(page)
425 { 423 {
426 page.sendMessage({type: "clickhide-deactivate"}); 424 page.sendMessage({type: "clickhide-deactivate"});
427 refreshIconAndContextMenu(page); 425 refreshIconAndContextMenu(page);
428 }); 426 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld