Left: | ||
Right: |
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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 16 matching lines...) Expand all Loading... | |
27 #include "../filter/BlockingFilter.h" | 27 #include "../filter/BlockingFilter.h" |
28 #include "../filter/WhitelistFilter.h" | 28 #include "../filter/WhitelistFilter.h" |
29 #include "../filter/ElemHideBase.h" | 29 #include "../filter/ElemHideBase.h" |
30 #include "../filter/ElemHideFilter.h" | 30 #include "../filter/ElemHideFilter.h" |
31 #include "../filter/ElemHideException.h" | 31 #include "../filter/ElemHideException.h" |
32 #include "../filter/ElemHideEmulationFilter.h" | 32 #include "../filter/ElemHideEmulationFilter.h" |
33 #include "../subscription/Subscription.h" | 33 #include "../subscription/Subscription.h" |
34 #include "../subscription/DownloadableSubscription.h" | 34 #include "../subscription/DownloadableSubscription.h" |
35 #include "../subscription/UserDefinedSubscription.h" | 35 #include "../subscription/UserDefinedSubscription.h" |
36 #include "../storage/FilterStorage.h" | 36 #include "../storage/FilterStorage.h" |
37 #include "../ElemHide.h" | |
37 #include "../FilterNotifier.h" | 38 #include "../FilterNotifier.h" |
38 | 39 |
39 int main() | 40 int main() |
40 { | 41 { |
41 try | 42 try |
42 { | 43 { |
43 class_<Filter>("Filter") | 44 class_<Filter>("Filter") |
44 .property("text", &Filter::GetText) | 45 .property("text", &Filter::GetText) |
45 .function("serialize", &Filter::Serialize) | 46 .function("serialize", &Filter::Serialize) |
46 .class_function("fromText", &Filter::FromText) | 47 .class_function("fromText", &Filter::FromText) |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 | 136 |
136 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance) | 137 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance) |
137 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount) | 138 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount) |
138 .function("subscriptionAt", &FilterStorage::SubscriptionAt) | 139 .function("subscriptionAt", &FilterStorage::SubscriptionAt) |
139 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription) | 140 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription) |
140 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor Filter) | 141 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor Filter) |
141 .function("addSubscription", &FilterStorage::AddSubscription) | 142 .function("addSubscription", &FilterStorage::AddSubscription) |
142 .function("removeSubscription", &FilterStorage::RemoveSubscription) | 143 .function("removeSubscription", &FilterStorage::RemoveSubscription) |
143 .function("moveSubscription", &FilterStorage::MoveSubscription); | 144 .function("moveSubscription", &FilterStorage::MoveSubscription); |
144 | 145 |
146 class_<ElemHide_SelectorList>("ElemHide_SelectorList") | |
147 .property("selectorCount", &ElemHide_SelectorList::GetSelectorCount) | |
148 .function("selectorAt", &ElemHide_SelectorList::SelectorAt) | |
149 .function("filterKeyAt", &ElemHide_SelectorList::FilterKeyAt); | |
150 | |
151 singleton<ElemHide>("ElemHide", &ElemHide::GetInstance) | |
sergei
2018/01/15 15:31:19
Could you please change it from singleton to a cla
hub
2018/01/16 02:57:39
I can.
This require a few other changes, ElemHid
| |
152 .function("add", &ElemHide::Add) | |
153 .function("remove", &ElemHide::Remove) | |
154 .function("clear", &ElemHide::Clear) | |
155 .function("getException", &ElemHide::GetException) | |
156 .function("getSelectorsForDomain", &ElemHide::GetSelectorsForDomain) | |
157 .function("getUnconditionalSelectors", &ElemHide::GetUnconditionalSelect ors); | |
158 | |
145 printBindings(); | 159 printBindings(); |
146 RegExpFilter::GenerateCustomBindings(); | 160 RegExpFilter::GenerateCustomBindings(); |
147 FilterNotifier::GenerateCustomBindings(); | 161 FilterNotifier::GenerateCustomBindings(); |
148 | 162 |
149 return 0; | 163 return 0; |
150 } | 164 } |
151 catch (const std::exception& e) | 165 catch (const std::exception& e) |
152 { | 166 { |
153 EM_ASM_ARGS( | 167 EM_ASM_ARGS( |
154 console.error("Error occurred generating JavaScript bindings: " + | 168 console.error("Error occurred generating JavaScript bindings: " + |
155 Module.AsciiToString($0)), e.what() | 169 Module.AsciiToString($0)), e.what() |
156 ); | 170 ); |
157 return 1; | 171 return 1; |
158 } | 172 } |
159 } | 173 } |
OLD | NEW |