Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/engine/Main.cpp

Issue 5316782940225536: Issue 1557 - Update to the recent libadblockplus to reduce additional updates in the logic later. (Closed)
Patch Set: only rebase Created Jan. 28, 2015, 1:20 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « adblockplus.gyp ('k') | src/plugin/AdblockPlusClient.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 std::string type; 109 int32_t type;
110 std::string documentUrl; 110 std::string documentUrl;
111 request >> url >> type >> documentUrl; 111 request >> url >> type >> documentUrl;
112 referrerMapping.Add(url, documentUrl); 112 using namespace AdblockPlus;
113 AdblockPlus::FilterPtr filter = filterEngine->Matches(url, type, referre rMapping.BuildReferrerChain(documentUrl)); 113 auto contentType = static_cast<FilterEngine::ContentType>(type);
114 auto isFrame = contentType == FilterEngine::ContentType::CONTENT_TYPE_SU BDOCUMENT ?
115 ReferrerMapping::FrameIndicator::FRAME_INDICATOR_FRAME:
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));
114 response << (filter && filter->GetType() != AdblockPlus::Filter::TYPE_EX CEPTION); 120 response << (filter && filter->GetType() != AdblockPlus::Filter::TYPE_EX CEPTION);
115 break; 121 break;
116 } 122 }
117 case Communication::PROC_GET_ELEMHIDE_SELECTORS: 123 case Communication::PROC_GET_ELEMHIDE_SELECTORS:
118 { 124 {
119 std::string domain; 125 std::string domain;
120 request >> domain; 126 request >> domain;
121 WriteStrings(response, filterEngine->GetElementHidingSelectors(domain)); 127 WriteStrings(response, filterEngine->GetElementHidingSelectors(domain));
122 break; 128 break;
123 } 129 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 209 }
204 } 210 }
205 211
206 WriteStrings(response, domains); 212 WriteStrings(response, domains);
207 break; 213 break;
208 } 214 }
209 case Communication::PROC_IS_WHITELISTED_URL: 215 case Communication::PROC_IS_WHITELISTED_URL:
210 { 216 {
211 std::string url; 217 std::string url;
212 request >> url; 218 request >> url;
213 AdblockPlus::FilterPtr match = filterEngine->Matches(url, "DOCUMENT", ur l); 219 AdblockPlus::FilterPtr match = filterEngine->Matches(url,
220 AdblockPlus::FilterEngine::ContentType::CONTENT_TYPE_DOCUMENT, url);
214 response << (match && match->GetType() == AdblockPlus::Filter::TYPE_EXCE PTION); 221 response << (match && match->GetType() == AdblockPlus::Filter::TYPE_EXCE PTION);
215 break; 222 break;
216 } 223 }
217 case Communication::PROC_IS_ELEMHIDE_WHITELISTED_ON_URL: 224 case Communication::PROC_IS_ELEMHIDE_WHITELISTED_ON_URL:
218 { 225 {
219 std::string url; 226 std::string url;
220 request >> url; 227 request >> url;
221 AdblockPlus::FilterPtr match = filterEngine->Matches(url, "ELEMHIDE", ur l); 228 AdblockPlus::FilterPtr match = filterEngine->Matches(url,
229 AdblockPlus::FilterEngine::ContentType::CONTENT_TYPE_ELEMHIDE, url);
222 response << (match && match->GetType() == AdblockPlus::Filter::TYPE_EXCE PTION); 230 response << (match && match->GetType() == AdblockPlus::Filter::TYPE_EXCE PTION);
223 break; 231 break;
224 } 232 }
225 case Communication::PROC_ADD_FILTER: 233 case Communication::PROC_ADD_FILTER:
226 { 234 {
227 std::string text; 235 std::string text;
228 request >> text; 236 request >> text;
229 237
230 filterEngine->GetFilter(text)->AddToList(); 238 filterEngine->GetFilter(text)->AddToList();
231 break; 239 break;
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 } 510 }
503 catch (const std::runtime_error& e) 511 catch (const std::runtime_error& e)
504 { 512 {
505 DebugException(e); 513 DebugException(e);
506 return 1; 514 return 1;
507 } 515 }
508 } 516 }
509 517
510 return 0; 518 return 0;
511 } 519 }
OLDNEW
« no previous file with comments | « adblockplus.gyp ('k') | src/plugin/AdblockPlusClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld