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

Unified Diff: src/FilterEngine.cpp

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 | « include/AdblockPlus/FilterEngine.h ('k') | test/FilterEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/FilterEngine.cpp
===================================================================
--- a/src/FilterEngine.cpp
+++ b/src/FilterEngine.cpp
@@ -340,7 +340,28 @@
return func->Call(params)->AsString();
}
-void FilterEngine::ForceUpdateCheck(FilterEngine::UpdaterCallback callback)
+void FilterEngine::SetUpdateAvailableCallback(
+ FilterEngine::UpdateAvailableCallback callback)
+{
+ jsEngine->SetEventCallback("updateAvailable",
+ std::tr1::bind(&FilterEngine::UpdateAvailable, this, callback,
+ std::tr1::placeholders::_1));
+}
+
+void FilterEngine::RemoveUpdateAvailableCallback()
+{
+ jsEngine->RemoveEventCallback("updateAvailable");
+}
+
+void FilterEngine::UpdateAvailable(
+ FilterEngine::UpdateAvailableCallback callback, JsValueList& params)
+{
+ if (params.size() >= 1 && !params[0]->IsNull())
+ callback(params[0]->AsString());
+}
+
+void FilterEngine::ForceUpdateCheck(
+ FilterEngine::UpdateCheckDoneCallback callback)
{
std::string eventName = "updateCheckDone";
eventName += ++updateCheckId;
@@ -354,7 +375,8 @@
func->Call(params);
}
-void FilterEngine::UpdateCheckDone(const std::string& eventName, FilterEngine::UpdaterCallback callback, JsValueList& params)
+void FilterEngine::UpdateCheckDone(const std::string& eventName,
+ FilterEngine::UpdateCheckDoneCallback callback, JsValueList& params)
{
jsEngine->RemoveEventCallback(eventName);
« no previous file with comments | « include/AdblockPlus/FilterEngine.h ('k') | test/FilterEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld