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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 * |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 // ============================================================================ | 121 // ============================================================================ |
122 // CPluginFilter | 122 // CPluginFilter |
123 // ============================================================================ | 123 // ============================================================================ |
124 | 124 |
125 class CPluginFilter | 125 class CPluginFilter |
126 { | 126 { |
127 | 127 |
128 private: | 128 private: |
129 | 129 |
130 CString m_dataPath; | |
131 | |
132 // (Tag,Name) -> Filter | 130 // (Tag,Name) -> Filter |
133 typedef std::multimap<std::pair<CString,CString>, CFilterElementHide> TFilterE
lementHideTagsNamed; | 131 typedef std::multimap<std::pair<CString,CString>, CFilterElementHide> TFilterE
lementHideTagsNamed; |
134 | 132 |
135 // Tag -> Filter | 133 // Tag -> Filter |
136 typedef std::multimap<CString, CFilterElementHide> TFilterElementHideTags; | 134 typedef std::multimap<CString, CFilterElementHide> TFilterElementHideTags; |
137 | 135 |
138 | 136 |
139 TFilterElementHideTagsNamed m_elementHideTagsId; | 137 TFilterElementHideTagsNamed m_elementHideTagsId; |
140 TFilterElementHideTagsNamed m_elementHideTagsClass; | 138 TFilterElementHideTagsNamed m_elementHideTagsClass; |
141 TFilterElementHideTags m_elementHideTags; | 139 TFilterElementHideTags m_elementHideTags; |
142 std::vector<std::wstring> m_hideFilters; | 140 std::vector<std::wstring> m_hideFilters; |
143 | 141 |
144 void ClearFilters(); | |
145 | 142 |
146 public: | 143 public: |
147 | 144 explicit CPluginFilter(const std::vector<std::wstring>& filters); |
148 CPluginFilter(const CString& dataPath = ""); | |
149 | |
150 bool LoadHideFilters(const std::vector<std::wstring>& filters); | |
151 | |
152 bool AddFilterElementHide(CString filter); | 145 bool AddFilterElementHide(CString filter); |
153 | |
154 | |
155 bool IsElementHidden(const std::wstring& tag, IHTMLElement* pEl, const std::ws
tring& domain, const std::wstring& indent) const; | 146 bool IsElementHidden(const std::wstring& tag, IHTMLElement* pEl, const std::ws
tring& domain, const std::wstring& indent) const; |
156 | 147 const std::vector<std::wstring>& GetHideFilters() const { |
157 | 148 return m_hideFilters; |
158 bool ShouldBlock(const std::wstring& src, AdblockPlus::FilterEngine::ContentTy
pe contentType, const std::wstring& domain, bool addDebug=false) const; | 149 } |
159 | |
160 HANDLE hideFiltersLoadedEvent; | |
161 const std::vector<std::wstring>& GetHideFilters() const; | |
162 }; | 150 }; |
163 | 151 |
| 152 typedef std::shared_ptr<CPluginFilter> PluginFilterPtr; |
164 | 153 |
165 #endif // _PLUGIN_FILTER_H_ | 154 #endif // _PLUGIN_FILTER_H_ |
LEFT | RIGHT |