Index: jni/JniWebRequest.cpp |
diff --git a/jni/JniWebRequest.cpp b/jni/JniWebRequest.cpp |
index 494686257dcb2632e115fecab296c958ca6963c4..5fa54bb9c4ce366aa11b7a4b4f60c71866e3ed44 100644 |
--- a/jni/JniWebRequest.cpp |
+++ b/jni/JniWebRequest.cpp |
@@ -17,21 +17,20 @@ |
#include "JniCallbacks.h" |
-AdblockPlus::Android::JniWebRequest::JniWebRequest(JNIEnv* env, jobject callbackObject) : |
- JniCallbackBase(env, callbackObject), AdblockPlus::WebRequest() |
+JniWebRequest::JniWebRequest(JNIEnv* env, jobject callbackObject) |
+ : JniCallbackBase(env, callbackObject), AdblockPlus::WebRequest() |
{ |
- m_TupleClass.reset(new JniGlobalReference<jclass>(env, env->FindClass("com/github/rjeschke/neetutils/collections/Tuple"))); |
- m_ServerResponseClass.reset(new JniGlobalReference<jclass>(env, env->FindClass(PKG("ServerResponse")))); |
+ tupleClass.reset(new JniGlobalReference<jclass>(env, env->FindClass("com/github/rjeschke/neetutils/collections/Tuple"))); |
+ serverResponseClass.reset(new JniGlobalReference<jclass>(env, env->FindClass(PKG("ServerResponse")))); |
} |
-AdblockPlus::Android::JniWebRequest::~JniWebRequest() |
+JniWebRequest::~JniWebRequest() |
{ |
} |
-AdblockPlus::ServerResponse AdblockPlus::Android::JniWebRequest::GET(const std::string& url, |
- const AdblockPlus::HeaderList& requestHeaders) const |
+AdblockPlus::ServerResponse JniWebRequest::GET(const std::string& url, const AdblockPlus::HeaderList& requestHeaders) const |
{ |
- AdblockPlus::Android::JNIEnvAcquire env(GetJavaVM()); |
+ JNIEnvAcquire env(GetJavaVM()); |
jclass clazz = env->GetObjectClass(GetCallbackObject()); |
jmethodID method = env->GetMethodID(clazz, "httpGET", "(Ljava/lang/String;Ljava/util/List;)" TYP("ServerResponse")); |
@@ -52,9 +51,9 @@ AdblockPlus::ServerResponse AdblockPlus::Android::JniWebRequest::GET(const std:: |
if (!env->ExceptionCheck()) |
{ |
- sResponse.status = AdblockPlus::Android::JniGetLongField(*env, m_ServerResponseClass->get(), response, "status"); |
- sResponse.responseStatus = AdblockPlus::Android::JniGetIntField(*env, m_ServerResponseClass->get(), response, "responseStatus"); |
- sResponse.responseText = AdblockPlus::Android::JniGetStringField(*env, m_ServerResponseClass->get(), response, "response"); |
+ sResponse.status = JniGetLongField(*env, serverResponseClass->get(), response, "status"); |
+ sResponse.responseStatus = JniGetIntField(*env, serverResponseClass->get(), response, "responseStatus"); |
+ sResponse.responseText = JniGetStringField(*env, serverResponseClass->get(), response, "response"); |
// TODO: transform Headers |
} |
} |
@@ -64,30 +63,31 @@ AdblockPlus::ServerResponse AdblockPlus::Android::JniWebRequest::GET(const std:: |
return sResponse; |
} |
-jobject AdblockPlus::Android::JniWebRequest::NewTuple(JNIEnv* env, const std::string& a, const std::string& b) const |
+jobject JniWebRequest::NewTuple(JNIEnv* env, const std::string& a, const std::string& b) const |
{ |
- jmethodID factory = env->GetMethodID(m_TupleClass->get(), "<init>", "(Ljava/lang/Object;Ljava/lang/Object;)V"); |
- return env->NewObject(m_TupleClass->get(), factory, env->NewStringUTF(a.c_str()), env->NewStringUTF(b.c_str())); |
+ jmethodID factory = env->GetMethodID(tupleClass->get(), "<init>", "(Ljava/lang/Object;Ljava/lang/Object;)V"); |
+ return env->NewObject(tupleClass->get(), factory, env->NewStringUTF(a.c_str()), env->NewStringUTF(b.c_str())); |
} |
static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jobject callbackObject) |
{ |
TRY |
{ |
- return AdblockPlus::Android::JniPtr2Long(new AdblockPlus::WebRequestPtr(new AdblockPlus::Android::JniWebRequest(env, callbackObject))); |
+ return JniPtrToLong(new AdblockPlus::WebRequestPtr(new JniWebRequest(env, callbackObject))); |
} |
CATCH_THROW_AND_RETURN(env, 0) |
} |
static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr) |
{ |
- delete AdblockPlus::Android::JniLong2TypePtr<AdblockPlus::WebRequestPtr>(ptr); |
+ delete JniLongToTypePtr<AdblockPlus::WebRequestPtr>(ptr); |
} |
static JNINativeMethod methods[] = |
{ |
-{ (char*)"ctor", (char*)"(Ljava/lang/Object;)J", (void*)JniCtor }, |
-{ (char*)"dtor", (char*)"(J)V", (void*)JniDtor }, }; |
+ { (char*)"ctor", (char*)"(Ljava/lang/Object;)J", (void*)JniCtor }, |
+ { (char*)"dtor", (char*)"(J)V", (void*)JniDtor } |
+}; |
extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_android_api_WebRequest_registerNatives(JNIEnv *env, jclass clazz) |
{ |