| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 * The first parameter is the action event code (see | 204 * The first parameter is the action event code (see |
| 205 * [FilterNotifier.triggerListeners](https://adblockplus.org/jsdoc/adblockpl
uscore/FilterNotifier.html#.triggerListeners) | 205 * [FilterNotifier.triggerListeners](https://adblockplus.org/jsdoc/adblockpl
uscore/FilterNotifier.html#.triggerListeners) |
| 206 * for the full list). | 206 * for the full list). |
| 207 * The second parameter is the filter/subscription object affected, if any. | 207 * The second parameter is the filter/subscription object affected, if any. |
| 208 */ | 208 */ |
| 209 typedef std::function<void(const std::string&, const JsValue&)> FilterChange
Callback; | 209 typedef std::function<void(const std::string&, const JsValue&)> FilterChange
Callback; |
| 210 | 210 |
| 211 /** | 211 /** |
| 212 * Container of name-value pairs representing a set of preferences. | 212 * Container of name-value pairs representing a set of preferences. |
| 213 */ | 213 */ |
| 214 typedef std::map<std::string, AdblockPlus::JsValuePtr> Prefs; | 214 typedef std::map<std::string, AdblockPlus::JsValue> Prefs; |
| 215 | 215 |
| 216 /** | 216 /** |
| 217 * Callback type invoked when a new notification should be shown. | 217 * Callback type invoked when a new notification should be shown. |
| 218 * The parameter is the Notification object to be shown. | 218 * The parameter is the Notification object to be shown. |
| 219 */ | 219 */ |
| 220 typedef std::function<void(const NotificationPtr&)> ShowNotificationCallback
; | 220 typedef std::function<void(const NotificationPtr&)> ShowNotificationCallback
; |
| 221 | 221 |
| 222 /** | 222 /** |
| 223 * Callback function returning false when current connection is not | 223 * Callback function returning false when current connection is not |
| 224 * allowedConnectionType, e.g. because it is a metered connection. | 224 * allowedConnectionType, e.g. because it is a metered connection. |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 * @param domain Domain to retrieve CSS selectors for. | 421 * @param domain Domain to retrieve CSS selectors for. |
| 422 * @return List of CSS selectors. | 422 * @return List of CSS selectors. |
| 423 */ | 423 */ |
| 424 std::vector<std::string> GetElementHidingSelectors(const std::string& domain
) const; | 424 std::vector<std::string> GetElementHidingSelectors(const std::string& domain
) const; |
| 425 | 425 |
| 426 /** | 426 /** |
| 427 * Retrieves a preference value. | 427 * Retrieves a preference value. |
| 428 * @param pref Preference name. | 428 * @param pref Preference name. |
| 429 * @return Preference value, or `null` if it doesn't exist. | 429 * @return Preference value, or `null` if it doesn't exist. |
| 430 */ | 430 */ |
| 431 JsValuePtr GetPref(const std::string& pref) const; | 431 JsValue GetPref(const std::string& pref) const; |
| 432 | 432 |
| 433 /** | 433 /** |
| 434 * Sets a preference value. | 434 * Sets a preference value. |
| 435 * @param pref Preference name. | 435 * @param pref Preference name. |
| 436 * @param value New value of the preference. | 436 * @param value New value of the preference. |
| 437 */ | 437 */ |
| 438 void SetPref(const std::string& pref, const JsValuePtr& value); | 438 void SetPref(const std::string& pref, const JsValue& value); |
| 439 | 439 |
| 440 /** | 440 /** |
| 441 * Extracts the host from a URL. | 441 * Extracts the host from a URL. |
| 442 * @param url URL to extract the host from. | 442 * @param url URL to extract the host from. |
| 443 * @return Extracted host. | 443 * @return Extracted host. |
| 444 */ | 444 */ |
| 445 std::string GetHostFromURL(const std::string& url) const; | 445 std::string GetHostFromURL(const std::string& url) const; |
| 446 | 446 |
| 447 /** | 447 /** |
| 448 * Sets the callback invoked when an application update becomes available. | 448 * Sets the callback invoked when an application update becomes available. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 JsEnginePtr jsEngine; | 527 JsEnginePtr jsEngine; |
| 528 bool firstRun; | 528 bool firstRun; |
| 529 int updateCheckId; | 529 int updateCheckId; |
| 530 static const std::map<ContentType, std::string> contentTypes; | 530 static const std::map<ContentType, std::string> contentTypes; |
| 531 | 531 |
| 532 explicit FilterEngine(const JsEnginePtr& jsEngine); | 532 explicit FilterEngine(const JsEnginePtr& jsEngine); |
| 533 | 533 |
| 534 FilterPtr CheckFilterMatch(const std::string& url, | 534 FilterPtr CheckFilterMatch(const std::string& url, |
| 535 ContentTypeMask contentTypeMask, | 535 ContentTypeMask contentTypeMask, |
| 536 const std::string& documentUrl) const; | 536 const std::string& documentUrl) const; |
| 537 void UpdateAvailable(const UpdateAvailableCallback& callback, const JsConstV
alueList& params) const; | 537 void UpdateAvailable(const UpdateAvailableCallback& callback, const JsValueL
ist& params) const; |
| 538 void UpdateCheckDone(const std::string& eventName, | 538 void UpdateCheckDone(const std::string& eventName, |
| 539 const UpdateCheckDoneCallback& callback, const JsConstV
alueList& params); | 539 const UpdateCheckDoneCallback& callback, const JsValueL
ist& params); |
| 540 void FilterChanged(const FilterChangeCallback& callback, const JsConstValueL
ist& params) const; | 540 void FilterChanged(const FilterChangeCallback& callback, const JsValueList&
params) const; |
| 541 void ShowNotification(const ShowNotificationCallback& callback, | 541 void ShowNotification(const ShowNotificationCallback& callback, |
| 542 const JsConstValueList& param) const; | 542 const JsValueList& param) const; |
| 543 FilterPtr GetWhitelistingFilter(const std::string& url, | 543 FilterPtr GetWhitelistingFilter(const std::string& url, |
| 544 ContentTypeMask contentTypeMask, const std::string& documentUrl) const; | 544 ContentTypeMask contentTypeMask, const std::string& documentUrl) const; |
| 545 FilterPtr GetWhitelistingFilter(const std::string& url, | 545 FilterPtr GetWhitelistingFilter(const std::string& url, |
| 546 ContentTypeMask contentTypeMask, | 546 ContentTypeMask contentTypeMask, |
| 547 const std::vector<std::string>& documentUrls) const; | 547 const std::vector<std::string>& documentUrls) const; |
| 548 }; | 548 }; |
| 549 } | 549 } |
| 550 | 550 |
| 551 #endif | 551 #endif |
| OLD | NEW |