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: fix accoring to comments Created Jan. 13, 2015, 12:59 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
Index: src/engine/Main.cpp
diff --git a/src/engine/Main.cpp b/src/engine/Main.cpp
index 11ddf7eb13f0837c5bfeba071d9f3c9af1480bb8..064d58224c0a835db2073bfcf0b657c1e22dec1f 100644
--- a/src/engine/Main.cpp
+++ b/src/engine/Main.cpp
@@ -89,11 +89,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;
Eric 2015/01/13 17:29:36 The indentation is off. Also, the expression woul
sergei 2015/01/28 13:44:45 Indentation is fixed. I don't find it easier to re
+
+ referrerMapping.Add(url, documentUrl, isFrame);
Eric 2015/01/13 17:29:36 ReferrerMapping::Add() is declared with only two a
sergei 2015/01/28 13:44:45 Sure, the main aim of the whole change is to updat
+ AdblockPlus::FilterPtr filter = filterEngine->Matches(url, contentType, referrerMapping.BuildFrameStructure(documentUrl));
response << (filter && filter->GetType() != AdblockPlus::Filter::TYPE_EXCEPTION);
break;
}
@@ -193,7 +199,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;
}
@@ -201,7 +208,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;
}

Powered by Google App Engine
This is Rietveld