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 FilterNotifier::FilterChange(FilterNotifier::Topic::topic, *this);\ | 40 FilterNotifier::FilterChange(FilterNotifier::Topic::topic, *this);\ |
41 }\ | 41 }\ |
42 }\ | 42 }\ |
43 } | 43 } |
44 | 44 |
45 class ActiveFilter : public Filter | 45 class ActiveFilter : public Filter |
46 { | 46 { |
47 public: | 47 public: |
48 typedef StringMap<bool> DomainMap; | 48 typedef StringMap<bool> DomainMap; |
49 virtual DomainMap* GetDomains() const; | 49 virtual DomainMap* GetDomains() const; |
| 50 static const DependentString DEFAULT_DOMAIN; |
50 protected: | 51 protected: |
51 typedef StringSet SitekeySet; | 52 typedef StringSet SitekeySet; |
52 void ParseDomains(const String& domains, String::value_type separator) const; | 53 void ParseDomains(const String& domains, String::value_type separator) const; |
53 void AddSitekey(const String& sitekey) const; | 54 void AddSitekey(const String& sitekey) const; |
54 virtual SitekeySet* GetSitekeys() const; | 55 virtual SitekeySet* GetSitekeys() const; |
55 mutable std::unique_ptr<DomainMap> mDomains; | 56 mutable std::unique_ptr<DomainMap> mDomains; |
56 mutable std::unique_ptr<SitekeySet> mSitekeys; | 57 mutable std::unique_ptr<SitekeySet> mSitekeys; |
57 private: | 58 private: |
58 bool mIgnoreTrailingDot; | 59 bool mIgnoreTrailingDot; |
59 public: | 60 public: |
60 static constexpr Type classType = Type::ACTIVE; | 61 static constexpr Type classType = Type::ACTIVE; |
61 explicit ActiveFilter(Type type, const String& text, bool ignoreTrailingDot); | 62 explicit ActiveFilter(Type type, const String& text, bool ignoreTrailingDot); |
62 FILTER_PROPERTY(bool, mDisabled, FILTER_DISABLED, GetDisabled, SetDisabled); | 63 FILTER_PROPERTY(bool, mDisabled, FILTER_DISABLED, GetDisabled, SetDisabled); |
63 FILTER_PROPERTY(unsigned int, mHitCount, FILTER_HITCOUNT, | 64 FILTER_PROPERTY(unsigned int, mHitCount, FILTER_HITCOUNT, |
64 GetHitCount, SetHitCount); | 65 GetHitCount, SetHitCount); |
65 FILTER_PROPERTY(unsigned int, mLastHit, FILTER_LASTHIT, | 66 FILTER_PROPERTY(unsigned int, mLastHit, FILTER_LASTHIT, |
66 GetLastHit, SetLastHit); | 67 GetLastHit, SetLastHit); |
67 bool BINDINGS_EXPORTED IsActiveOnDomain(DependentString& docDomain, | 68 bool BINDINGS_EXPORTED IsActiveOnDomain(DependentString& docDomain, |
68 const String& sitekey) const; | 69 const String& sitekey = DependentString()) const; |
69 bool BINDINGS_EXPORTED IsActiveOnlyOnDomain(DependentString& docDomain) const; | 70 bool BINDINGS_EXPORTED IsActiveOnlyOnDomain(DependentString& docDomain) const; |
70 bool BINDINGS_EXPORTED IsGeneric() const; | 71 bool BINDINGS_EXPORTED IsGeneric() const; |
71 OwnedString BINDINGS_EXPORTED Serialize() const; | 72 OwnedString BINDINGS_EXPORTED Serialize() const; |
72 }; | 73 }; |
73 | 74 |
74 typedef intrusive_ptr<ActiveFilter> ActiveFilterPtr; | 75 typedef intrusive_ptr<ActiveFilter> ActiveFilterPtr; |
LEFT | RIGHT |