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

Unified Diff: src/plugin/AdblockPlusClient.cpp

Issue 5338025085108224: Support Acceptable Ads (Closed)
Patch Set: Cosmetic code fixes. Addressing comments. Created July 18, 2014, 6:51 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/plugin/AdblockPlusClient.cpp
===================================================================
--- a/src/plugin/AdblockPlusClient.cpp
+++ b/src/plugin/AdblockPlusClient.cpp
@@ -343,6 +343,21 @@
return ReadSubscriptions(response);
}
+// Returns true if Acceptable Ads are enabled, false otherwise.
+bool CAdblockPlusClient::IsAcceptableAdsEnabled()
+{
+ std::vector<SubscriptionDescription> subscriptions = GetListedSubscriptions();
+ std::wstring aaUrl = GetPref(L"subscriptions_exceptionsurl", L"");
+ for (std::vector<SubscriptionDescription>::iterator subscription = subscriptions.begin(); subscription != subscriptions.end(); subscription++)
+ {
+ if (subscription->url == aaUrl)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
void CAdblockPlusClient::SetSubscription(const std::wstring& url)
{
Communication::OutputBuffer request;
@@ -350,6 +365,21 @@
CallEngine(request);
}
+void CAdblockPlusClient::AddSubscription(const std::wstring& url)
+{
+ Communication::OutputBuffer request;
+ request << Communication::PROC_ADD_SUBSCRIPTION << ToUtf8String(url);
+ CallEngine(request);
+}
+
+void CAdblockPlusClient::RemoveSubscription(const std::wstring& url)
+{
+ Communication::OutputBuffer request;
+ request << Communication::PROC_REMOVE_SUBSCRIPTION << ToUtf8String(url);
+ CallEngine(request);
+}
+
+
void CAdblockPlusClient::UpdateAllSubscriptions()
{
CallEngine(Communication::PROC_UPDATE_ALL_SUBSCRIPTIONS);

Powered by Google App Engine
This is Rietveld