| 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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // CPluginFilter | 124 // CPluginFilter |
| 125 // ============================================================================ | 125 // ============================================================================ |
| 126 | 126 |
| 127 class CPluginFilter | 127 class CPluginFilter |
| 128 { | 128 { |
| 129 | 129 |
| 130 private: | 130 private: |
| 131 | 131 |
| 132 CString m_dataPath; | 132 CString m_dataPath; |
| 133 | 133 |
| 134 typedef std::map<DWORD, CFilter> TFilterMap; | |
| 135 typedef std::vector<CFilter> TFilterMapDefault; | |
| 136 | |
| 137 // (Tag,Name) -> Filter | 134 // (Tag,Name) -> Filter |
| 138 typedef std::multimap<std::pair<CString,CString>, CFilterElementHide> TFilterE
lementHideTagsNamed; | 135 typedef std::multimap<std::pair<CString,CString>, CFilterElementHide> TFilterE
lementHideTagsNamed; |
| 139 | 136 |
| 140 // Tag -> Filter | 137 // Tag -> Filter |
| 141 typedef std::multimap<CString, CFilterElementHide> TFilterElementHideTags; | 138 typedef std::multimap<CString, CFilterElementHide> TFilterElementHideTags; |
| 142 | 139 |
| 143 | 140 |
| 144 TFilterElementHideTagsNamed m_elementHideTagsId; | 141 TFilterElementHideTagsNamed m_elementHideTagsId; |
| 145 TFilterElementHideTagsNamed m_elementHideTagsClass; | 142 TFilterElementHideTagsNamed m_elementHideTagsClass; |
| 146 TFilterElementHideTags m_elementHideTags; | 143 TFilterElementHideTags m_elementHideTags; |
| 147 | 144 |
| 148 TFilterMap m_filterMap[2][2]; | |
| 149 TFilterMapDefault m_filterMapDefault[2]; | |
| 150 | |
| 151 void ClearFilters(); | 145 void ClearFilters(); |
| 152 | 146 |
| 153 public: | 147 public: |
| 154 | 148 |
| 155 CPluginFilter(const CString& dataPath = ""); | 149 CPluginFilter(const CString& dataPath = ""); |
| 156 | 150 |
| 157 bool LoadHideFilters(std::vector<std::wstring> filters); | 151 bool LoadHideFilters(std::vector<std::wstring> filters); |
| 158 | 152 |
| 159 bool AddFilterElementHide(CString filter); | 153 bool AddFilterElementHide(CString filter); |
| 160 | 154 |
| 161 | 155 |
| 162 bool IsElementHidden(const std::wstring& tag, IHTMLElement* pEl, const std::ws
tring& domain, const std::wstring& indent) const; | 156 bool IsElementHidden(const std::wstring& tag, IHTMLElement* pEl, const std::ws
tring& domain, const std::wstring& indent) const; |
| 163 | 157 |
| 164 | 158 |
| 165 bool ShouldBlock(const std::wstring& src, AdblockPlus::FilterEngine::ContentTy
pe contentType, const std::wstring& domain, bool addDebug=false) const; | 159 bool ShouldBlock(const std::wstring& src, AdblockPlus::FilterEngine::ContentTy
pe contentType, const std::wstring& domain, bool addDebug=false) const; |
| 166 | 160 |
| 167 HANDLE hideFiltersLoadedEvent; | 161 HANDLE hideFiltersLoadedEvent; |
| 168 }; | 162 }; |
| 169 | 163 |
| 170 | 164 |
| 171 #endif // _PLUGIN_FILTER_H_ | 165 #endif // _PLUGIN_FILTER_H_ |
| OLD | NEW |