Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: include/AdblockPlus/FilterEngine.h

Issue 29377570: Issue 4931 - add possibility to not send data depending on connection properties (Closed)
Patch Set: Created Feb. 28, 2017, 2:22 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: include/AdblockPlus/FilterEngine.h
diff --git a/include/AdblockPlus/FilterEngine.h b/include/AdblockPlus/FilterEngine.h
index dcf15a26604b4ca6d5f1484881b74303c0348478..1d1199a3968cbbc814c342897ca549d76e50f0d1 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 CreateParameters
@@ -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 isConnectionAllowed;
};
/**
@@ -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 `null` if it doesn't exist.
+ */
+ JsValuePtr GetAllowedConnectionType();
+
+ /**
* Compares two version strings in
* [Mozilla toolkit version format](https://developer.mozilla.org/en/docs/Toolkit_version_format).
* @param v1 First version string.
« no previous file with comments | « README.md ('k') | include/AdblockPlus/JsEngine.h » ('j') | src/WebRequestJsObject.cpp » ('J')

Powered by Google App Engine
This is Rietveld