Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Unified Diff: remoting/client/jni/jni_interface.cc

Issue 18612018: Restructure chromoting_jni_instance handling of Java strings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Connection/disconnection state machine and moar comments Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/client/jni/jni_interface.cc
diff --git a/remoting/client/jni/jni_interface.cc b/remoting/client/jni/jni_interface.cc
index ed45a84f6c57bc8990f5466a77d6335f26c4784f..5c1cf74feb11a1932859b2928d93978c8c96627f 100644
--- a/remoting/client/jni/jni_interface.cc
+++ b/remoting/client/jni/jni_interface.cc
@@ -35,18 +35,32 @@ JNIEXPORT void JNICALL JNI_IMPLEMENTATION(loadNative)(JNIEnv* env,
remoting::ChromotingJNIInstance::GetInstance(); // Initialize threads now.
}
-JNIEXPORT void JNICALL JNI_IMPLEMENTATION(connectNative)(JNIEnv* env,
- jobject that,
- jstring username,
- jstring auth_token,
- jstring host_jid,
- jstring host_id,
- jstring host_pubkey) {
- remoting::ChromotingJNIInstance::GetInstance()->ConnectToHost(username,
- auth_token,
- host_jid,
- host_id,
- host_pubkey);
+JNIEXPORT void JNICALL JNI_IMPLEMENTATION(connectNative)(
+ JNIEnv* env,
+ jobject that,
+ jstring username_jstr,
+ jstring auth_token_jstr,
+ jstring host_jid_jstr,
+ jstring host_id_jstr,
+ jstring host_pubkey_jstr) {
+ const char* username_cstr = env->GetStringUTFChars(username_jstr, NULL);
+ const char* auth_token_cstr = env->GetStringUTFChars(auth_token_jstr, NULL);
+ const char* host_jid_cstr = env->GetStringUTFChars(host_jid_jstr, NULL);
+ const char* host_id_cstr = env->GetStringUTFChars(host_id_jstr, NULL);
+ const char* host_pubkey_cstr = env->GetStringUTFChars(host_pubkey_jstr, NULL);
+
+ remoting::ChromotingJNIInstance::GetInstance()->ConnectToHost(
+ username_cstr,
+ auth_token_cstr,
+ host_jid_cstr,
+ host_id_cstr,
+ host_pubkey_cstr);
+
+ env->ReleaseStringUTFChars(username_jstr, username_cstr);
+ env->ReleaseStringUTFChars(auth_token_jstr, auth_token_cstr);
+ env->ReleaseStringUTFChars(host_jid_jstr, host_jid_cstr);
+ env->ReleaseStringUTFChars(host_id_jstr, host_id_cstr);
+ env->ReleaseStringUTFChars(host_pubkey_jstr, host_pubkey_cstr);
}
JNIEXPORT void JNICALL JNI_IMPLEMENTATION(disconnectNative)(JNIEnv* env,
@@ -54,10 +68,15 @@ JNIEXPORT void JNICALL JNI_IMPLEMENTATION(disconnectNative)(JNIEnv* env,
remoting::ChromotingJNIInstance::GetInstance()->DisconnectFromHost();
}
-JNIEXPORT void JNICALL JNI_IMPLEMENTATION(authenticationResponse)(JNIEnv* env,
- jobject that,
- jstring pin) {
- remoting::ChromotingJNIInstance::GetInstance()->AuthenticateWithPin(pin);
+JNIEXPORT void JNICALL JNI_IMPLEMENTATION(authenticationResponse)(
+ JNIEnv* env,
+ jobject that,
+ jstring pin_jstr) {
+ const char* pin_cstr = env->GetStringUTFChars(pin_jstr, NULL);
+
+ remoting::ChromotingJNIInstance::GetInstance()->AuthenticateWithPin(pin_cstr);
+
+ env->ReleaseStringUTFChars(pin_jstr, pin_cstr);
}
} // extern "C"

Powered by Google App Engine
This is Rietveld 408576698