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

Side by Side Diff: src/FilterEngine.cpp

Issue 29419623: Issue 5165 - Remove SubscriptionPtr (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Created April 21, 2017, 2:08 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 | « shell/src/SubscriptionsCommand.cpp ('k') | test/FilterEngine.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 { 275 {
276 return firstRun; 276 return firstRun;
277 } 277 }
278 278
279 Filter FilterEngine::GetFilter(const std::string& text) const 279 Filter FilterEngine::GetFilter(const std::string& text) const
280 { 280 {
281 JsValue func = jsEngine->Evaluate("API.getFilterFromText"); 281 JsValue func = jsEngine->Evaluate("API.getFilterFromText");
282 return Filter(func.Call(jsEngine->NewValue(text))); 282 return Filter(func.Call(jsEngine->NewValue(text)));
283 } 283 }
284 284
285 SubscriptionPtr FilterEngine::GetSubscription(const std::string& url) const 285 Subscription FilterEngine::GetSubscription(const std::string& url) const
286 { 286 {
287 JsValue func = jsEngine->Evaluate("API.getSubscriptionFromUrl"); 287 JsValue func = jsEngine->Evaluate("API.getSubscriptionFromUrl");
288 return SubscriptionPtr(new Subscription(func.Call(jsEngine->NewValue(url)))); 288 return Subscription(func.Call(jsEngine->NewValue(url)));
289 } 289 }
290 290
291 std::vector<Filter> FilterEngine::GetListedFilters() const 291 std::vector<Filter> FilterEngine::GetListedFilters() const
292 { 292 {
293 JsValue func = jsEngine->Evaluate("API.getListedFilters"); 293 JsValue func = jsEngine->Evaluate("API.getListedFilters");
294 JsValueList values = func.Call().AsList(); 294 JsValueList values = func.Call().AsList();
295 std::vector<Filter> result; 295 std::vector<Filter> result;
296 for (JsValueList::iterator it = values.begin(); it != values.end(); it++) 296 for (JsValueList::iterator it = values.begin(); it != values.end(); it++)
297 result.push_back(Filter(std::move(*it))); 297 result.push_back(Filter(std::move(*it)));
298 return result; 298 return result;
299 } 299 }
300 300
301 std::vector<SubscriptionPtr> FilterEngine::GetListedSubscriptions() const 301 std::vector<Subscription> FilterEngine::GetListedSubscriptions() const
302 { 302 {
303 JsValue func = jsEngine->Evaluate("API.getListedSubscriptions"); 303 JsValue func = jsEngine->Evaluate("API.getListedSubscriptions");
304 JsValueList values = func.Call().AsList(); 304 JsValueList values = func.Call().AsList();
305 std::vector<SubscriptionPtr> result; 305 std::vector<Subscription> result;
306 for (JsValueList::iterator it = values.begin(); it != values.end(); it++) 306 for (JsValueList::iterator it = values.begin(); it != values.end(); it++)
307 result.push_back(SubscriptionPtr(new Subscription(std::move(*it)))); 307 result.push_back(Subscription(std::move(*it)));
308 return result; 308 return result;
309 } 309 }
310 310
311 std::vector<SubscriptionPtr> FilterEngine::FetchAvailableSubscriptions() const 311 std::vector<Subscription> FilterEngine::FetchAvailableSubscriptions() const
312 { 312 {
313 JsValue func = jsEngine->Evaluate("API.getRecommendedSubscriptions"); 313 JsValue func = jsEngine->Evaluate("API.getRecommendedSubscriptions");
314 JsValueList values = func.Call().AsList(); 314 JsValueList values = func.Call().AsList();
315 std::vector<SubscriptionPtr> result; 315 std::vector<Subscription> result;
316 for (JsValueList::iterator it = values.begin(); it != values.end(); it++) 316 for (JsValueList::iterator it = values.begin(); it != values.end(); it++)
317 result.push_back(SubscriptionPtr(new Subscription(std::move(*it)))); 317 result.push_back(Subscription(std::move(*it)));
318 return result; 318 return result;
319 } 319 }
320 320
321 void FilterEngine::SetAAEnabled(bool enabled) 321 void FilterEngine::SetAAEnabled(bool enabled)
322 { 322 {
323 jsEngine->Evaluate("API.setAASubscriptionEnabled").Call(jsEngine->NewValue(ena bled)); 323 jsEngine->Evaluate("API.setAASubscriptionEnabled").Call(jsEngine->NewValue(ena bled));
324 } 324 }
325 325
326 bool FilterEngine::IsAAEnabled() const 326 bool FilterEngine::IsAAEnabled() const
327 { 327 {
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 FilterPtr filter = GetWhitelistingFilter(currentUrl, contentTypeMask, parent Url); 573 FilterPtr filter = GetWhitelistingFilter(currentUrl, contentTypeMask, parent Url);
574 if (filter) 574 if (filter)
575 { 575 {
576 return filter; 576 return filter;
577 } 577 }
578 currentUrl = parentUrl; 578 currentUrl = parentUrl;
579 } 579 }
580 while (urlIterator != documentUrls.end()); 580 while (urlIterator != documentUrls.end());
581 return FilterPtr(); 581 return FilterPtr();
582 } 582 }
OLDNEW
« no previous file with comments | « shell/src/SubscriptionsCommand.cpp ('k') | test/FilterEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld