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

Unified Diff: jni/JniFilterEngine.cpp

Issue 5153282527854592: Issue 98 - Use the libadblockplus update mechanism (Closed)
Patch Set: Only append the revision to the version for devbuilds Created Sept. 26, 2014, 2:54 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 | « jni/JniCallbacks.h ('k') | jni/JniUpdateAvailableCallback.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: jni/JniFilterEngine.cpp
===================================================================
--- a/jni/JniFilterEngine.cpp
+++ b/jni/JniFilterEngine.cpp
@@ -142,6 +142,35 @@
CATCH_THROW_AND_RETURN(env, 0);
}
+static void JNICALL JniRemoveUpdateAvailableCallback(JNIEnv* env, jclass clazz,
+ jlong ptr)
+{
+ AdblockPlus::FilterEngine* const engine =
+ JniLongToTypePtr<AdblockPlus::FilterEngine>(ptr);
+ try
+ {
+ engine->RemoveUpdateAvailableCallback();
+ }
+ CATCH_AND_THROW(env)
+}
+
+static void JNICALL JniSetUpdateAvailableCallback(JNIEnv* env, jclass clazz,
+ jlong ptr, jlong callbackPtr)
+{
+ AdblockPlus::FilterEngine* const engine =
+ JniLongToTypePtr<AdblockPlus::FilterEngine>(ptr);
+ JniUpdateAvailableCallback* const callback =
+ JniLongToTypePtr<JniUpdateAvailableCallback>(callbackPtr);
+ AdblockPlus::FilterEngine::UpdateAvailableCallback updateAvailableCallback =
+ std::tr1::bind(&JniUpdateAvailableCallback::Callback, callback,
+ std::tr1::placeholders::_1);
+ try
+ {
+ engine->SetUpdateAvailableCallback(updateAvailableCallback);
+ }
+ CATCH_AND_THROW(env)
+}
+
static void JNICALL JniRemoveFilterChangeCallback(JNIEnv* env, jclass clazz, jlong ptr)
{
AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine>(ptr);
@@ -295,6 +324,8 @@
{ (char*)"getSubscription", (char*)"(JLjava/lang/String;)" TYP("Subscription"), (void*)JniGetSubscription },
{ (char*)"getListedSubscriptions", (char*)"(J)Ljava/util/List;", (void*)JniGetListedSubscriptions },
{ (char*)"fetchAvailableSubscriptions", (char*)"(J)Ljava/util/List;", (void*)JniFetchAvailableSubscriptions },
+ { (char*)"setUpdateAvailableCallback", (char*)"(JJ)V", (void*)JniSetUpdateAvailableCallback },
+ { (char*)"removeUpdateAvailableCallback", (char*)"(J)V", (void*)JniRemoveUpdateAvailableCallback },
{ (char*)"setFilterChangeCallback", (char*)"(JJ)V", (void*)JniSetFilterChangeCallback },
{ (char*)"removeFilterChangeCallback", (char*)"(J)V", (void*)JniRemoveFilterChangeCallback },
{ (char*)"forceUpdateCheck", (char*)"(JJ)V", (void*)JniForceUpdateCheck },
« no previous file with comments | « jni/JniCallbacks.h ('k') | jni/JniUpdateAvailableCallback.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld