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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 { | 99 { |
100 Communication::OutputBuffer response; | 100 Communication::OutputBuffer response; |
101 | 101 |
102 Communication::ProcType procedure; | 102 Communication::ProcType procedure; |
103 request >> procedure; | 103 request >> procedure; |
104 switch (procedure) | 104 switch (procedure) |
105 { | 105 { |
106 case Communication::PROC_MATCHES: | 106 case Communication::PROC_MATCHES: |
107 { | 107 { |
108 std::string url; | 108 std::string url; |
| 109 using namespace AdblockPlus; |
| 110 std::string documentUrl; |
109 int32_t type; | 111 int32_t type; |
110 std::string documentUrl; | |
111 request >> url >> type >> documentUrl; | 112 request >> url >> type >> documentUrl; |
112 using namespace AdblockPlus; | 113 referrerMapping.Add(url, documentUrl); |
113 auto contentType = static_cast<FilterEngine::ContentType>(type); | 114 auto contentType = static_cast<FilterEngine::ContentType>(type); |
114 auto isFrame = contentType == FilterEngine::ContentType::CONTENT_TYPE_SU
BDOCUMENT ? | 115 FilterPtr filter = filterEngine->Matches(url, contentType, referrerMappi
ng.BuildReferrerChain(documentUrl)); |
115 ReferrerMapping::FrameIndicator::FRAME_INDICATOR_FRAME: | 116 response << (filter && filter->GetType() != Filter::TYPE_EXCEPTION); |
116 ReferrerMapping::FrameIndicator::FRAME_INDICATOR_NOT_FRAME; | |
117 | |
118 referrerMapping.Add(url, documentUrl, isFrame); | |
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 |