Index: src/FilterEngine.cpp |
=================================================================== |
--- a/src/FilterEngine.cpp |
+++ b/src/FilterEngine.cpp |
@@ -20,6 +20,7 @@ |
#include <functional> |
#include <string> |
+#include <AdblockPlus/LogSystem.h> |
Andrey Novikov
2013/06/18 11:48:28
Forgot to remove this :(
|
#include <AdblockPlus.h> |
#include "JsContext.h" |
#include "Thread.h" |
@@ -277,3 +278,23 @@ |
std::string error(params.size() >= 1 && !params[0]->IsNull() ? params[0]->AsString() : ""); |
callback(error); |
} |
+ |
+void FilterEngine::SetFilterChangeCallback(FilterEngine::FilterChangeCallback callback) |
+{ |
+ std::string eventName = "filterChange"; |
Wladimir Palant
2013/06/18 15:02:15
The event name isn't dynamic, no real point passin
|
+ |
+ if (callback == 0) |
+ jsEngine->RemoveEventCallback(eventName); |
+ else |
+ jsEngine->SetEventCallback(eventName, std::tr1::bind(&FilterEngine::FilterChanged, |
+ this, eventName, callback, std::tr1::placeholders::_1)); |
+} |
+ |
+void FilterEngine::FilterChanged(const std::string& eventName, FilterEngine::FilterChangeCallback callback, JsValueList& params) |
+{ |
+ AdblockPlus::LogSystemPtr log = jsEngine->GetLogSystem(); |
Andrey Novikov
2013/06/18 11:48:28
Forgot to remove this :(
|
+ std::string url(params.size() >= 1 && !params[0]->IsNull() ? params[0]->AsString() : ""); |
+ std::string status(params.size() >= 2 && !params[1]->IsNull() ? params[1]->AsString() : ""); |
+ int64_t time(params.size() >= 3 && !params[2]->IsNull() ? params[2]->AsInt() : 0); |
+ callback(url, status, time); |
+} |