Index: include/AdblockPlus/FilterEngine.h |
diff --git a/include/AdblockPlus/FilterEngine.h b/include/AdblockPlus/FilterEngine.h |
index ab35fa2e10530fe6cc64e46166536bc86f1d5d26..f1c779b367c5efb176890ac96764d582aec5db34 100644 |
--- a/include/AdblockPlus/FilterEngine.h |
+++ b/include/AdblockPlus/FilterEngine.h |
@@ -214,6 +214,12 @@ namespace AdblockPlus |
typedef std::function<void(const NotificationPtr&)> ShowNotificationCallback; |
/** |
+ * Callback function returning false when current connection is not |
+ * allowedConnectionType, e.g. because it is a metered connection. |
+ */ |
+ typedef std::function<bool(const std::string* allowedConnectionType)> IsConnectionAllowedCallback; |
+ |
+ /** |
* FilterEngine creation parameters. |
*/ |
struct CreationParameters |
@@ -223,6 +229,12 @@ namespace AdblockPlus |
* prefs. |
*/ |
Prefs preconfiguredPrefs; |
+ /** |
+ * `AdblockPlus::FilterEngine::IsConnectionAllowedCallback` a callback |
+ * checking whether the request from Adblock Plus should be blocked on |
+ * the current connection. |
+ */ |
+ IsConnectionAllowedCallback isConnectionAllowedCallback; |
}; |
/** |
@@ -439,6 +451,20 @@ namespace AdblockPlus |
void RemoveFilterChangeCallback(); |
/** |
+ * Stores the value indicating what connection types are allowed, it is |
+ * passed to CreateParameters::isConnectionAllowed callback. |
+ * @param value Stored value. nullptr means removing of any previously |
+ * stored value. |
+ */ |
+ void SetAllowedConnectionType(const std::string* value); |
+ |
+ /** |
+ * Retrieves previously stored allowed connection type. |
+ * @return Preference value, or `nullptr` if it doesn't exist. |
+ */ |
+ std::unique_ptr<std::string> GetAllowedConnectionType(); |
+ |
+ /** |
* Compares two version strings in |
* [Mozilla toolkit version format](https://developer.mozilla.org/en/docs/Toolkit_version_format). |
* @param v1 First version string. |