LEFT | RIGHT |
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 29 matching lines...) Expand all Loading... |
40 {\ | 40 {\ |
41 ABP_NS::FilterNotifier::FilterChange(ABP_NS::FilterNotifier::Topic::
topic, *this);\ | 41 ABP_NS::FilterNotifier::FilterChange(ABP_NS::FilterNotifier::Topic::
topic, *this);\ |
42 }\ | 42 }\ |
43 }\ | 43 }\ |
44 } | 44 } |
45 | 45 |
46 ABP_NS_BEGIN | 46 ABP_NS_BEGIN |
47 | 47 |
48 class ActiveFilter : public Filter | 48 class ActiveFilter : public Filter |
49 { | 49 { |
| 50 public: |
| 51 typedef StringMap<bool> DomainMap; |
| 52 virtual DomainMap* GetDomains() const; |
| 53 static const DependentString DEFAULT_DOMAIN; |
50 protected: | 54 protected: |
51 typedef StringMap<bool> DomainMap; | |
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; |
55 virtual DomainMap* GetDomains() const; | |
56 virtual SitekeySet* GetSitekeys() const; | 58 virtual SitekeySet* GetSitekeys() const; |
57 mutable std::unique_ptr<DomainMap> mDomains; | 59 mutable std::unique_ptr<DomainMap> mDomains; |
58 mutable std::unique_ptr<SitekeySet> mSitekeys; | 60 mutable std::unique_ptr<SitekeySet> mSitekeys; |
59 private: | 61 private: |
60 bool mIgnoreTrailingDot; | 62 bool mIgnoreTrailingDot; |
61 public: | 63 public: |
| 64 static constexpr Type classType = Type::ACTIVE; |
62 explicit ActiveFilter(Type type, const String& text, bool ignoreTrailingDot); | 65 explicit ActiveFilter(Type type, const String& text, bool ignoreTrailingDot); |
63 FILTER_PROPERTY(bool, mDisabled, FILTER_DISABLED, GetDisabled, SetDisabled); | 66 FILTER_PROPERTY(bool, mDisabled, FILTER_DISABLED, GetDisabled, SetDisabled); |
64 FILTER_PROPERTY(unsigned int, mHitCount, FILTER_HITCOUNT, | 67 FILTER_PROPERTY(unsigned int, mHitCount, FILTER_HITCOUNT, |
65 GetHitCount, SetHitCount); | 68 GetHitCount, SetHitCount); |
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) 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 |
| 78 typedef intrusive_ptr<ActiveFilter> ActiveFilterPtr; |
| 79 |
75 ABP_NS_END | 80 ABP_NS_END |
LEFT | RIGHT |