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-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 11 matching lines...) Expand all Loading... |
22 #include "PluginClient.h" | 22 #include "PluginClient.h" |
23 #include "PluginClientFactory.h" | 23 #include "PluginClientFactory.h" |
24 #include "PluginMutex.h" | 24 #include "PluginMutex.h" |
25 #include "PluginSettings.h" | 25 #include "PluginSettings.h" |
26 #include "PluginSystem.h" | 26 #include "PluginSystem.h" |
27 #include "PluginClass.h" | 27 #include "PluginClass.h" |
28 #include "mlang.h" | 28 #include "mlang.h" |
29 | 29 |
30 #include "..\shared\CriticalSection.h" | 30 #include "..\shared\CriticalSection.h" |
31 #include "..\shared\Utils.h" | 31 #include "..\shared\Utils.h" |
32 #include "..\shared\ContentType.h" | |
33 | |
34 | 32 |
35 // The filters are described at http://adblockplus.org/en/filters | 33 // The filters are described at http://adblockplus.org/en/filters |
36 | 34 |
37 static CriticalSection s_criticalSectionFilterMap; | 35 static CriticalSection s_criticalSectionFilterMap; |
38 | 36 |
39 namespace | 37 namespace |
40 { | 38 { |
41 struct GetHtmlElementAttributeResult | 39 struct GetHtmlElementAttributeResult |
42 { | 40 { |
43 GetHtmlElementAttributeResult() : isAttributeFound(false) | 41 GetHtmlElementAttributeResult() : isAttributeFound(false) |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 m_predecessor = filter.m_predecessor; | 264 m_predecessor = filter.m_predecessor; |
267 } | 265 } |
268 | 266 |
269 | 267 |
270 // ============================================================================ | 268 // ============================================================================ |
271 // CFilter | 269 // CFilter |
272 // ============================================================================ | 270 // ============================================================================ |
273 | 271 |
274 CFilter::CFilter(const CFilter& filter) | 272 CFilter::CFilter(const CFilter& filter) |
275 { | 273 { |
276 m_contentType = filter.m_contentType; | |
277 m_filterType = filter.m_filterType; | 274 m_filterType = filter.m_filterType; |
278 | 275 |
279 m_isFirstParty = filter.m_isFirstParty; | 276 m_isFirstParty = filter.m_isFirstParty; |
280 m_isThirdParty = filter.m_isThirdParty; | 277 m_isThirdParty = filter.m_isThirdParty; |
281 | 278 |
282 m_isMatchCase = filter.m_isMatchCase; | 279 m_isMatchCase = filter.m_isMatchCase; |
283 m_isFromStart = filter.m_isFromStart; | 280 m_isFromStart = filter.m_isFromStart; |
284 m_isFromEnd = filter.m_isFromEnd; | 281 m_isFromEnd = filter.m_isFromEnd; |
285 | 282 |
286 m_filterText = filter.m_filterText; | 283 m_filterText = filter.m_filterText; |
287 | 284 |
288 m_hitCount = filter.m_hitCount; | 285 m_hitCount = filter.m_hitCount; |
289 } | 286 } |
290 | 287 |
291 | 288 |
292 CFilter::CFilter() : m_isMatchCase(false), m_isFirstParty(false), | 289 CFilter::CFilter() : m_isMatchCase(false), m_isFirstParty(false), |
293 m_isThirdParty(false), m_contentType(AdblockPlus::FilterEngine::ContentType::C
ONTENT_TYPE_OTHER), | 290 m_isThirdParty(false), |
294 m_isFromStart(false), m_isFromEnd(false), m_hitCount(0) | 291 m_isFromStart(false), m_isFromEnd(false), m_hitCount(0) |
295 { | 292 { |
296 } | 293 } |
297 | 294 |
298 | 295 |
299 bool CFilterElementHide::IsMatchFilterElementHide(IHTMLElement* pEl) const | 296 bool CFilterElementHide::IsMatchFilterElementHide(IHTMLElement* pEl) const |
300 { | 297 { |
301 HRESULT hr; | 298 HRESULT hr; |
302 | 299 |
303 if (!m_tagId.IsEmpty()) | 300 if (!m_tagId.IsEmpty()) |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 } | 720 } |
724 | 721 |
725 CPluginSettings* settings = CPluginSettings::GetInstance(); | 722 CPluginSettings* settings = CPluginSettings::GetInstance(); |
726 | 723 |
727 CPluginClient* client = CPluginClient::GetInstance(); | 724 CPluginClient* client = CPluginClient::GetInstance(); |
728 bool result = client->Matches(srcTrimmed, contentType, domain); | 725 bool result = client->Matches(srcTrimmed, contentType, domain); |
729 | 726 |
730 #ifdef ENABLE_DEBUG_RESULT | 727 #ifdef ENABLE_DEBUG_RESULT |
731 if (addDebug) | 728 if (addDebug) |
732 { | 729 { |
733 std::wstring type = ToUtf16String(ContentTypeToString(contentType)); | 730 std::wstring type = ToUtf16String(AdblockPlus::FilterEngine::ContentTypeToSt
ring(contentType)); |
734 if (result) | 731 if (result) |
735 { | 732 { |
736 CPluginDebug::DebugResultBlocking(ToCString(type), srcTrimmed, domain); | 733 CPluginDebug::DebugResultBlocking(ToCString(type), srcTrimmed, domain); |
737 } | 734 } |
738 else | 735 else |
739 { | 736 { |
740 CPluginDebug::DebugResultIgnoring(ToCString(type), srcTrimmed, domain); | 737 CPluginDebug::DebugResultIgnoring(ToCString(type), srcTrimmed, domain); |
741 } | 738 } |
742 } | 739 } |
743 #endif | 740 #endif |
744 return result; | 741 return result; |
745 } | 742 } |
LEFT | RIGHT |