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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 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/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 #pragma once | 18 #pragma once |
19 | 19 |
20 #include <emscripten.h> | |
21 | |
22 #include "Filter.h" | 20 #include "Filter.h" |
23 #include "../StringMap.h" | 21 #include "../StringMap.h" |
24 #include "../FilterNotifier.h" | 22 #include "../FilterNotifier.h" |
| 23 #include "../bindings/runtime.h" |
25 | 24 |
26 #define FILTER_PROPERTY(type, name, topic, getter, setter) \ | 25 #define FILTER_PROPERTY(type, name, topic, getter, setter) \ |
27 private:\ | 26 private:\ |
28 type name;\ | 27 type name;\ |
29 public:\ | 28 public:\ |
30 type EMSCRIPTEN_KEEPALIVE getter() const\ | 29 type BINDINGS_EXPORTED getter() const\ |
31 {\ | 30 {\ |
32 return name;\ | 31 return name;\ |
33 }\ | 32 }\ |
34 void EMSCRIPTEN_KEEPALIVE setter(type value)\ | 33 void BINDINGS_EXPORTED setter(type value)\ |
35 {\ | 34 {\ |
36 if (name != value)\ | 35 if (name != value)\ |
37 {\ | 36 {\ |
38 name = value;\ | 37 name = value;\ |
39 if (FilterNotifier::Topic::topic != FilterNotifier::Topic::NONE)\ | 38 if (FilterNotifier::Topic::topic != FilterNotifier::Topic::NONE)\ |
40 {\ | 39 {\ |
41 FilterNotifier::FilterChange(FilterNotifier::Topic::topic, this);\ | 40 FilterNotifier::FilterChange(FilterNotifier::Topic::topic, this);\ |
42 }\ | 41 }\ |
43 }\ | 42 }\ |
44 } | 43 } |
(...skipping 11 matching lines...) Expand all Loading... |
56 mutable std::unique_ptr<SitekeySet> mSitekeys; | 55 mutable std::unique_ptr<SitekeySet> mSitekeys; |
57 private: | 56 private: |
58 bool mIgnoreTrailingDot; | 57 bool mIgnoreTrailingDot; |
59 public: | 58 public: |
60 explicit ActiveFilter(Type type, const String& text, bool ignoreTrailingDot); | 59 explicit ActiveFilter(Type type, const String& text, bool ignoreTrailingDot); |
61 FILTER_PROPERTY(bool, mDisabled, FILTER_DISABLED, GetDisabled, SetDisabled); | 60 FILTER_PROPERTY(bool, mDisabled, FILTER_DISABLED, GetDisabled, SetDisabled); |
62 FILTER_PROPERTY(unsigned int, mHitCount, FILTER_HITCOUNT, | 61 FILTER_PROPERTY(unsigned int, mHitCount, FILTER_HITCOUNT, |
63 GetHitCount, SetHitCount); | 62 GetHitCount, SetHitCount); |
64 FILTER_PROPERTY(unsigned int, mLastHit, FILTER_LASTHIT, | 63 FILTER_PROPERTY(unsigned int, mLastHit, FILTER_LASTHIT, |
65 GetLastHit, SetLastHit); | 64 GetLastHit, SetLastHit); |
66 bool EMSCRIPTEN_KEEPALIVE IsActiveOnDomain(DependentString& docDomain, | 65 bool BINDINGS_EXPORTED IsActiveOnDomain(DependentString& docDomain, |
67 const String& sitekey) const; | 66 const String& sitekey) const; |
68 bool EMSCRIPTEN_KEEPALIVE IsActiveOnlyOnDomain(DependentString& docDomain) con
st; | 67 bool BINDINGS_EXPORTED IsActiveOnlyOnDomain(DependentString& docDomain) const; |
69 bool EMSCRIPTEN_KEEPALIVE IsGeneric() const; | 68 bool BINDINGS_EXPORTED IsGeneric() const; |
70 OwnedString EMSCRIPTEN_KEEPALIVE Serialize() const; | 69 OwnedString BINDINGS_EXPORTED Serialize() const; |
71 }; | 70 }; |
OLD | NEW |