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

Side by Side Diff: remoting/client/jni/jni_interface.cc

Issue 18856012: Create new remoting_client_jni target (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Gary's recommendations 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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,
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"
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698