OLD | NEW |
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 } | 48 } |
49 var FilterStorage = require("filterStorage").FilterStorage; | 49 var FilterStorage = require("filterStorage").FilterStorage; |
50 var ElemHide = require("elemHide").ElemHide; | 50 var ElemHide = require("elemHide").ElemHide; |
51 var defaultMatcher = require("matcher").defaultMatcher; | 51 var defaultMatcher = require("matcher").defaultMatcher; |
52 var Prefs = require("prefs").Prefs; | 52 var Prefs = require("prefs").Prefs; |
53 var Synchronizer = require("synchronizer").Synchronizer; | 53 var Synchronizer = require("synchronizer").Synchronizer; |
54 var Utils = require("utils").Utils; | 54 var Utils = require("utils").Utils; |
55 var NotificationStorage = require("notification").Notification; | 55 var NotificationStorage = require("notification").Notification; |
56 var initAntiAdblockNotification = require("antiadblockInit").initAntiAdblockNoti
fication; | 56 var initAntiAdblockNotification = require("antiadblockInit").initAntiAdblockNoti
fication; |
57 var parseFilters = require("filterValidation").parseFilters; | 57 var parseFilters = require("filterValidation").parseFilters; |
| 58 var composeFilters = require("filterComposer").composeFilters; |
58 | 59 |
59 // Chrome on Linux does not fully support chrome.notifications until version 35 | 60 // Chrome on Linux does not fully support chrome.notifications until version 35 |
60 // https://code.google.com/p/chromium/issues/detail?id=291485 | 61 // https://code.google.com/p/chromium/issues/detail?id=291485 |
61 var canUseChromeNotifications = require("info").platform == "chromium" | 62 var canUseChromeNotifications = require("info").platform == "chromium" |
62 && "notifications" in chrome | 63 && "notifications" in chrome |
63 && (navigator.platform.indexOf("Linux") == -1 || parseInt(require("info").appl
icationVersion, 10) > 34); | 64 && (navigator.platform.indexOf("Linux") == -1 || parseInt(require("info").appl
icationVersion, 10) > 34); |
64 | 65 |
65 var seenDataCorruption = false; | 66 var seenDataCorruption = false; |
66 var filterlistsReinitialized = false; | 67 var filterlistsReinitialized = false; |
67 require("filterNotifier").FilterNotifier.addListener(function(action) | 68 require("filterNotifier").FilterNotifier.addListener(function(action) |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 page.sendMessage(msg); | 545 page.sendMessage(msg); |
545 }); | 546 }); |
546 break; | 547 break; |
547 case "add-sitekey": | 548 case "add-sitekey": |
548 processKey(msg.token, sender.page, sender.frame); | 549 processKey(msg.token, sender.page, sender.frame); |
549 break; | 550 break; |
550 case "report-html-page": | 551 case "report-html-page": |
551 htmlPages.set(sender.page, null); | 552 htmlPages.set(sender.page, null); |
552 refreshIconAndContextMenu(sender.page); | 553 refreshIconAndContextMenu(sender.page); |
553 break; | 554 break; |
| 555 case "compose-filters": |
| 556 sendResponse(composeFilters( |
| 557 msg.tagName, msg.id, msg.src, msg.style, |
| 558 msg.classes, msg.urls, new URL(msg.baseURL) |
| 559 )); |
| 560 break; |
554 case "forward": | 561 case "forward": |
555 if (sender.page) | 562 if (sender.page) |
556 { | 563 { |
557 if (msg.expectsResponse) | 564 if (msg.expectsResponse) |
558 { | 565 { |
559 sender.page.sendMessage(msg.payload, sendResponse); | 566 sender.page.sendMessage(msg.payload, sendResponse); |
560 return true; | 567 return true; |
561 } | 568 } |
562 | 569 |
563 sender.page.sendMessage(msg.payload); | 570 sender.page.sendMessage(msg.payload); |
564 } | 571 } |
565 break; | 572 break; |
566 } | 573 } |
567 }); | 574 }); |
568 | 575 |
569 // update icon when page changes location | 576 // update icon when page changes location |
570 ext.pages.onLoading.addListener(function(page) | 577 ext.pages.onLoading.addListener(function(page) |
571 { | 578 { |
572 page.sendMessage({type: "clickhide-deactivate"}); | 579 page.sendMessage({type: "clickhide-deactivate"}); |
573 refreshIconAndContextMenu(page); | 580 refreshIconAndContextMenu(page); |
574 }); | 581 }); |
575 | 582 |
576 setTimeout(function() | 583 setTimeout(function() |
577 { | 584 { |
578 var notificationToShow = NotificationStorage.getNextToShow(); | 585 var notificationToShow = NotificationStorage.getNextToShow(); |
579 if (notificationToShow) | 586 if (notificationToShow) |
580 showNotification(notificationToShow); | 587 showNotification(notificationToShow); |
581 }, 3 * 60 * 1000); | 588 }, 3 * 60 * 1000); |
OLD | NEW |