Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // This file defines functions that implement the static methods declared in a | |
| 6 // closely-related Java class in the platform-specific user interface | |
| 7 // implementation. In effect, it is the entry point for all JNI calls *into* | |
| 8 // the C++ codebase from Java. The separate ChromotingJNIInstance class serves | |
| 9 // as the corresponding exit point, and is responsible for making all JNI calls | |
| 10 // *out of* the C++ codebase into Java. | |
| 11 | |
| 12 #include <jni.h> | |
| 13 | |
| 14 #include "base/android/jni_android.h" | |
| 15 #include "base/memory/ref_counted.h" | |
| 16 #include "remoting/client/jni/chromoting_jni_instance.h" | |
| 17 | |
| 18 // Class and package name of the Java class that declares this file's functions. | |
| 19 #define JNI_IMPLEMENTATION(method) \ | |
| 20 Java_org_chromium_chromoting_jni_JNIInterface_##method | |
| 21 | |
| 22 extern "C" { | |
| 23 | |
| 24 JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { | |
| 25 base::android::InitVM(vm); | |
| 26 return JNI_VERSION_1_2; | |
| 27 } | |
| 28 | |
| 29 JNIEXPORT void JNICALL JNI_IMPLEMENTATION(loadNative)(JNIEnv* env, | |
| 30 jobject that, | |
| 31 jobject context) { | |
| 32 base::android::ScopedJavaLocalRef<jobject> context_activity(env, context); | |
| 33 base::android::InitApplicationContext(context_activity); | |
| 34 | |
| 35 remoting::ChromotingJNIInstance::GetInstance(); // Initialize threads now. | |
| 36 } | |
| 37 | |
| 38 JNIEXPORT void JNICALL JNI_IMPLEMENTATION(connectNative)(JNIEnv* env, | |
| 39 jobject that, | |
| 40 jstring username, | |
| 41 jstring auth_token, | |
| 42 jstring host_jid, | |
| 43 jstring host_id, | |
| 44 jstring host_pubkey) { | |
| 45 remoting::ChromotingJNIInstance::GetInstance()->ConnectToHost(username, | |
| 46 auth_token, | |
|
garykac
2013/07/10 21:56:18
align arguments with paren
solb
2013/07/10 22:11:57
Done.
| |
| 47 host_jid, | |
| 48 host_id, | |
| 49 host_pubkey); | |
| 50 } | |
| 51 | |
| 52 JNIEXPORT void JNICALL JNI_IMPLEMENTATION(disconnectNative)(JNIEnv* env, | |
| 53 jobject that) { | |
| 54 remoting::ChromotingJNIInstance::GetInstance()->DisconnectFromHost(); | |
| 55 } | |
| 56 | |
| 57 } // extern "C" | |
| OLD | NEW |