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

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

Issue 5338025085108224: Support Acceptable Ads (Closed)
Patch Set: Missing negation fix Created July 18, 2014, 7:39 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 | « locales/uk.ini ('k') | src/plugin/AdblockPlus.rc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include <AdblockPlus.h> 1 #include <AdblockPlus.h>
2 #include <functional> 2 #include <functional>
3 #include <vector> 3 #include <vector>
4 #include <Windows.h> 4 #include <Windows.h>
5 5
6 #include "../shared/AutoHandle.h" 6 #include "../shared/AutoHandle.h"
7 #include "../shared/Communication.h" 7 #include "../shared/Communication.h"
8 #include "../shared/Dictionary.h" 8 #include "../shared/Dictionary.h"
9 #include "../shared/Utils.h" 9 #include "../shared/Utils.h"
10 #include "../shared/Version.h" 10 #include "../shared/Version.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 case Communication::PROC_LISTED_SUBSCRIPTIONS: 107 case Communication::PROC_LISTED_SUBSCRIPTIONS:
108 { 108 {
109 WriteSubscriptions(response, filterEngine->GetListedSubscriptions()); 109 WriteSubscriptions(response, filterEngine->GetListedSubscriptions());
110 break; 110 break;
111 } 111 }
112 case Communication::PROC_SET_SUBSCRIPTION: 112 case Communication::PROC_SET_SUBSCRIPTION:
113 { 113 {
114 std::string url; 114 std::string url;
115 request >> url; 115 request >> url;
116 116
117 AdblockPlus::JsValuePtr valuePtr = filterEngine->GetPref("subscriptions_ exceptionsurl");
118 std::string aaUrl = "";
119 if (!valuePtr->IsNull())
120 {
121 aaUrl = valuePtr->AsString();
122 }
117 std::vector<AdblockPlus::SubscriptionPtr> subscriptions = filterEngine-> GetListedSubscriptions(); 123 std::vector<AdblockPlus::SubscriptionPtr> subscriptions = filterEngine-> GetListedSubscriptions();
124
125 // Remove all subscriptions, besides the Acceptable Ads
118 for (size_t i = 0, count = subscriptions.size(); i < count; i++) 126 for (size_t i = 0, count = subscriptions.size(); i < count; i++)
119 subscriptions[i]->RemoveFromList(); 127 {
128 if (subscriptions[i]->GetProperty("url")->AsString() != aaUrl)
129 {
130 subscriptions[i]->RemoveFromList();
131 }
132 }
120 133
121 filterEngine->GetSubscription(url)->AddToList(); 134 filterEngine->GetSubscription(url)->AddToList();
122 break; 135 break;
123 } 136 }
137 case Communication::PROC_ADD_SUBSCRIPTION:
138 {
139 std::string url;
140 request >> url;
141
142 filterEngine->GetSubscription(url)->AddToList();
143 break;
144 }
145 case Communication::PROC_REMOVE_SUBSCRIPTION:
146 {
147 std::string url;
148 request >> url;
149
150 filterEngine->GetSubscription(url)->RemoveFromList();
151 break;
152 }
124 case Communication::PROC_UPDATE_ALL_SUBSCRIPTIONS: 153 case Communication::PROC_UPDATE_ALL_SUBSCRIPTIONS:
125 { 154 {
126 std::vector<AdblockPlus::SubscriptionPtr> subscriptions = filterEngine-> GetListedSubscriptions(); 155 std::vector<AdblockPlus::SubscriptionPtr> subscriptions = filterEngine-> GetListedSubscriptions();
127 for (size_t i = 0, count = subscriptions.size(); i < count; i++) 156 for (size_t i = 0, count = subscriptions.size(); i < count; i++)
128 subscriptions[i]->UpdateFilters(); 157 subscriptions[i]->UpdateFilters();
129 break; 158 break;
130 } 159 }
131 case Communication::PROC_GET_EXCEPTION_DOMAINS: 160 case Communication::PROC_GET_EXCEPTION_DOMAINS:
132 { 161 {
133 std::vector<AdblockPlus::FilterPtr> filters = filterEngine->GetListedFil ters(); 162 std::vector<AdblockPlus::FilterPtr> filters = filterEngine->GetListedFil ters();
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 } 447 }
419 catch (std::runtime_error e) 448 catch (std::runtime_error e)
420 { 449 {
421 DebugException(e); 450 DebugException(e);
422 return 1; 451 return 1;
423 } 452 }
424 } 453 }
425 454
426 return 0; 455 return 0;
427 } 456 }
OLDNEW
« no previous file with comments | « locales/uk.ini ('k') | src/plugin/AdblockPlus.rc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld