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: address comment Created March 16, 2017, 2:38 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
« no previous file with comments | « README.md ('k') | include/AdblockPlus/JsEngine.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/AdblockPlus/FilterEngine.h
diff --git a/include/AdblockPlus/FilterEngine.h b/include/AdblockPlus/FilterEngine.h
index dcf15a26604b4ca6d5f1484881b74303c0348478..a0cd962b2894292567bd14ff999a416c71085037 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 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.
« no previous file with comments | « README.md ('k') | include/AdblockPlus/JsEngine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld