OLD | NEW |
1 #include <AdblockPlus.h> | 1 #include <AdblockPlus.h> |
2 #include <functional> | 2 #include <functional> |
3 #include <vector> | 3 #include <vector> |
4 #include <thread> | 4 #include <thread> |
5 #include <Windows.h> | 5 #include <Windows.h> |
6 | 6 |
7 #include "../shared/AutoHandle.h" | 7 #include "../shared/AutoHandle.h" |
8 #include "../shared/Communication.h" | 8 #include "../shared/Communication.h" |
9 #include "../shared/Dictionary.h" | 9 #include "../shared/Dictionary.h" |
10 #include "../shared/Utils.h" | 10 #include "../shared/Utils.h" |
11 #include "../shared/Version.h" | 11 #include "../shared/Version.h" |
12 #include "../shared/CriticalSection.h" | 12 #include "../shared/CriticalSection.h" |
| 13 #include "AdblockPlus.h" |
13 #include "Debug.h" | 14 #include "Debug.h" |
14 #include "Updater.h" | 15 #include "Updater.h" |
15 | 16 |
16 namespace | 17 namespace |
17 { | 18 { |
18 std::auto_ptr<AdblockPlus::FilterEngine> filterEngine; | 19 std::auto_ptr<AdblockPlus::FilterEngine> filterEngine; |
19 std::auto_ptr<Updater> updater; | 20 std::auto_ptr<Updater> updater; |
20 int activeConnections = 0; | 21 int activeConnections = 0; |
21 CriticalSection activeConnectionsLock; | 22 CriticalSection activeConnectionsLock; |
22 HWND callbackWindow; | 23 HWND callbackWindow; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 checkingForUpdate = false; | 69 checkingForUpdate = false; |
69 callbackWindow = 0; | 70 callbackWindow = 0; |
70 } | 71 } |
71 return; | 72 return; |
72 } | 73 } |
73 | 74 |
74 | 75 |
75 CriticalSection firstRunLock; | 76 CriticalSection firstRunLock; |
76 CriticalSection updateCheckLock; | 77 CriticalSection updateCheckLock; |
77 bool firstRunActionExecuted = false; | 78 bool firstRunActionExecuted = false; |
| 79 AdblockPlus::ReferrerMapping referrerMapping; |
78 Communication::OutputBuffer HandleRequest(Communication::InputBuffer& request) | 80 Communication::OutputBuffer HandleRequest(Communication::InputBuffer& request) |
79 { | 81 { |
80 Communication::OutputBuffer response; | 82 Communication::OutputBuffer response; |
81 | 83 |
82 Communication::ProcType procedure; | 84 Communication::ProcType procedure; |
83 request >> procedure; | 85 request >> procedure; |
84 switch (procedure) | 86 switch (procedure) |
85 { | 87 { |
86 case Communication::PROC_MATCHES: | 88 case Communication::PROC_MATCHES: |
87 { | 89 { |
88 std::string url; | 90 std::string url; |
89 std::string type; | 91 std::string type; |
90 std::string documentUrl; | 92 std::string documentUrl; |
91 request >> url >> type >> documentUrl; | 93 request >> url >> type >> documentUrl; |
92 AdblockPlus::FilterPtr filter = filterEngine->Matches(url, type, documen
tUrl); | 94 referrerMapping.Add(url, documentUrl); |
| 95 AdblockPlus::FilterPtr filter = filterEngine->Matches(url, type, referre
rMapping.BuildReferrerChain(url)); |
93 response << (filter && filter->GetType() != AdblockPlus::Filter::TYPE_EX
CEPTION); | 96 response << (filter && filter->GetType() != AdblockPlus::Filter::TYPE_EX
CEPTION); |
94 break; | 97 break; |
95 } | 98 } |
96 case Communication::PROC_GET_ELEMHIDE_SELECTORS: | 99 case Communication::PROC_GET_ELEMHIDE_SELECTORS: |
97 { | 100 { |
98 std::string domain; | 101 std::string domain; |
99 request >> domain; | 102 request >> domain; |
100 WriteStrings(response, filterEngine->GetElementHidingSelectors(domain)); | 103 WriteStrings(response, filterEngine->GetElementHidingSelectors(domain)); |
101 break; | 104 break; |
102 } | 105 } |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 } | 439 } |
437 catch (const std::runtime_error& e) | 440 catch (const std::runtime_error& e) |
438 { | 441 { |
439 DebugException(e); | 442 DebugException(e); |
440 return 1; | 443 return 1; |
441 } | 444 } |
442 } | 445 } |
443 | 446 |
444 return 0; | 447 return 0; |
445 } | 448 } |
OLD | NEW |