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

Delta Between Two Patch Sets: background.js

Issue 5749582424178688: Ported over anti-adblock message notification (Closed)
Left Patch Set: Created March 19, 2014, 1:28 p.m.
Right Patch Set: Created March 21, 2014, 1:29 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 | chrome/ext/background.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 <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 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 23 matching lines...) Expand all
34 this.isFrameWhitelisted = isFrameWhitelisted; 34 this.isFrameWhitelisted = isFrameWhitelisted;
35 this.processKeyException = processKeyException; 35 this.processKeyException = processKeyException;
36 } 36 }
37 var FilterStorage = require("filterStorage").FilterStorage; 37 var FilterStorage = require("filterStorage").FilterStorage;
38 var ElemHide = require("elemHide").ElemHide; 38 var ElemHide = require("elemHide").ElemHide;
39 var defaultMatcher = require("matcher").defaultMatcher; 39 var defaultMatcher = require("matcher").defaultMatcher;
40 var Prefs = require("prefs").Prefs; 40 var Prefs = require("prefs").Prefs;
41 var Synchronizer = require("synchronizer").Synchronizer; 41 var Synchronizer = require("synchronizer").Synchronizer;
42 var Utils = require("utils").Utils; 42 var Utils = require("utils").Utils;
43 var Notification = require("notification").Notification; 43 var Notification = require("notification").Notification;
44 var setupAntiAdblockNotification = require("antiadblock-setup").setupAntiAdblock Notification; 44 var initAntiAdblockNotification = require("antiadblockInit").initAntiAdblockNoti fication;
45 45
46 // Some types cannot be distinguished 46 // Some types cannot be distinguished
47 RegExpFilter.typeMap.OBJECT_SUBREQUEST = RegExpFilter.typeMap.OBJECT; 47 RegExpFilter.typeMap.OBJECT_SUBREQUEST = RegExpFilter.typeMap.OBJECT;
48 RegExpFilter.typeMap.MEDIA = RegExpFilter.typeMap.FONT = RegExpFilter.typeMap.OT HER; 48 RegExpFilter.typeMap.MEDIA = RegExpFilter.typeMap.FONT = RegExpFilter.typeMap.OT HER;
49 49
50 var isFirstRun = false; 50 var isFirstRun = false;
51 var seenDataCorruption = false; 51 var seenDataCorruption = false;
52 require("filterNotifier").FilterNotifier.addListener(function(action) 52 require("filterNotifier").FilterNotifier.addListener(function(action)
53 { 53 {
54 if (action == "load") 54 if (action == "load")
55 { 55 {
56 var importingOldData = importOldData(); 56 var importingOldData = importOldData();
57 57
58 var addonVersion = require("info").addonVersion; 58 var addonVersion = require("info").addonVersion;
59 var prevVersion = localStorage.currentVersion; 59 var prevVersion = localStorage.currentVersion;
60 if (prevVersion != addonVersion) 60 if (prevVersion != addonVersion)
61 { 61 {
62 isFirstRun = !prevVersion; 62 isFirstRun = !prevVersion;
63 localStorage.currentVersion = addonVersion; 63 localStorage.currentVersion = addonVersion;
64 if (!importingOldData) 64 if (!importingOldData)
65 addSubscription(prevVersion); 65 addSubscription(prevVersion);
66 } 66 }
67 67
68 setupAntiAdblockNotification(); 68 initAntiAdblockNotification();
69 } 69 }
70 70
71 // update browser actions when whitelisting might have changed, 71 // update browser actions when whitelisting might have changed,
72 // due to loading filters or saving filter changes 72 // due to loading filters or saving filter changes
73 if (action == "load" || action == "save") 73 if (action == "load" || action == "save")
74 { 74 {
75 ext.windows.getAll(function(windows) 75 ext.windows.getAll(function(windows)
76 { 76 {
77 for (var i = 0; i < windows.length; i++) 77 for (var i = 0; i < windows.length; i++)
78 { 78 {
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 tab.sendMessage({type: "clickhide-deactivate"}); 528 tab.sendMessage({type: "clickhide-deactivate"});
529 refreshIconAndContextMenu(tab); 529 refreshIconAndContextMenu(tab);
530 }); 530 });
531 531
532 setTimeout(function() 532 setTimeout(function()
533 { 533 {
534 var notificationToShow = Notification.getNextToShow(); 534 var notificationToShow = Notification.getNextToShow();
535 if (notificationToShow) 535 if (notificationToShow)
536 showNotification(notificationToShow); 536 showNotification(notificationToShow);
537 }, 3 * 60 * 1000); 537 }, 3 * 60 * 1000);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld