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 ChromotingJniRuntime class serves | 8 // the C++ codebase from Java. The separate ChromotingJniRuntime class serves |
9 // as the corresponding exit point, and is responsible for making all JNI calls | 9 // as the 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. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 google_apis::GetOAuth2ClientSecret(google_apis::CLIENT_REMOTING).c_str()); | 62 google_apis::GetOAuth2ClientSecret(google_apis::CLIENT_REMOTING).c_str()); |
63 } | 63 } |
64 | 64 |
65 JNIEXPORT void JNICALL JNI_IMPLEMENTATION(connectNative)( | 65 JNIEXPORT void JNICALL JNI_IMPLEMENTATION(connectNative)( |
66 JNIEnv* env, | 66 JNIEnv* env, |
67 jobject that, | 67 jobject that, |
68 jstring username_jstr, | 68 jstring username_jstr, |
69 jstring auth_token_jstr, | 69 jstring auth_token_jstr, |
70 jstring host_jid_jstr, | 70 jstring host_jid_jstr, |
71 jstring host_id_jstr, | 71 jstring host_id_jstr, |
72 jstring host_pubkey_jstr) { | 72 jstring host_pubkey_jstr, |
| 73 jstring pair_id_jstr, |
| 74 jstring pair_secret_jstr) { |
73 const char* username_cstr = env->GetStringUTFChars(username_jstr, NULL); | 75 const char* username_cstr = env->GetStringUTFChars(username_jstr, NULL); |
74 const char* auth_token_cstr = env->GetStringUTFChars(auth_token_jstr, NULL); | 76 const char* auth_token_cstr = env->GetStringUTFChars(auth_token_jstr, NULL); |
75 const char* host_jid_cstr = env->GetStringUTFChars(host_jid_jstr, NULL); | 77 const char* host_jid_cstr = env->GetStringUTFChars(host_jid_jstr, NULL); |
76 const char* host_id_cstr = env->GetStringUTFChars(host_id_jstr, NULL); | 78 const char* host_id_cstr = env->GetStringUTFChars(host_id_jstr, NULL); |
77 const char* host_pubkey_cstr = env->GetStringUTFChars(host_pubkey_jstr, NULL); | 79 const char* host_pubkey_cstr = env->GetStringUTFChars(host_pubkey_jstr, NULL); |
| 80 const char* pair_id_cstr = env->GetStringUTFChars(pair_id_jstr, NULL); |
| 81 const char* pair_secret_cstr = env->GetStringUTFChars(pair_secret_jstr, NULL); |
78 | 82 |
79 remoting::ChromotingJniRuntime::GetInstance()->ConnectToHost( | 83 remoting::ChromotingJniRuntime::GetInstance()->ConnectToHost( |
80 username_cstr, | 84 username_cstr, |
81 auth_token_cstr, | 85 auth_token_cstr, |
82 host_jid_cstr, | 86 host_jid_cstr, |
83 host_id_cstr, | 87 host_id_cstr, |
84 host_pubkey_cstr); | 88 host_pubkey_cstr, |
| 89 pair_id_cstr, |
| 90 pair_secret_cstr); |
85 | 91 |
86 env->ReleaseStringUTFChars(username_jstr, username_cstr); | 92 env->ReleaseStringUTFChars(username_jstr, username_cstr); |
87 env->ReleaseStringUTFChars(auth_token_jstr, auth_token_cstr); | 93 env->ReleaseStringUTFChars(auth_token_jstr, auth_token_cstr); |
88 env->ReleaseStringUTFChars(host_jid_jstr, host_jid_cstr); | 94 env->ReleaseStringUTFChars(host_jid_jstr, host_jid_cstr); |
89 env->ReleaseStringUTFChars(host_id_jstr, host_id_cstr); | 95 env->ReleaseStringUTFChars(host_id_jstr, host_id_cstr); |
90 env->ReleaseStringUTFChars(host_pubkey_jstr, host_pubkey_cstr); | 96 env->ReleaseStringUTFChars(host_pubkey_jstr, host_pubkey_cstr); |
| 97 env->ReleaseStringUTFChars(pair_id_jstr, pair_id_cstr); |
| 98 env->ReleaseStringUTFChars(pair_secret_jstr, pair_secret_cstr); |
91 } | 99 } |
92 | 100 |
93 JNIEXPORT void JNICALL JNI_IMPLEMENTATION(disconnectNative)(JNIEnv* env, | 101 JNIEXPORT void JNICALL JNI_IMPLEMENTATION(disconnectNative)(JNIEnv* env, |
94 jobject that) { | 102 jobject that) { |
95 remoting::ChromotingJniRuntime::GetInstance()->DisconnectFromHost(); | 103 remoting::ChromotingJniRuntime::GetInstance()->DisconnectFromHost(); |
96 } | 104 } |
97 | 105 |
98 JNIEXPORT void JNICALL JNI_IMPLEMENTATION(authenticationResponse)( | 106 JNIEXPORT void JNICALL JNI_IMPLEMENTATION(authenticationResponse)( |
99 JNIEnv* env, | 107 JNIEnv* env, |
100 jobject that, | 108 jobject that, |
101 jstring pin_jstr) { | 109 jstring pin_jstr, |
| 110 jboolean create_pair) { |
102 const char* pin_cstr = env->GetStringUTFChars(pin_jstr, NULL); | 111 const char* pin_cstr = env->GetStringUTFChars(pin_jstr, NULL); |
103 | 112 |
104 remoting::ChromotingJniRuntime::GetInstance()-> | 113 remoting::ChromotingJniRuntime::GetInstance()-> |
105 session()->ProvideSecret(pin_cstr); | 114 session()->ProvideSecret(pin_cstr, create_pair); |
106 | 115 |
107 env->ReleaseStringUTFChars(pin_jstr, pin_cstr); | 116 env->ReleaseStringUTFChars(pin_jstr, pin_cstr); |
108 } | 117 } |
109 | 118 |
110 JNIEXPORT void JNICALL JNI_IMPLEMENTATION(scheduleRedrawNative)( | 119 JNIEXPORT void JNICALL JNI_IMPLEMENTATION(scheduleRedrawNative)( |
111 JNIEnv* env, | 120 JNIEnv* env, |
112 jobject that) { | 121 jobject that) { |
113 remoting::ChromotingJniRuntime::GetInstance()->session()->RedrawDesktop(); | 122 remoting::ChromotingJniRuntime::GetInstance()->session()->RedrawDesktop(); |
114 } | 123 } |
115 | 124 |
(...skipping 17 matching lines...) Expand all Loading... |
133 JNIEXPORT void JNICALL JNI_IMPLEMENTATION(keyboardActionNative)( | 142 JNIEXPORT void JNICALL JNI_IMPLEMENTATION(keyboardActionNative)( |
134 JNIEnv* env, | 143 JNIEnv* env, |
135 jobject that, | 144 jobject that, |
136 jint key_code, | 145 jint key_code, |
137 jboolean key_down) { | 146 jboolean key_down) { |
138 remoting::ChromotingJniRuntime::GetInstance()->session()-> | 147 remoting::ChromotingJniRuntime::GetInstance()->session()-> |
139 PerformKeyboardAction(key_code, key_down); | 148 PerformKeyboardAction(key_code, key_down); |
140 } | 149 } |
141 | 150 |
142 } // extern "C" | 151 } // extern "C" |
OLD | NEW |