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

Unified Diff: remoting/client/jni/chromoting_jni_runtime.cc

Issue 21554002: Enable Android support for Chromoting PINless (paired) authentication (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Prevent future coordinates-related bugs Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/client/jni/chromoting_jni_runtime.h ('k') | remoting/client/jni/jni_interface.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/jni/chromoting_jni_runtime.cc
diff --git a/remoting/client/jni/chromoting_jni_runtime.cc b/remoting/client/jni/chromoting_jni_runtime.cc
index 4913594f95a2b0fc5fb3f01432224a245a7f1da0..8fa90185b7aafe0593f39a084217161999567812 100644
--- a/remoting/client/jni/chromoting_jni_runtime.cc
+++ b/remoting/client/jni/chromoting_jni_runtime.cc
@@ -76,7 +76,9 @@ void ChromotingJniRuntime::ConnectToHost(const char* username,
const char* auth_token,
const char* host_jid,
const char* host_id,
- const char* host_pubkey) {
+ const char* host_pubkey,
+ const char* pairing_id,
+ const char* pairing_secret) {
DCHECK(ui_task_runner_->BelongsToCurrentThread());
DCHECK(!session_);
session_ = new ChromotingJniInstance(this,
@@ -84,7 +86,9 @@ void ChromotingJniRuntime::ConnectToHost(const char* username,
auth_token,
host_jid,
host_id,
- host_pubkey);
+ host_pubkey,
+ pairing_id,
+ pairing_secret);
}
void ChromotingJniRuntime::DisconnectFromHost() {
@@ -117,6 +121,34 @@ void ChromotingJniRuntime::DisplayAuthenticationPrompt() {
env->GetStaticMethodID(class_, "displayAuthenticationPrompt", "()V"));
}
+void ChromotingJniRuntime::CommitPairingCredentials(const std::string& host,
+ const std::string& id,
+ const std::string& secret) {
+ DCHECK(ui_task_runner_->BelongsToCurrentThread());
+
+ JNIEnv* env = base::android::AttachCurrentThread();
+ jstring host_jstr = env->NewStringUTF(host.c_str());
+ jbyteArray id_arr = env->NewByteArray(id.size());
+ env->SetByteArrayRegion(id_arr, 0, id.size(),
+ reinterpret_cast<const jbyte*>(id.c_str()));
+ jbyteArray secret_arr = env->NewByteArray(secret.size());
+ env->SetByteArrayRegion(secret_arr, 0, secret.size(),
+ reinterpret_cast<const jbyte*>(secret.c_str()));
+
+ env->CallStaticVoidMethod(
+ class_,
+ env->GetStaticMethodID(
+ class_,
+ "commitPairingCredentials",
+ "(Ljava/lang/String;[B[B)V"),
+ host_jstr,
+ id_arr,
+ secret_arr);
+
+ // Because we passed them as arguments, their corresponding Java objects were
+ // GCd as soon as the managed method returned, so we mustn't release it here.
+}
+
void ChromotingJniRuntime::UpdateImageBuffer(int width,
int height,
jobject buffer) {
« no previous file with comments | « remoting/client/jni/chromoting_jni_runtime.h ('k') | remoting/client/jni/jni_interface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698