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

Unified 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.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « adblockplus.gyp ('k') | src/plugin/AdblockPlusClient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/engine/Main.cpp
diff --git a/src/engine/Main.cpp b/src/engine/Main.cpp
index 1f5f17c4dc72f8faa3281f40635b5f644f8178a2..12e1ace3d822c46495ea1c9570b041514b6b10d5 100644
--- a/src/engine/Main.cpp
+++ b/src/engine/Main.cpp
@@ -106,11 +106,17 @@ namespace
case Communication::PROC_MATCHES:
{
std::string url;
- std::string type;
+ int32_t type;
std::string documentUrl;
request >> url >> type >> documentUrl;
- referrerMapping.Add(url, documentUrl);
- AdblockPlus::FilterPtr filter = filterEngine->Matches(url, type, referrerMapping.BuildReferrerChain(documentUrl));
+ using namespace AdblockPlus;
+ auto contentType = static_cast<FilterEngine::ContentType>(type);
+ auto isFrame = contentType == FilterEngine::ContentType::CONTENT_TYPE_SUBDOCUMENT ?
+ ReferrerMapping::FrameIndicator::FRAME_INDICATOR_FRAME:
+ ReferrerMapping::FrameIndicator::FRAME_INDICATOR_NOT_FRAME;
+
+ referrerMapping.Add(url, documentUrl, isFrame);
+ AdblockPlus::FilterPtr filter = filterEngine->Matches(url, contentType, referrerMapping.BuildFrameStructure(documentUrl));
response << (filter && filter->GetType() != AdblockPlus::Filter::TYPE_EXCEPTION);
break;
}
@@ -210,7 +216,8 @@ namespace
{
std::string url;
request >> url;
- AdblockPlus::FilterPtr match = filterEngine->Matches(url, "DOCUMENT", url);
+ AdblockPlus::FilterPtr match = filterEngine->Matches(url,
+ AdblockPlus::FilterEngine::ContentType::CONTENT_TYPE_DOCUMENT, url);
response << (match && match->GetType() == AdblockPlus::Filter::TYPE_EXCEPTION);
break;
}
@@ -218,7 +225,8 @@ namespace
{
std::string url;
request >> url;
- AdblockPlus::FilterPtr match = filterEngine->Matches(url, "ELEMHIDE", url);
+ AdblockPlus::FilterPtr match = filterEngine->Matches(url,
+ AdblockPlus::FilterEngine::ContentType::CONTENT_TYPE_ELEMHIDE, url);
response << (match && match->GetType() == AdblockPlus::Filter::TYPE_EXCEPTION);
break;
}
« 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