| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file defines functions that implement the static methods declared in a | 5 // This file defines functions that implement the static methods declared in a |
| 6 // closely-related Java class in the platform-specific user interface | 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* | 7 // implementation. In effect, it is the entry point for all JNI calls *into* |
| 8 // the C++ codebase from Java. The separate ChromotingJni class serves as the | 8 // the C++ codebase from Java. The separate ChromotingJni class serves as the |
| 9 // corresponding exit point, and is responsible for making all JNI calls | 9 // corresponding exit point, and is responsible for making all JNI calls |
| 10 // *out of* the C++ codebase into Java. | 10 // *out of* the C++ codebase into Java. |
| 11 | 11 |
| 12 #include <jni.h> | 12 #include <jni.h> |
| 13 | 13 |
| 14 #include "base/android/jni_android.h" | 14 #include "base/android/jni_android.h" |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "google_apis/google_api_keys.h" | 17 #include "google_apis/google_api_keys.h" |
| 18 #include "remoting/client/jni/chromoting_jni.h" | 18 #include "remoting/client/jni/chromoting_jni.h" |
| 19 #include "remoting/client/jni/chromoting_jni_instance.h" | 19 #include "remoting/client/jni/chromoting_jni_instance.h" |
| 20 | 20 |
| 21 // Class and package name of the Java class that declares this file's functions. | 21 // Class and package name of the Java class that declares this file's functions. |
| 22 #define JNI_IMPLEMENTATION(method) \ | 22 #define JNI_IMPLEMENTATION(method) \ |
| 23 Java_org_chromium_chromoting_jni_JNIInterface_##method | 23 Java_org_chromium_chromoting_jni_JniInterface_##method |
| 24 | 24 |
| 25 extern "C" { | 25 extern "C" { |
| 26 | 26 |
| 27 JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { | 27 JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
| 28 base::android::InitVM(vm); | 28 base::android::InitVM(vm); |
| 29 return JNI_VERSION_1_2; | 29 return JNI_VERSION_1_2; |
| 30 } | 30 } |
| 31 | 31 |
| 32 JNIEXPORT void JNICALL JNI_IMPLEMENTATION(loadNative)(JNIEnv* env, | 32 JNIEXPORT void JNICALL JNI_IMPLEMENTATION(loadNative)(JNIEnv* env, |
| 33 jobject that, | 33 jobject that, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 jobject that, | 100 jobject that, |
| 101 jstring pin_jstr) { | 101 jstring pin_jstr) { |
| 102 const char* pin_cstr = env->GetStringUTFChars(pin_jstr, NULL); | 102 const char* pin_cstr = env->GetStringUTFChars(pin_jstr, NULL); |
| 103 | 103 |
| 104 remoting::ChromotingJni::GetInstance()-> | 104 remoting::ChromotingJni::GetInstance()-> |
| 105 session()->ProvideSecret(pin_cstr); | 105 session()->ProvideSecret(pin_cstr); |
| 106 | 106 |
| 107 env->ReleaseStringUTFChars(pin_jstr, pin_cstr); | 107 env->ReleaseStringUTFChars(pin_jstr, pin_cstr); |
| 108 } | 108 } |
| 109 | 109 |
| 110 JNIEXPORT void JNICALL JNI_IMPLEMENTATION(scheduleRedrawNative)( |
| 111 JNIEnv* env, |
| 112 jobject that) { |
| 113 remoting::ChromotingJni::GetInstance()->session()->RedrawDesktop(); |
| 114 } |
| 115 |
| 110 } // extern "C" | 116 } // extern "C" |
| OLD | NEW |