| LEFT | RIGHT |
| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 { | 70 { |
| 71 JsValue func = jsEngine->Evaluate("API.removeFilterFromList"); | 71 JsValue func = jsEngine->Evaluate("API.removeFilterFromList"); |
| 72 func.Call(*this); | 72 func.Call(*this); |
| 73 } | 73 } |
| 74 | 74 |
| 75 bool Filter::operator==(const Filter& filter) const | 75 bool Filter::operator==(const Filter& filter) const |
| 76 { | 76 { |
| 77 return GetProperty("text").AsString() == filter.GetProperty("text").AsString()
; | 77 return GetProperty("text").AsString() == filter.GetProperty("text").AsString()
; |
| 78 } | 78 } |
| 79 | 79 |
| 80 Subscription::Subscription(const Subscription& src) |
| 81 : JsValue(src) |
| 82 { |
| 83 } |
| 84 |
| 85 Subscription::Subscription(Subscription&& src) |
| 86 : JsValue(std::move(src)) |
| 87 { |
| 88 } |
| 89 |
| 80 Subscription::Subscription(JsValue&& value) | 90 Subscription::Subscription(JsValue&& value) |
| 81 : JsValue(std::move(value)) | 91 : JsValue(std::move(value)) |
| 82 { | 92 { |
| 83 if (!IsObject()) | 93 if (!IsObject()) |
| 84 throw std::runtime_error("JavaScript value is not an object"); | 94 throw std::runtime_error("JavaScript value is not an object"); |
| 95 } |
| 96 |
| 97 Subscription& Subscription::operator=(const Subscription& src) |
| 98 { |
| 99 static_cast<JsValue&>(*this) = src; |
| 100 return *this; |
| 101 } |
| 102 |
| 103 Subscription& Subscription::operator=(Subscription&& src) |
| 104 { |
| 105 static_cast<JsValue&>(*this) = std::move(src); |
| 106 return *this; |
| 85 } | 107 } |
| 86 | 108 |
| 87 bool Subscription::IsListed() const | 109 bool Subscription::IsListed() const |
| 88 { | 110 { |
| 89 JsValue func = jsEngine->Evaluate("API.isListedSubscription"); | 111 JsValue func = jsEngine->Evaluate("API.isListedSubscription"); |
| 90 return func.Call(*this).AsBool(); | 112 return func.Call(*this).AsBool(); |
| 91 } | 113 } |
| 92 | 114 |
| 93 void Subscription::AddToList() | 115 void Subscription::AddToList() |
| 94 { | 116 { |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 void FilterEngine::ShowNotification(const ShowNotificationCallback& callback, | 547 void FilterEngine::ShowNotification(const ShowNotificationCallback& callback, |
| 526 const JsValueList& params) const | 548 const JsValueList& params) const |
| 527 { | 549 { |
| 528 if (params.size() < 1) | 550 if (params.size() < 1) |
| 529 return; | 551 return; |
| 530 | 552 |
| 531 if (!params[0].IsObject()) | 553 if (!params[0].IsObject()) |
| 532 { | 554 { |
| 533 return; | 555 return; |
| 534 } | 556 } |
| 535 callback(Notification(JsValue(params[0]))); | 557 auto notification = Notification(JsValue(params[0])); |
| 558 callback(notification); |
| 536 } | 559 } |
| 537 | 560 |
| 538 | 561 |
| 539 int FilterEngine::CompareVersions(const std::string& v1, const std::string& v2)
const | 562 int FilterEngine::CompareVersions(const std::string& v1, const std::string& v2)
const |
| 540 { | 563 { |
| 541 JsValueList params; | 564 JsValueList params; |
| 542 params.push_back(jsEngine->NewValue(v1)); | 565 params.push_back(jsEngine->NewValue(v1)); |
| 543 params.push_back(jsEngine->NewValue(v2)); | 566 params.push_back(jsEngine->NewValue(v2)); |
| 544 JsValue func = jsEngine->Evaluate("API.compareVersions"); | 567 JsValue func = jsEngine->Evaluate("API.compareVersions"); |
| 545 return func.Call(params).AsInt(); | 568 return func.Call(params).AsInt(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 573 FilterPtr filter = GetWhitelistingFilter(currentUrl, contentTypeMask, parent
Url); | 596 FilterPtr filter = GetWhitelistingFilter(currentUrl, contentTypeMask, parent
Url); |
| 574 if (filter) | 597 if (filter) |
| 575 { | 598 { |
| 576 return filter; | 599 return filter; |
| 577 } | 600 } |
| 578 currentUrl = parentUrl; | 601 currentUrl = parentUrl; |
| 579 } | 602 } |
| 580 while (urlIterator != documentUrls.end()); | 603 while (urlIterator != documentUrls.end()); |
| 581 return FilterPtr(); | 604 return FilterPtr(); |
| 582 } | 605 } |
| LEFT | RIGHT |