OLD | NEW |
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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 return contentType.first; | 269 return contentType.first; |
270 } | 270 } |
271 throw std::invalid_argument("Cannot convert argument to ContentType"); | 271 throw std::invalid_argument("Cannot convert argument to ContentType"); |
272 } | 272 } |
273 | 273 |
274 bool FilterEngine::IsFirstRun() const | 274 bool FilterEngine::IsFirstRun() const |
275 { | 275 { |
276 return firstRun; | 276 return firstRun; |
277 } | 277 } |
278 | 278 |
279 FilterPtr 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 FilterPtr(new 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 SubscriptionPtr 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 SubscriptionPtr(new Subscription(func.Call(jsEngine->NewValue(url)))); |
289 } | 289 } |
290 | 290 |
291 std::vector<FilterPtr> 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<FilterPtr> 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(FilterPtr(new 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<SubscriptionPtr> 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<SubscriptionPtr> 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(SubscriptionPtr(new Subscription(std::move(*it)))); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
OLD | NEW |