| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 * Filter types, see https://adblockplus.org/en/filters. | 45 * Filter types, see https://adblockplus.org/en/filters. |
| 46 */ | 46 */ |
| 47 enum Type {TYPE_BLOCKING, TYPE_EXCEPTION, | 47 enum Type {TYPE_BLOCKING, TYPE_EXCEPTION, |
| 48 TYPE_ELEMHIDE, TYPE_ELEMHIDE_EXCEPTION, | 48 TYPE_ELEMHIDE, TYPE_ELEMHIDE_EXCEPTION, |
| 49 TYPE_COMMENT, TYPE_INVALID}; | 49 TYPE_COMMENT, TYPE_INVALID}; |
| 50 | 50 |
| 51 /** | 51 /** |
| 52 * Retrieves the type of this filter. | 52 * Retrieves the type of this filter. |
| 53 * @return Type of this filter. | 53 * @return Type of this filter. |
| 54 */ | 54 */ |
| 55 Type GetType(); | 55 Type GetType() const; |
| 56 | 56 |
| 57 /** | 57 /** |
| 58 * Checks whether this filter has been added to the list of custom filters. | 58 * Checks whether this filter has been added to the list of custom filters. |
| 59 * @return `true` if this filter has been added. | 59 * @return `true` if this filter has been added. |
| 60 */ | 60 */ |
| 61 bool IsListed(); | 61 bool IsListed() const; |
| 62 | 62 |
| 63 /** | 63 /** |
| 64 * Adds this filter to the list of custom filters. | 64 * Adds this filter to the list of custom filters. |
| 65 */ | 65 */ |
| 66 void AddToList(); | 66 void AddToList(); |
| 67 | 67 |
| 68 /** | 68 /** |
| 69 * Removes this filter from the list of custom filters. | 69 * Removes this filter from the list of custom filters. |
| 70 */ | 70 */ |
| 71 void RemoveFromList(); | 71 void RemoveFromList(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 88 * use `GetProperty()` to retrieve them by name. | 88 * use `GetProperty()` to retrieve them by name. |
| 89 */ | 89 */ |
| 90 class Subscription : public JsValue, | 90 class Subscription : public JsValue, |
| 91 public std::enable_shared_from_this<Subscription> | 91 public std::enable_shared_from_this<Subscription> |
| 92 { | 92 { |
| 93 public: | 93 public: |
| 94 /** | 94 /** |
| 95 * Checks if this subscription has been added to the list of subscriptions. | 95 * Checks if this subscription has been added to the list of subscriptions. |
| 96 * @return `true` if this subscription has been added. | 96 * @return `true` if this subscription has been added. |
| 97 */ | 97 */ |
| 98 bool IsListed(); | 98 bool IsListed() const; |
| 99 | 99 |
| 100 /** | 100 /** |
| 101 * Adds this subscription to the list of subscriptions. | 101 * Adds this subscription to the list of subscriptions. |
| 102 */ | 102 */ |
| 103 void AddToList(); | 103 void AddToList(); |
| 104 | 104 |
| 105 /** | 105 /** |
| 106 * Removes this subscription from the list of subscriptions. | 106 * Removes this subscription from the list of subscriptions. |
| 107 */ | 107 */ |
| 108 void RemoveFromList(); | 108 void RemoveFromList(); |
| 109 | 109 |
| 110 /** | 110 /** |
| 111 * Updates this subscription, i.e.\ retrieves the current filters from the | 111 * Updates this subscription, i.e.\ retrieves the current filters from the |
| 112 * subscription URL. | 112 * subscription URL. |
| 113 */ | 113 */ |
| 114 void UpdateFilters(); | 114 void UpdateFilters(); |
| 115 | 115 |
| 116 /** | 116 /** |
| 117 * Checks if the subscription is currently being updated. | 117 * Checks if the subscription is currently being updated. |
| 118 * @return `true` if the subscription is currently being updated. | 118 * @return `true` if the subscription is currently being updated. |
| 119 */ | 119 */ |
| 120 bool IsUpdating(); | 120 bool IsUpdating() const; |
| 121 | 121 |
| 122 bool operator==(const Subscription& subscription) const; | 122 bool operator==(const Subscription& subscription) const; |
| 123 | 123 |
| 124 /** | 124 /** |
| 125 * Creates a wrapper for an existing JavaScript subscription object. | 125 * Creates a wrapper for an existing JavaScript subscription object. |
| 126 * Normally you shouldn't call this directly, but use | 126 * Normally you shouldn't call this directly, but use |
| 127 * FilterEngine::GetSubscription() instead. | 127 * FilterEngine::GetSubscription() instead. |
| 128 * @param value JavaScript subscription object. | 128 * @param value JavaScript subscription object. |
| 129 */ | 129 */ |
| 130 Subscription(JsValue&& value); | 130 Subscription(JsValue&& value); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 * @return `true` if the application is running for the first time. | 272 * @return `true` if the application is running for the first time. |
| 273 */ | 273 */ |
| 274 bool IsFirstRun() const; | 274 bool IsFirstRun() const; |
| 275 | 275 |
| 276 /** | 276 /** |
| 277 * Retrieves a filter object from its text representation. | 277 * Retrieves a filter object from its text representation. |
| 278 * @param text Text representation of the filter, | 278 * @param text Text representation of the filter, |
| 279 * see https://adblockplus.org/en/filters. | 279 * see https://adblockplus.org/en/filters. |
| 280 * @return New `Filter` instance. | 280 * @return New `Filter` instance. |
| 281 */ | 281 */ |
| 282 FilterPtr GetFilter(const std::string& text); | 282 FilterPtr GetFilter(const std::string& text) const; |
| 283 | 283 |
| 284 /** | 284 /** |
| 285 * Retrieves a subscription object for the supplied URL. | 285 * Retrieves a subscription object for the supplied URL. |
| 286 * @param url Subscription URL. | 286 * @param url Subscription URL. |
| 287 * @return New `Subscription` instance. | 287 * @return New `Subscription` instance. |
| 288 */ | 288 */ |
| 289 SubscriptionPtr GetSubscription(const std::string& url); | 289 SubscriptionPtr GetSubscription(const std::string& url) const; |
| 290 | 290 |
| 291 /** | 291 /** |
| 292 * Retrieves the list of custom filters. | 292 * Retrieves the list of custom filters. |
| 293 * @return List of custom filters. | 293 * @return List of custom filters. |
| 294 */ | 294 */ |
| 295 std::vector<FilterPtr> GetListedFilters() const; | 295 std::vector<FilterPtr> GetListedFilters() const; |
| 296 | 296 |
| 297 /** | 297 /** |
| 298 * Retrieves all subscriptions. | 298 * Retrieves all subscriptions. |
| 299 * @return List of subscriptions. | 299 * @return List of subscriptions. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 * @param pref Preference name. | 404 * @param pref Preference name. |
| 405 * @param value New value of the preference. | 405 * @param value New value of the preference. |
| 406 */ | 406 */ |
| 407 void SetPref(const std::string& pref, JsValuePtr value); | 407 void SetPref(const std::string& pref, JsValuePtr value); |
| 408 | 408 |
| 409 /** | 409 /** |
| 410 * Extracts the host from a URL. | 410 * Extracts the host from a URL. |
| 411 * @param url URL to extract the host from. | 411 * @param url URL to extract the host from. |
| 412 * @return Extracted host. | 412 * @return Extracted host. |
| 413 */ | 413 */ |
| 414 std::string GetHostFromURL(const std::string& url); | 414 std::string GetHostFromURL(const std::string& url) const; |
| 415 | 415 |
| 416 /** | 416 /** |
| 417 * Sets the callback invoked when an application update becomes available. | 417 * Sets the callback invoked when an application update becomes available. |
| 418 * @param callback Callback to invoke. | 418 * @param callback Callback to invoke. |
| 419 */ | 419 */ |
| 420 void SetUpdateAvailableCallback(UpdateAvailableCallback callback); | 420 void SetUpdateAvailableCallback(UpdateAvailableCallback callback); |
| 421 | 421 |
| 422 /** | 422 /** |
| 423 * Removes the callback invoked when an application update becomes | 423 * Removes the callback invoked when an application update becomes |
| 424 * available. | 424 * available. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 455 * passed to CreateParameters::isConnectionAllowed callback. | 455 * passed to CreateParameters::isConnectionAllowed callback. |
| 456 * @param value Stored value. nullptr means removing of any previously | 456 * @param value Stored value. nullptr means removing of any previously |
| 457 * stored value. | 457 * stored value. |
| 458 */ | 458 */ |
| 459 void SetAllowedConnectionType(const std::string* value); | 459 void SetAllowedConnectionType(const std::string* value); |
| 460 | 460 |
| 461 /** | 461 /** |
| 462 * Retrieves previously stored allowed connection type. | 462 * Retrieves previously stored allowed connection type. |
| 463 * @return Preference value, or `nullptr` if it doesn't exist. | 463 * @return Preference value, or `nullptr` if it doesn't exist. |
| 464 */ | 464 */ |
| 465 std::unique_ptr<std::string> GetAllowedConnectionType(); | 465 std::unique_ptr<std::string> GetAllowedConnectionType() const; |
| 466 | 466 |
| 467 /** | 467 /** |
| 468 * Compares two version strings in | 468 * Compares two version strings in |
| 469 * [Mozilla toolkit version format](https://developer.mozilla.org/en/docs/To
olkit_version_format). | 469 * [Mozilla toolkit version format](https://developer.mozilla.org/en/docs/To
olkit_version_format). |
| 470 * @param v1 First version string. | 470 * @param v1 First version string. |
| 471 * @param v2 Second version string. | 471 * @param v2 Second version string. |
| 472 * @return | 472 * @return |
| 473 * - `0` if `v1` and `v2` are identical. | 473 * - `0` if `v1` and `v2` are identical. |
| 474 * - A negative number if `v1` is less than `v2`. | 474 * - A negative number if `v1` is less than `v2`. |
| 475 * - A positive number if `v1` is greater than `v2`. | 475 * - A positive number if `v1` is greater than `v2`. |
| 476 */ | 476 */ |
| 477 int CompareVersions(const std::string& v1, const std::string& v2); | 477 int CompareVersions(const std::string& v1, const std::string& v2) const; |
| 478 | 478 |
| 479 /** | 479 /** |
| 480 * Retrieves the `ContentType` for the supplied string. | 480 * Retrieves the `ContentType` for the supplied string. |
| 481 * @param contentType Content type string. | 481 * @param contentType Content type string. |
| 482 * @return The `ContentType` for the string. | 482 * @return The `ContentType` for the string. |
| 483 * @throw `std::invalid_argument`, if an invalid `contentType` was supplied. | 483 * @throw `std::invalid_argument`, if an invalid `contentType` was supplied. |
| 484 */ | 484 */ |
| 485 static ContentType StringToContentType(const std::string& contentType); | 485 static ContentType StringToContentType(const std::string& contentType); |
| 486 | 486 |
| 487 /** | 487 /** |
| (...skipping 23 matching lines...) Expand all Loading... |
| 511 const JsValueList& params); | 511 const JsValueList& params); |
| 512 FilterPtr GetWhitelistingFilter(const std::string& url, | 512 FilterPtr GetWhitelistingFilter(const std::string& url, |
| 513 ContentTypeMask contentTypeMask, const std::string& documentUrl) const; | 513 ContentTypeMask contentTypeMask, const std::string& documentUrl) const; |
| 514 FilterPtr GetWhitelistingFilter(const std::string& url, | 514 FilterPtr GetWhitelistingFilter(const std::string& url, |
| 515 ContentTypeMask contentTypeMask, | 515 ContentTypeMask contentTypeMask, |
| 516 const std::vector<std::string>& documentUrls) const; | 516 const std::vector<std::string>& documentUrls) const; |
| 517 }; | 517 }; |
| 518 } | 518 } |
| 519 | 519 |
| 520 #endif | 520 #endif |
| LEFT | RIGHT |