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

Unified Diff: include/AdblockPlus/FilterEngine.h

Issue 4578638519336960: Issue 1296 - Add SetUpdateAvailableCallback (Closed)
Patch Set: Fix typo, only invoke callback when the updater passes a URL Created Sept. 19, 2014, 2:51 a.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 | « no previous file | src/FilterEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/AdblockPlus/FilterEngine.h
===================================================================
--- a/include/AdblockPlus/FilterEngine.h
+++ b/include/AdblockPlus/FilterEngine.h
@@ -156,10 +156,18 @@
CONTENT_TYPE_MEDIA};
/**
- * Callback type invoked when an update is available.
- * The parameter is optional error message.
+ * Callback type invoked when an update becomes available.
+ * The parameter is the download URL of the update.
*/
- typedef std::tr1::function<void(const std::string&)> UpdaterCallback;
+ typedef std::tr1::function<void(const std::string&)>
+ UpdateAvailableCallback;
+
+ /**
+ * Callback type invoked when a manually triggered update check finishes.
+ * The parameter is an optional error message.
+ */
+ typedef std::tr1::function<void(const std::string&)>
+ UpdateCheckDoneCallback;
/**
* Callback type invoked when the filters change.
@@ -284,6 +292,18 @@
std::string GetHostFromURL(const std::string& url);
/**
+ * Sets the callback invoked when an application update becomes available.
+ * @param callback Callback to invoke.
+ */
+ void SetUpdateAvailableCallback(UpdateAvailableCallback callback);
+
+ /**
+ * Removes the callback invoked when an application update becomes
+ * available.
+ */
+ void RemoveUpdateAvailableCallback();
+
+ /**
* Forces an immediate update check.
* `FilterEngine` will automatically check for updates in regular intervals,
* so applications should only call this when the user triggers an update
@@ -291,11 +311,11 @@
* @param callback Optional callback to invoke when the update check is
* finished. The string parameter will be empty when the update check
* succeeded, or contain an error message if it failed.
- * Note that the callback will be invoked after every update check -
- * to react to updates being available, register a callback for the
- * "updateAvailable" event (see JsEngine::SetEventCallback()).
+ * Note that the callback will be invoked whether updates are
+ * available or not - to react to updates being available, use
+ * `FilterEngine::SetUpdateAvailableCallback()`.
*/
- void ForceUpdateCheck(UpdaterCallback callback = 0);
+ void ForceUpdateCheck(UpdateCheckDoneCallback callback = 0);
/**
* Sets the callback invoked when the filters change.
@@ -347,7 +367,9 @@
FilterPtr CheckFilterMatch(const std::string& url,
ContentType contentType,
const std::string& documentUrl) const;
- void UpdateCheckDone(const std::string& eventName, UpdaterCallback callback, JsValueList& params);
+ void UpdateAvailable(UpdateAvailableCallback callback, JsValueList& params);
+ void UpdateCheckDone(const std::string& eventName,
+ UpdateCheckDoneCallback callback, JsValueList& params);
void FilterChanged(FilterChangeCallback callback, JsValueList& params);
};
}
« no previous file with comments | « no previous file | src/FilterEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld