| 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 #include "remoting/client/jni/chromoting_jni_runtime.h" | 5 #include "remoting/client/jni/chromoting_jni_runtime.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 222 |
| 223 void ChromotingJniRuntime::ConnectToHost(const char* username, | 223 void ChromotingJniRuntime::ConnectToHost(const char* username, |
| 224 const char* auth_token, | 224 const char* auth_token, |
| 225 const char* host_jid, | 225 const char* host_jid, |
| 226 const char* host_id, | 226 const char* host_id, |
| 227 const char* host_pubkey, | 227 const char* host_pubkey, |
| 228 const char* pairing_id, | 228 const char* pairing_id, |
| 229 const char* pairing_secret, | 229 const char* pairing_secret, |
| 230 const char* capabilities) { | 230 const char* capabilities) { |
| 231 DCHECK(ui_task_runner_->BelongsToCurrentThread()); | 231 DCHECK(ui_task_runner_->BelongsToCurrentThread()); |
| 232 DCHECK(!session_); | 232 DCHECK(!session_.get()); |
| 233 session_ = new ChromotingJniInstance(this, | 233 session_ = new ChromotingJniInstance(this, |
| 234 username, | 234 username, |
| 235 auth_token, | 235 auth_token, |
| 236 host_jid, | 236 host_jid, |
| 237 host_id, | 237 host_id, |
| 238 host_pubkey, | 238 host_pubkey, |
| 239 pairing_id, | 239 pairing_id, |
| 240 pairing_secret, | 240 pairing_secret, |
| 241 capabilities); | 241 capabilities); |
| 242 } | 242 } |
| 243 | 243 |
| 244 void ChromotingJniRuntime::DisconnectFromHost() { | 244 void ChromotingJniRuntime::DisconnectFromHost() { |
| 245 DCHECK(ui_task_runner_->BelongsToCurrentThread()); | 245 DCHECK(ui_task_runner_->BelongsToCurrentThread()); |
| 246 if (session_) { | 246 if (session_.get()) { |
| 247 session_->Disconnect(); | 247 session_->Disconnect(); |
| 248 session_ = NULL; | 248 session_ = NULL; |
| 249 } | 249 } |
| 250 } | 250 } |
| 251 | 251 |
| 252 void ChromotingJniRuntime::OnConnectionState( | 252 void ChromotingJniRuntime::OnConnectionState( |
| 253 protocol::ConnectionToHost::State state, | 253 protocol::ConnectionToHost::State state, |
| 254 protocol::ErrorCode error) { | 254 protocol::ErrorCode error) { |
| 255 DCHECK(ui_task_runner_->BelongsToCurrentThread()); | 255 DCHECK(ui_task_runner_->BelongsToCurrentThread()); |
| 256 | 256 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 | 357 |
| 358 JNIEnv* env = base::android::AttachCurrentThread(); | 358 JNIEnv* env = base::android::AttachCurrentThread(); |
| 359 Java_JniInterface_redrawGraphicsInternal(env); | 359 Java_JniInterface_redrawGraphicsInternal(env); |
| 360 } | 360 } |
| 361 | 361 |
| 362 void ChromotingJniRuntime::DetachFromVmAndSignal(base::WaitableEvent* waiter) { | 362 void ChromotingJniRuntime::DetachFromVmAndSignal(base::WaitableEvent* waiter) { |
| 363 base::android::DetachFromVM(); | 363 base::android::DetachFromVM(); |
| 364 waiter->Signal(); | 364 waiter->Signal(); |
| 365 } | 365 } |
| 366 } // namespace remoting | 366 } // namespace remoting |
| OLD | NEW |