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 Created Jan. 30, 2015, 1:17 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
===================================================================
--- a/src/engine/Main.cpp
+++ b/src/engine/Main.cpp
@@ -1,20 +1,20 @@
-/*
- * This file is part of Adblock Plus <https://adblockplus.org/>,
- * Copyright (C) 2006-2015 Eyeo GmbH
- *
- * Adblock Plus is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * Adblock Plus is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
- */
-
+/*
+ * This file is part of Adblock Plus <https://adblockplus.org/>,
+ * Copyright (C) 2006-2015 Eyeo GmbH
+ *
+ * Adblock Plus is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Adblock Plus is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
+ */
+
#include <AdblockPlus.h>
#include <functional>
#include <vector>
@@ -106,12 +106,14 @@
case Communication::PROC_MATCHES:
{
std::string url;
- std::string type;
+ using namespace AdblockPlus;
std::string documentUrl;
+ int32_t type;
request >> url >> type >> documentUrl;
- referrerMapping.Add(url, documentUrl);
- AdblockPlus::FilterPtr filter = filterEngine->Matches(url, type, referrerMapping.BuildReferrerChain(documentUrl));
- response << (filter && filter->GetType() != AdblockPlus::Filter::TYPE_EXCEPTION);
+ referrerMapping.Add(url, documentUrl);
+ auto contentType = static_cast<FilterEngine::ContentType>(type);
+ FilterPtr filter = filterEngine->Matches(url, contentType, referrerMapping.BuildReferrerChain(documentUrl));
+ response << (filter && filter->GetType() != Filter::TYPE_EXCEPTION);
break;
}
case Communication::PROC_GET_ELEMHIDE_SELECTORS:
@@ -210,7 +212,8 @@
{
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 +221,8 @@
{
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') | src/plugin/AdblockPlusClient.h » ('J')

Powered by Google App Engine
This is Rietveld