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 10 matching lines...) Expand all Loading... |
21 #include <thread> | 21 #include <thread> |
22 #include <Windows.h> | 22 #include <Windows.h> |
23 | 23 |
24 #include "../shared/AutoHandle.h" | 24 #include "../shared/AutoHandle.h" |
25 #include "../shared/Communication.h" | 25 #include "../shared/Communication.h" |
26 #include "../shared/Dictionary.h" | 26 #include "../shared/Dictionary.h" |
27 #include "../shared/Utils.h" | 27 #include "../shared/Utils.h" |
28 #include "../shared/Version.h" | 28 #include "../shared/Version.h" |
29 #include "../shared/CriticalSection.h" | 29 #include "../shared/CriticalSection.h" |
30 #include "../shared/IE_version.h" | 30 #include "../shared/IE_version.h" |
31 #include "../shared/ContentType.h" | |
32 #include "AdblockPlus.h" | 31 #include "AdblockPlus.h" |
33 #include "Debug.h" | 32 #include "Debug.h" |
34 #include "Updater.h" | 33 #include "Updater.h" |
35 | 34 |
36 namespace | 35 namespace |
37 { | 36 { |
38 std::auto_ptr<AdblockPlus::FilterEngine> filterEngine; | 37 std::auto_ptr<AdblockPlus::FilterEngine> filterEngine; |
39 std::auto_ptr<Updater> updater; | 38 std::auto_ptr<Updater> updater; |
40 int activeConnections = 0; | 39 int activeConnections = 0; |
41 CriticalSection activeConnectionsLock; | 40 CriticalSection activeConnectionsLock; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 Communication::OutputBuffer response; | 100 Communication::OutputBuffer response; |
102 | 101 |
103 Communication::ProcType procedure; | 102 Communication::ProcType procedure; |
104 request >> procedure; | 103 request >> procedure; |
105 switch (procedure) | 104 switch (procedure) |
106 { | 105 { |
107 case Communication::PROC_MATCHES: | 106 case Communication::PROC_MATCHES: |
108 { | 107 { |
109 std::string url; | 108 std::string url; |
110 using namespace AdblockPlus; | 109 using namespace AdblockPlus; |
111 FilterEngine::ContentType contentType; | |
112 std::string documentUrl; | 110 std::string documentUrl; |
113 request >> url >> contentType >> documentUrl; | 111 int32_t type; |
114 auto isFrame = contentType == FilterEngine::ContentType::CONTENT_TYPE_SU
BDOCUMENT ? | 112 request >> url >> type >> documentUrl; |
115 ReferrerMapping::FrameIndicator::FRAME_INDICATOR_FRAME: | 113 referrerMapping.Add(url, documentUrl); |
116 ReferrerMapping::FrameIndicator::FRAME_INDICATOR_NOT_FRAME; | 114 auto contentType = static_cast<FilterEngine::ContentType>(type); |
117 | 115 FilterPtr filter = filterEngine->Matches(url, contentType, referrerMappi
ng.BuildReferrerChain(documentUrl)); |
118 referrerMapping.Add(url, documentUrl, isFrame); | 116 response << (filter && filter->GetType() != Filter::TYPE_EXCEPTION); |
119 AdblockPlus::FilterPtr filter = filterEngine->Matches(url, contentType,
referrerMapping.BuildFrameStructure(documentUrl)); | |
120 response << (filter && filter->GetType() != AdblockPlus::Filter::TYPE_EX
CEPTION); | |
121 break; | 117 break; |
122 } | 118 } |
123 case Communication::PROC_GET_ELEMHIDE_SELECTORS: | 119 case Communication::PROC_GET_ELEMHIDE_SELECTORS: |
124 { | 120 { |
125 std::string domain; | 121 std::string domain; |
126 request >> domain; | 122 request >> domain; |
127 WriteStrings(response, filterEngine->GetElementHidingSelectors(domain)); | 123 WriteStrings(response, filterEngine->GetElementHidingSelectors(domain)); |
128 break; | 124 break; |
129 } | 125 } |
130 case Communication::PROC_AVAILABLE_SUBSCRIPTIONS: | 126 case Communication::PROC_AVAILABLE_SUBSCRIPTIONS: |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 } | 506 } |
511 catch (const std::runtime_error& e) | 507 catch (const std::runtime_error& e) |
512 { | 508 { |
513 DebugException(e); | 509 DebugException(e); |
514 return 1; | 510 return 1; |
515 } | 511 } |
516 } | 512 } |
517 | 513 |
518 return 0; | 514 return 0; |
519 } | 515 } |
LEFT | RIGHT |