OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2017 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 #pragma once |
| 19 |
| 20 #include <cstdio> |
| 21 |
| 22 #include "String.h" |
| 23 |
| 24 class Filter; |
| 25 class Subscription; |
| 26 |
| 27 namespace FilterNotifier |
| 28 { |
| 29 enum class Topic |
| 30 { |
| 31 NONE, |
| 32 FILTER_DISABLED, |
| 33 FILTER_HITCOUNT, |
| 34 FILTER_LASTHIT, |
| 35 SUBSCRIPTION_TITLE, |
| 36 SUBSCRIPTION_DISABLED, |
| 37 SUBSCRIPTION_FIXEDTITLE, |
| 38 SUBSCRIPTION_HOMEPAGE, |
| 39 SUBSCRIPTION_LASTCHECK, |
| 40 SUBSCRIPTION_LASTDOWNLOAD, |
| 41 SUBSCRIPTION_DOWNLOADSTATUS, |
| 42 SUBSCRIPTION_ERRORS, |
| 43 }; |
| 44 |
| 45 inline void GenerateCustomBindings() |
| 46 { |
| 47 printf("var FilterNotifier = require('filterNotifier').FilterNotifier;\n"); |
| 48 printf("var notifierTopics = new Map([\n"); |
| 49 printf(" [%i, 'filter.disabled'],\n", Topic::FILTER_DISABLED); |
| 50 printf(" [%i, 'filter.hitCount'],\n", Topic::FILTER_HITCOUNT); |
| 51 printf(" [%i, 'filter.lastHit'],\n", Topic::FILTER_LASTHIT); |
| 52 printf(" [%i, 'subscription.title'],\n", Topic::SUBSCRIPTION_TITLE); |
| 53 printf(" [%i, 'subscription.disabled'],\n", Topic::SUBSCRIPTION_DISABLED); |
| 54 printf(" [%i, 'subscription.fixedTitle'],\n", Topic::SUBSCRIPTION_FIXEDTITL
E); |
| 55 printf(" [%i, 'subscription.homepage'],\n", Topic::SUBSCRIPTION_HOMEPAGE); |
| 56 printf(" [%i, 'subscription.lastCheck'],\n", Topic::SUBSCRIPTION_LASTCHECK)
; |
| 57 printf(" [%i, 'subscription.lastDownload'],\n", Topic::SUBSCRIPTION_LASTDOW
NLOAD); |
| 58 printf(" [%i, 'subscription.downloadStatus'],\n", Topic::SUBSCRIPTION_DOWNL
OADSTATUS); |
| 59 printf(" [%i, 'subscription.errors'],\n", Topic::SUBSCRIPTION_ERRORS); |
| 60 printf("]);"); |
| 61 } |
| 62 |
| 63 void FilterChange(Topic topic, Filter* filter); |
| 64 void SubscriptionChange(Topic topic, Subscription* subscription); |
| 65 } |
OLD | NEW |