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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 12 matching lines...) Expand all Loading... |
23 #include "String.h" | 23 #include "String.h" |
24 | 24 |
25 class Filter; | 25 class Filter; |
26 class Subscription; | 26 class Subscription; |
27 | 27 |
28 namespace FilterNotifier | 28 namespace FilterNotifier |
29 { | 29 { |
30 enum class Topic | 30 enum class Topic |
31 { | 31 { |
32 NONE, | 32 NONE, |
| 33 FILTER_ADDED, |
| 34 FILTER_REMOVED, |
33 FILTER_DISABLED, | 35 FILTER_DISABLED, |
34 FILTER_HITCOUNT, | 36 FILTER_HITCOUNT, |
35 FILTER_LASTHIT, | 37 FILTER_LASTHIT, |
| 38 SUBSCRIPTION_ADDED, |
| 39 SUBSCRIPTION_REMOVED, |
| 40 SUBSCRIPTION_MOVED, |
36 SUBSCRIPTION_TITLE, | 41 SUBSCRIPTION_TITLE, |
37 SUBSCRIPTION_DISABLED, | 42 SUBSCRIPTION_DISABLED, |
38 SUBSCRIPTION_FIXEDTITLE, | 43 SUBSCRIPTION_FIXEDTITLE, |
39 SUBSCRIPTION_HOMEPAGE, | 44 SUBSCRIPTION_HOMEPAGE, |
40 SUBSCRIPTION_LASTCHECK, | 45 SUBSCRIPTION_LASTCHECK, |
41 SUBSCRIPTION_LASTDOWNLOAD, | 46 SUBSCRIPTION_LASTDOWNLOAD, |
42 SUBSCRIPTION_DOWNLOADSTATUS, | 47 SUBSCRIPTION_DOWNLOADSTATUS, |
43 SUBSCRIPTION_ERRORS, | 48 SUBSCRIPTION_ERRORS, |
44 }; | 49 }; |
45 | 50 |
46 inline void GenerateCustomBindings() | 51 inline void GenerateCustomBindings() |
47 { | 52 { |
48 printf("var FilterNotifier = require('filterNotifier').FilterNotifier;\n"); | 53 printf("var FilterNotifier = require('filterNotifier').FilterNotifier;\n"); |
49 printf("var notifierTopics = new Map([\n"); | 54 printf("var notifierTopics = new Map([\n"); |
| 55 printf(" [%i, 'filter.added'],\n", Topic::FILTER_ADDED); |
| 56 printf(" [%i, 'filter.removed'],\n", Topic::FILTER_REMOVED); |
50 printf(" [%i, 'filter.disabled'],\n", Topic::FILTER_DISABLED); | 57 printf(" [%i, 'filter.disabled'],\n", Topic::FILTER_DISABLED); |
51 printf(" [%i, 'filter.hitCount'],\n", Topic::FILTER_HITCOUNT); | 58 printf(" [%i, 'filter.hitCount'],\n", Topic::FILTER_HITCOUNT); |
52 printf(" [%i, 'filter.lastHit'],\n", Topic::FILTER_LASTHIT); | 59 printf(" [%i, 'filter.lastHit'],\n", Topic::FILTER_LASTHIT); |
| 60 printf(" [%i, 'subscription.added'],\n", Topic::SUBSCRIPTION_ADDED); |
| 61 printf(" [%i, 'subscription.removed'],\n", Topic::SUBSCRIPTION_REMOVED); |
| 62 printf(" [%i, 'subscription.moved'],\n", Topic::SUBSCRIPTION_MOVED); |
53 printf(" [%i, 'subscription.title'],\n", Topic::SUBSCRIPTION_TITLE); | 63 printf(" [%i, 'subscription.title'],\n", Topic::SUBSCRIPTION_TITLE); |
54 printf(" [%i, 'subscription.disabled'],\n", Topic::SUBSCRIPTION_DISABLED); | 64 printf(" [%i, 'subscription.disabled'],\n", Topic::SUBSCRIPTION_DISABLED); |
55 printf(" [%i, 'subscription.fixedTitle'],\n", Topic::SUBSCRIPTION_FIXEDTITL
E); | 65 printf(" [%i, 'subscription.fixedTitle'],\n", Topic::SUBSCRIPTION_FIXEDTITL
E); |
56 printf(" [%i, 'subscription.homepage'],\n", Topic::SUBSCRIPTION_HOMEPAGE); | 66 printf(" [%i, 'subscription.homepage'],\n", Topic::SUBSCRIPTION_HOMEPAGE); |
57 printf(" [%i, 'subscription.lastCheck'],\n", Topic::SUBSCRIPTION_LASTCHECK)
; | 67 printf(" [%i, 'subscription.lastCheck'],\n", Topic::SUBSCRIPTION_LASTCHECK)
; |
58 printf(" [%i, 'subscription.lastDownload'],\n", Topic::SUBSCRIPTION_LASTDOW
NLOAD); | 68 printf(" [%i, 'subscription.lastDownload'],\n", Topic::SUBSCRIPTION_LASTDOW
NLOAD); |
59 printf(" [%i, 'subscription.downloadStatus'],\n", Topic::SUBSCRIPTION_DOWNL
OADSTATUS); | 69 printf(" [%i, 'subscription.downloadStatus'],\n", Topic::SUBSCRIPTION_DOWNL
OADSTATUS); |
60 printf(" [%i, 'subscription.errors'],\n", Topic::SUBSCRIPTION_ERRORS); | 70 printf(" [%i, 'subscription.errors'],\n", Topic::SUBSCRIPTION_ERRORS); |
61 printf("]);"); | 71 printf("]);"); |
62 } | 72 } |
63 | 73 |
64 inline void FilterChange(Topic topic, Filter* filter) | 74 inline void FilterChange(Topic topic, Filter* filter, |
| 75 Subscription* subscription = nullptr, unsigned int position = 0) |
65 { | 76 { |
66 JSNotifyFilterChange(topic, filter); | 77 JSNotifyFilterChange(topic, filter, subscription, position); |
67 } | 78 } |
68 | 79 |
69 inline void SubscriptionChange(Topic topic, Subscription* subscription) | 80 inline void SubscriptionChange(Topic topic, Subscription* subscription) |
70 { | 81 { |
71 JSNotifySubscriptionChange(topic, subscription); | 82 JSNotifySubscriptionChange(topic, subscription); |
72 } | 83 } |
73 } | 84 } |
OLD | NEW |