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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 JsValuePtr func = jsEngine->Evaluate("API.updateSubscription"); | 107 JsValuePtr func = jsEngine->Evaluate("API.updateSubscription"); |
108 func->Call(*this); | 108 func->Call(*this); |
109 } | 109 } |
110 | 110 |
111 bool Subscription::IsUpdating() const | 111 bool Subscription::IsUpdating() const |
112 { | 112 { |
113 JsValuePtr func = jsEngine->Evaluate("API.isSubscriptionUpdating"); | 113 JsValuePtr func = jsEngine->Evaluate("API.isSubscriptionUpdating"); |
114 return func->Call(*this).AsBool(); | 114 return func->Call(*this).AsBool(); |
115 } | 115 } |
116 | 116 |
| 117 bool Subscription::IsAA() const |
| 118 { |
| 119 return jsEngine->Evaluate("API.isAASubscription")->Call(*this).AsBool(); |
| 120 } |
| 121 |
117 bool Subscription::operator==(const Subscription& subscription) const | 122 bool Subscription::operator==(const Subscription& subscription) const |
118 { | 123 { |
119 return GetProperty("url")->AsString() == subscription.GetProperty("url")->AsSt
ring(); | 124 return GetProperty("url")->AsString() == subscription.GetProperty("url")->AsSt
ring(); |
120 } | 125 } |
121 | 126 |
122 namespace | 127 namespace |
123 { | 128 { |
124 class Sync | 129 class Sync |
125 { | 130 { |
126 public: | 131 public: |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 std::vector<SubscriptionPtr> FilterEngine::FetchAvailableSubscriptions() const | 311 std::vector<SubscriptionPtr> FilterEngine::FetchAvailableSubscriptions() const |
307 { | 312 { |
308 JsValuePtr func = jsEngine->Evaluate("API.getRecommendedSubscriptions"); | 313 JsValuePtr func = jsEngine->Evaluate("API.getRecommendedSubscriptions"); |
309 JsValueList values = func->Call().AsList(); | 314 JsValueList values = func->Call().AsList(); |
310 std::vector<SubscriptionPtr> result; | 315 std::vector<SubscriptionPtr> result; |
311 for (JsValueList::iterator it = values.begin(); it != values.end(); it++) | 316 for (JsValueList::iterator it = values.begin(); it != values.end(); it++) |
312 result.push_back(SubscriptionPtr(new Subscription(std::move(**it)))); | 317 result.push_back(SubscriptionPtr(new Subscription(std::move(**it)))); |
313 return result; | 318 return result; |
314 } | 319 } |
315 | 320 |
| 321 void FilterEngine::SetAAEnabled(bool enabled) |
| 322 { |
| 323 jsEngine->Evaluate("API.setAASubscriptionEnabled")->Call(*jsEngine->NewValue(e
nabled)); |
| 324 } |
| 325 |
| 326 bool FilterEngine::IsAAEnabled() const |
| 327 { |
| 328 return jsEngine->Evaluate("API.isAASubscriptionEnabled()")->AsBool(); |
| 329 } |
| 330 |
| 331 std::string FilterEngine::GetAAUrl() const |
| 332 { |
| 333 return GetPref("subscriptions_exceptionsurl")->AsString(); |
| 334 } |
| 335 |
316 void FilterEngine::ShowNextNotification(const std::string& url) | 336 void FilterEngine::ShowNextNotification(const std::string& url) |
317 { | 337 { |
318 JsValuePtr func = jsEngine->Evaluate("API.showNextNotification"); | 338 JsValuePtr func = jsEngine->Evaluate("API.showNextNotification"); |
319 JsConstValueList params; | 339 JsConstValueList params; |
320 if (!url.empty()) | 340 if (!url.empty()) |
321 { | 341 { |
322 params.push_back(jsEngine->NewValue(url)); | 342 params.push_back(jsEngine->NewValue(url)); |
323 } | 343 } |
324 func->Call(params); | 344 func->Call(params); |
325 } | 345 } |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 FilterPtr filter = GetWhitelistingFilter(currentUrl, contentTypeMask, parent
Url); | 574 FilterPtr filter = GetWhitelistingFilter(currentUrl, contentTypeMask, parent
Url); |
555 if (filter) | 575 if (filter) |
556 { | 576 { |
557 return filter; | 577 return filter; |
558 } | 578 } |
559 currentUrl = parentUrl; | 579 currentUrl = parentUrl; |
560 } | 580 } |
561 while (urlIterator != documentUrls.end()); | 581 while (urlIterator != documentUrls.end()); |
562 return FilterPtr(); | 582 return FilterPtr(); |
563 } | 583 } |
OLD | NEW |