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

Unified Diff: src/FilterEngine.cpp

Issue 11018003: Filter changed callback (Closed)
Patch Set: Filter changed callback Created July 19, 2013, 8:33 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
« lib/filterUpdateRegistration.js ('K') | « libadblockplus.gyp ('k') | no next file » | 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
@@ -277,3 +277,21 @@
std::string error(params.size() >= 1 && !params[0]->IsNull() ? params[0]->AsString() : "");
callback(error);
}
+
+void FilterEngine::SetFilterChangeCallback(FilterEngine::FilterChangeCallback callback)
+{
+ jsEngine->SetEventCallback(eventName, std::tr1::bind(&FilterEngine::FilterChanged,
+ this, "filterChange", callback, std::tr1::placeholders::_1));
Wladimir Palant 2013/07/19 09:37:57 Still not point passing "filterChange" to the call
+}
+
+void FilterEngine::RemoveFilterChangeCallback()
+{
+ jsEngine->RemoveEventCallback(eventName);
Wladimir Palant 2013/07/19 09:37:57 Does this even compile with the eventName variable
+}
+
+void FilterEngine::FilterChanged(const std::string& eventName, FilterEngine::FilterChangeCallback callback, JsValueList& params)
+{
+ std::string action(params.size() >= 1 && !params[0]->IsNull() ? params[0]->AsString() : "");
+ std::string url(params.size() >= 2 && !params[1]->IsNull() ? params[1]->AsString() : "");
Wladimir Palant 2013/07/19 09:37:57 Please keep the second parameter generic, somethin
+ callback(action, url);
+}
« lib/filterUpdateRegistration.js ('K') | « libadblockplus.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld