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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 bool Subscription::IsUpdating() | 125 bool Subscription::IsUpdating() |
126 { | 126 { |
127 JsValuePtr func = jsEngine->Evaluate("API.isSubscriptionUpdating"); | 127 JsValuePtr func = jsEngine->Evaluate("API.isSubscriptionUpdating"); |
128 JsValueList params; | 128 JsValueList params; |
129 params.push_back(shared_from_this()); | 129 params.push_back(shared_from_this()); |
130 JsValuePtr result = func->Call(params); | 130 JsValuePtr result = func->Call(params); |
131 return result->AsBool(); | 131 return result->AsBool(); |
132 } | 132 } |
133 | 133 |
| 134 bool Subscription::IsAA() |
| 135 { |
| 136 return jsEngine->Evaluate("API.isAASubscription")->Call(*shared_from_this())->
AsBool(); |
| 137 } |
| 138 |
134 bool Subscription::operator==(const Subscription& subscription) const | 139 bool Subscription::operator==(const Subscription& subscription) const |
135 { | 140 { |
136 return GetProperty("url")->AsString() == subscription.GetProperty("url")->AsSt
ring(); | 141 return GetProperty("url")->AsString() == subscription.GetProperty("url")->AsSt
ring(); |
137 } | 142 } |
138 | 143 |
139 namespace | 144 namespace |
140 { | 145 { |
141 class Sync | 146 class Sync |
142 { | 147 { |
143 public: | 148 public: |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 std::vector<SubscriptionPtr> FilterEngine::FetchAvailableSubscriptions() const | 333 std::vector<SubscriptionPtr> FilterEngine::FetchAvailableSubscriptions() const |
329 { | 334 { |
330 JsValuePtr func = jsEngine->Evaluate("API.getRecommendedSubscriptions"); | 335 JsValuePtr func = jsEngine->Evaluate("API.getRecommendedSubscriptions"); |
331 JsValueList values = func->Call()->AsList(); | 336 JsValueList values = func->Call()->AsList(); |
332 std::vector<SubscriptionPtr> result; | 337 std::vector<SubscriptionPtr> result; |
333 for (JsValueList::iterator it = values.begin(); it != values.end(); it++) | 338 for (JsValueList::iterator it = values.begin(); it != values.end(); it++) |
334 result.push_back(SubscriptionPtr(new Subscription(std::move(**it)))); | 339 result.push_back(SubscriptionPtr(new Subscription(std::move(**it)))); |
335 return result; | 340 return result; |
336 } | 341 } |
337 | 342 |
| 343 void FilterEngine::SetAAEnabled(bool enabled) |
| 344 { |
| 345 jsEngine->Evaluate("API.setAASubscriptionEnabled")->Call(*jsEngine->NewValue(e
nabled)); |
| 346 } |
| 347 |
| 348 bool FilterEngine::IsAAEnabled() const |
| 349 { |
| 350 return jsEngine->Evaluate("API.isAASubscriptionEnabled()")->AsBool(); |
| 351 } |
| 352 |
| 353 std::string FilterEngine::GetAAUrl() const |
| 354 { |
| 355 return GetPref("subscriptions_exceptionsurl")->AsString(); |
| 356 } |
| 357 |
338 void FilterEngine::ShowNextNotification(const std::string& url) | 358 void FilterEngine::ShowNextNotification(const std::string& url) |
339 { | 359 { |
340 JsValuePtr func = jsEngine->Evaluate("API.showNextNotification"); | 360 JsValuePtr func = jsEngine->Evaluate("API.showNextNotification"); |
341 JsValueList params; | 361 JsValueList params; |
342 if (!url.empty()) | 362 if (!url.empty()) |
343 { | 363 { |
344 params.push_back(jsEngine->NewValue(url)); | 364 params.push_back(jsEngine->NewValue(url)); |
345 } | 365 } |
346 func->Call(params); | 366 func->Call(params); |
347 } | 367 } |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 FilterPtr filter = GetWhitelistingFilter(currentUrl, contentTypeMask, parent
Url); | 604 FilterPtr filter = GetWhitelistingFilter(currentUrl, contentTypeMask, parent
Url); |
585 if (filter) | 605 if (filter) |
586 { | 606 { |
587 return filter; | 607 return filter; |
588 } | 608 } |
589 currentUrl = parentUrl; | 609 currentUrl = parentUrl; |
590 } | 610 } |
591 while (urlIterator != documentUrls.end()); | 611 while (urlIterator != documentUrls.end()); |
592 return FilterPtr(); | 612 return FilterPtr(); |
593 } | 613 } |
OLD | NEW |