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(); |
63 if (session_) { | 64 if (session_) { |
64 session_->Disconnect(); | 65 session_->Disconnect(); |
65 runtime_->network_task_runner()->DeleteSoon(FROM_HERE, | 66 runtime_->network_task_runner()->DeleteSoon(FROM_HERE, |
66 session_.release()); | 67 session_.release()); |
67 } | 68 } |
68 } | 69 } |
69 | 70 |
70 void JniClient::OnConnectionState(protocol::ConnectionToHost::State state, | 71 void JniClient::OnConnectionState(protocol::ConnectionToHost::State state, |
71 protocol::ErrorCode error) { | 72 protocol::ErrorCode error) { |
72 DCHECK(runtime_->ui_task_runner()->BelongsToCurrentThread()); | 73 DCHECK(runtime_->ui_task_runner()->BelongsToCurrentThread()); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 return weak_factory_.GetWeakPtr(); | 284 return weak_factory_.GetWeakPtr(); |
284 } | 285 } |
285 | 286 |
286 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& caller) { | 287 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& caller) { |
287 return reinterpret_cast<intptr_t>( | 288 return reinterpret_cast<intptr_t>( |
288 new JniClient(ChromotingJniRuntime::GetInstance(), | 289 new JniClient(ChromotingJniRuntime::GetInstance(), |
289 base::android::ScopedJavaGlobalRef<jobject>(env, caller))); | 290 base::android::ScopedJavaGlobalRef<jobject>(env, caller))); |
290 } | 291 } |
291 | 292 |
292 } // namespace remoting | 293 } // namespace remoting |
OLD | NEW |