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 |
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 "../base.h" |
20 #include "Filter.h" | 21 #include "Filter.h" |
21 #include "../StringMap.h" | 22 #include "../StringMap.h" |
22 #include "../FilterNotifier.h" | 23 #include "../FilterNotifier.h" |
23 #include "../bindings/runtime.h" | 24 #include "../bindings/runtime.h" |
24 | 25 |
25 #define FILTER_PROPERTY(type, name, topic, getter, setter) \ | 26 #define FILTER_PROPERTY(type, name, topic, getter, setter) \ |
26 private:\ | 27 private:\ |
27 type name;\ | 28 type name;\ |
28 public:\ | 29 public:\ |
29 type BINDINGS_EXPORTED getter() const\ | 30 type BINDINGS_EXPORTED getter() const\ |
30 {\ | 31 {\ |
31 return name;\ | 32 return name;\ |
32 }\ | 33 }\ |
33 void BINDINGS_EXPORTED setter(type value)\ | 34 void BINDINGS_EXPORTED setter(type value)\ |
34 {\ | 35 {\ |
35 if (name != value)\ | 36 if (name != value)\ |
36 {\ | 37 {\ |
37 name = value;\ | 38 name = value;\ |
38 if (FilterNotifier::Topic::topic != FilterNotifier::Topic::NONE)\ | 39 if (ABP_NS::FilterNotifier::Topic::topic != ABP_NS::FilterNotifier::To
pic::NONE)\ |
39 {\ | 40 {\ |
40 FilterNotifier::FilterChange(FilterNotifier::Topic::topic, *this);\ | 41 ABP_NS::FilterNotifier::FilterChange(ABP_NS::FilterNotifier::Topic::
topic, *this);\ |
41 }\ | 42 }\ |
42 }\ | 43 }\ |
43 } | 44 } |
44 | 45 |
| 46 ABP_NS_BEGIN |
| 47 |
45 class ActiveFilter : public Filter | 48 class ActiveFilter : public Filter |
46 { | 49 { |
47 public: | 50 public: |
48 typedef StringMap<bool> DomainMap; | 51 typedef StringMap<bool> DomainMap; |
49 virtual DomainMap* GetDomains() const; | 52 virtual DomainMap* GetDomains() const; |
50 static const DependentString DEFAULT_DOMAIN; | 53 static const DependentString DEFAULT_DOMAIN; |
51 protected: | 54 protected: |
52 typedef StringSet SitekeySet; | 55 typedef StringSet SitekeySet; |
53 void ParseDomains(const String& domains, String::value_type separator) const; | 56 void ParseDomains(const String& domains, String::value_type separator) const; |
54 void AddSitekey(const String& sitekey) const; | 57 void AddSitekey(const String& sitekey) const; |
(...skipping 11 matching lines...) Expand all Loading... |
66 FILTER_PROPERTY(unsigned int, mLastHit, FILTER_LASTHIT, | 69 FILTER_PROPERTY(unsigned int, mLastHit, FILTER_LASTHIT, |
67 GetLastHit, SetLastHit); | 70 GetLastHit, SetLastHit); |
68 bool BINDINGS_EXPORTED IsActiveOnDomain(DependentString& docDomain, | 71 bool BINDINGS_EXPORTED IsActiveOnDomain(DependentString& docDomain, |
69 const String& sitekey = DependentString()) const; | 72 const String& sitekey = DependentString()) const; |
70 bool BINDINGS_EXPORTED IsActiveOnlyOnDomain(DependentString& docDomain) const; | 73 bool BINDINGS_EXPORTED IsActiveOnlyOnDomain(DependentString& docDomain) const; |
71 bool BINDINGS_EXPORTED IsGeneric() const; | 74 bool BINDINGS_EXPORTED IsGeneric() const; |
72 OwnedString BINDINGS_EXPORTED Serialize() const; | 75 OwnedString BINDINGS_EXPORTED Serialize() const; |
73 }; | 76 }; |
74 | 77 |
75 typedef intrusive_ptr<ActiveFilter> ActiveFilterPtr; | 78 typedef intrusive_ptr<ActiveFilter> ActiveFilterPtr; |
| 79 |
| 80 ABP_NS_END |
OLD | NEW |