| 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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 this, callback, std::placeholders::_1)); | 478 this, callback, std::placeholders::_1)); |
| 479 } | 479 } |
| 480 | 480 |
| 481 void FilterEngine::RemoveFilterChangeCallback() | 481 void FilterEngine::RemoveFilterChangeCallback() |
| 482 { | 482 { |
| 483 jsEngine->RemoveEventCallback("filterChange"); | 483 jsEngine->RemoveEventCallback("filterChange"); |
| 484 } | 484 } |
| 485 | 485 |
| 486 void FilterEngine::SetAllowedConnectionType(const std::string* value) | 486 void FilterEngine::SetAllowedConnectionType(const std::string* value) |
| 487 { | 487 { |
| 488 SetPref("allowed_connection_type", value ? jsEngine->NewValue(*value) : nullpt
r); | 488 SetPref("allowed_connection_type", value ? jsEngine->NewValue(*value) : jsEngi
ne->NewValue("")); |
| 489 } | 489 } |
| 490 | 490 |
| 491 std::unique_ptr<std::string> FilterEngine::GetAllowedConnectionType() const | 491 std::unique_ptr<std::string> FilterEngine::GetAllowedConnectionType() const |
| 492 { | 492 { |
| 493 auto prefValue = GetPref("allowed_connection_type"); | 493 auto prefValue = GetPref("allowed_connection_type"); |
| 494 if (prefValue->IsUndefined()) | 494 if (prefValue->AsString().empty()) |
| 495 return nullptr; | 495 return nullptr; |
| 496 return std::unique_ptr<std::string>(new std::string(prefValue->AsString())); | 496 return std::unique_ptr<std::string>(new std::string(prefValue->AsString())); |
| 497 } | 497 } |
| 498 | 498 |
| 499 void FilterEngine::FilterChanged(FilterEngine::FilterChangeCallback callback, Js
ValueList& params) | 499 void FilterEngine::FilterChanged(FilterEngine::FilterChangeCallback callback, Js
ValueList& params) |
| 500 { | 500 { |
| 501 std::string action(params.size() >= 1 && !params[0]->IsNull() ? params[0]->AsS
tring() : ""); | 501 std::string action(params.size() >= 1 && !params[0]->IsNull() ? params[0]->AsS
tring() : ""); |
| 502 JsValuePtr item(params.size() >= 2 ? params[1] : jsEngine->NewValue(false)); | 502 JsValuePtr item(params.size() >= 2 ? params[1] : jsEngine->NewValue(false)); |
| 503 callback(action, item); | 503 callback(action, item); |
| 504 } | 504 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 FilterPtr filter = GetWhitelistingFilter(currentUrl, contentTypeMask, parent
Url); | 554 FilterPtr filter = GetWhitelistingFilter(currentUrl, contentTypeMask, parent
Url); |
| 555 if (filter) | 555 if (filter) |
| 556 { | 556 { |
| 557 return filter; | 557 return filter; |
| 558 } | 558 } |
| 559 currentUrl = parentUrl; | 559 currentUrl = parentUrl; |
| 560 } | 560 } |
| 561 while (urlIterator != documentUrls.end()); | 561 while (urlIterator != documentUrls.end()); |
| 562 return FilterPtr(); | 562 return FilterPtr(); |
| 563 } | 563 } |
| OLD | NEW |