Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/jni_client.h" | 5 #include "remoting/client/jni/jni_client.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "jni/Client_jni.h" | 10 #include "jni/Client_jni.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 session_.reset(new ChromotingJniInstance( | 53 session_.reset(new ChromotingJniInstance( |
| 54 runtime_, GetWeakPtr(), display_handler_, | 54 runtime_, GetWeakPtr(), display_handler_, |
| 55 secret_fetcher_->GetWeakPtr(), username, auth_token, host_jid, host_id, | 55 secret_fetcher_->GetWeakPtr(), username, auth_token, host_jid, host_id, |
| 56 host_pubkey, pairing_id, pairing_secret, capabilities, flags)); | 56 host_pubkey, pairing_id, pairing_secret, capabilities, flags)); |
| 57 session_->Connect(); | 57 session_->Connect(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void JniClient::DisconnectFromHost() { | 60 void JniClient::DisconnectFromHost() { |
| 61 DCHECK(runtime_->ui_task_runner()->BelongsToCurrentThread()); | 61 DCHECK(runtime_->ui_task_runner()->BelongsToCurrentThread()); |
| 62 display_handler_ = nullptr; | 62 display_handler_ = nullptr; |
| 63 secret_fetcher_.reset(); | |
| 64 if (session_) { | 63 if (session_) { |
| 65 session_->Disconnect(); | 64 session_->Disconnect(); |
| 66 runtime_->network_task_runner()->DeleteSoon(FROM_HERE, | 65 runtime_->network_task_runner()->DeleteSoon(FROM_HERE, |
| 67 session_.release()); | 66 session_.release()); |
| 68 } | 67 } |
| 68 if (secret_fetcher_) { | |
| 69 runtime_->network_task_runner()->DeleteSoon(FROM_HERE, | |
| 70 secret_fetcher_.release()); | |
|
Lambros
2016/06/07 01:21:12
Indentation looks wrong here (and also on line 66)
Yuwei
2016/06/07 18:01:03
Done.
| |
| 71 } | |
| 69 } | 72 } |
| 70 | 73 |
| 71 void JniClient::OnConnectionState(protocol::ConnectionToHost::State state, | 74 void JniClient::OnConnectionState(protocol::ConnectionToHost::State state, |
| 72 protocol::ErrorCode error) { | 75 protocol::ErrorCode error) { |
| 73 DCHECK(runtime_->ui_task_runner()->BelongsToCurrentThread()); | 76 DCHECK(runtime_->ui_task_runner()->BelongsToCurrentThread()); |
| 74 | 77 |
| 75 JNIEnv* env = base::android::AttachCurrentThread(); | 78 JNIEnv* env = base::android::AttachCurrentThread(); |
| 76 Java_Client_onConnectionState(env, java_client_.obj(), state, error); | 79 Java_Client_onConnectionState(env, java_client_.obj(), state, error); |
| 77 } | 80 } |
| 78 | 81 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 return weak_factory_.GetWeakPtr(); | 287 return weak_factory_.GetWeakPtr(); |
| 285 } | 288 } |
| 286 | 289 |
| 287 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& caller) { | 290 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& caller) { |
| 288 return reinterpret_cast<intptr_t>( | 291 return reinterpret_cast<intptr_t>( |
| 289 new JniClient(ChromotingJniRuntime::GetInstance(), | 292 new JniClient(ChromotingJniRuntime::GetInstance(), |
| 290 base::android::ScopedJavaGlobalRef<jobject>(env, caller))); | 293 base::android::ScopedJavaGlobalRef<jobject>(env, caller))); |
| 291 } | 294 } |
| 292 | 295 |
| 293 } // namespace remoting | 296 } // namespace remoting |
| OLD | NEW |