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

Unified Diff: jni/JniShowNotificationCallback.cpp

Issue 29329928: Issue 3297 - Fix issues introduced by recent libadblockplus changes and update dependencies (Closed)
Patch Set: MinSDK and copy'n'paste Created Nov. 20, 2015, 12:19 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/JniNotification.cpp ('k') | jni/Utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: jni/JniShowNotificationCallback.cpp
diff --git a/jni/JniFilterChangeCallback.cpp b/jni/JniShowNotificationCallback.cpp
similarity index 66%
copy from jni/JniFilterChangeCallback.cpp
copy to jni/JniShowNotificationCallback.cpp
index 00c4b945f4976c2d3c89e1d5167145a8615517b9..dbf146e8e84dbbfeacb326842f96045037a1f1cb 100644
--- a/jni/JniFilterChangeCallback.cpp
+++ b/jni/JniShowNotificationCallback.cpp
@@ -21,39 +21,38 @@ static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jobject callbackObject)
{
try
{
- return JniPtrToLong(new JniFilterChangeCallback(env, callbackObject));
+ return JniPtrToLong(new JniShowNotificationCallback(env, callbackObject));
}
CATCH_THROW_AND_RETURN(env, 0)
}
static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr)
{
- delete JniLongToTypePtr<JniFilterChangeCallback>(ptr);
+ delete JniLongToTypePtr<JniShowNotificationCallback>(ptr);
}
-JniFilterChangeCallback::JniFilterChangeCallback(JNIEnv* env,
+JniShowNotificationCallback::JniShowNotificationCallback(JNIEnv* env,
jobject callbackObject)
- : JniCallbackBase(env, callbackObject), jsValueClass(
- new JniGlobalReference<jclass>(env, env->FindClass(PKG("JsValue"))))
+ : JniCallbackBase(env, callbackObject), notificationClass(
+ new JniGlobalReference<jclass>(env, env->FindClass(PKG("Notification"))))
{
}
-void JniFilterChangeCallback::Callback(const std::string& arg,
- const AdblockPlus::JsValuePtr jsValue)
+void JniShowNotificationCallback::Callback(
+ const AdblockPlus::NotificationPtr& notificationPtr)
{
JNIEnvAcquire env(GetJavaVM());
jmethodID method = env->GetMethodID(
*JniLocalReference<jclass>(*env,
env->GetObjectClass(GetCallbackObject())),
- "filterChangeCallback", "(Ljava/lang/String;" TYP("JsValue") ")V");
+ "showNotificationCallback", "(" TYP("Notification") ")V");
if (method)
{
- JniLocalReference<jstring> jArg(*env, env->NewStringUTF(arg.c_str()));
- JniLocalReference<jobject> jJsValue(*env,
- NewJniJsValue(*env, jsValue, jsValueClass->Get()));
- env->CallVoidMethod(GetCallbackObject(), method, *jArg, *jJsValue);
+ JniLocalReference<jobject> jNotification(*env, NewJniNotification(*env,
+ notificationPtr));
+ env->CallVoidMethod(GetCallbackObject(), method, *jNotification);
}
CheckAndLogJavaException(*env);
@@ -65,7 +64,7 @@ static JNINativeMethod methods[] =
{ (char*)"dtor", (char*)"(J)V", (void*)JniDtor }
};
-extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_FilterChangeCallback_registerNatives(JNIEnv *env, jclass clazz)
+extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_ShowNotificationCallback_registerNatives(JNIEnv *env, jclass clazz)
{
env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0]));
}
« no previous file with comments | « jni/JniNotification.cpp ('k') | jni/Utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld