| Index: remoting/client/jni/jni_interface.cc
|
| diff --git a/remoting/client/jni/jni_interface.cc b/remoting/client/jni/jni_interface.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..cb7f6c261066328bc9d6ff119a1519e1bd2e6e8f
|
| --- /dev/null
|
| +++ b/remoting/client/jni/jni_interface.cc
|
| @@ -0,0 +1,57 @@
|
| +// Copyright 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +// This file defines functions that implement the static methods declared in a
|
| +// closely-related Java class in the platform-specific user interface
|
| +// implementation. In effect, it is the entry point for all JNI calls *into*
|
| +// the C++ codebase from Java. The separate ChromotingJNIInstance class serves
|
| +// as the corresponding exit point, and is responsible for making all JNI calls
|
| +// *out of* the C++ codebase into Java.
|
| +
|
| +#include <jni.h>
|
| +
|
| +#include "base/android/jni_android.h"
|
| +#include "base/memory/ref_counted.h"
|
| +#include "remoting/client/jni/chromoting_jni_instance.h"
|
| +
|
| +// Class and package name of the Java class that declares this file's functions.
|
| +#define JNI_IMPLEMENTATION(method) \
|
| + Java_org_chromium_chromoting_jni_JNIInterface_##method
|
| +
|
| +extern "C" {
|
| +
|
| +JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
|
| + base::android::InitVM(vm);
|
| + return JNI_VERSION_1_2;
|
| +}
|
| +
|
| +JNIEXPORT void JNICALL JNI_IMPLEMENTATION(loadNative)(JNIEnv* env,
|
| + jobject that,
|
| + jobject context) {
|
| + base::android::ScopedJavaLocalRef<jobject> context_activity(env, context);
|
| + base::android::InitApplicationContext(context_activity);
|
| +
|
| + 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(disconnectNative)(JNIEnv* env,
|
| + jobject that) {
|
| + remoting::ChromotingJNIInstance::GetInstance()->DisconnectFromHost();
|
| +}
|
| +
|
| +} // extern "C"
|
|
|