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: rebase Created March 16, 2017, 4:02 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 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.
« 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