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

Side by Side Diff: remoting/client/jni/jni_pairing_secret_fetcher.cc

Issue 2007123003: [Android Client] Break down multi-threaded classes by thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename JniSecretFetcher to JniPairingSecretFetcher Created 4 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include <remoting/client/jni/jni_pairing_secret_fetcher.h>
6 #include "base/bind.h"
7 #include "base/location.h"
8 #include "remoting/client/jni/chromoting_jni_runtime.h"
9 #include "remoting/client/jni/jni_client.h"
10
11 namespace remoting {
12
13 JniPairingSecretFetcher::JniPairingSecretFetcher(ChromotingJniRuntime* runtime,
14 base::WeakPtr<JniClient> client,
15 const std::string& host_id) :
16 jni_runtime_(runtime),
17 jni_client_(client),
18 host_id_(host_id),
19 weak_factory_(this) {}
20
21 JniPairingSecretFetcher::~JniPairingSecretFetcher() {
22 DCHECK(jni_runtime_->ui_task_runner()->BelongsToCurrentThread());
23 }
24
25 void JniPairingSecretFetcher::FetchSecret(
26 bool pairable,
27 const protocol::SecretFetchedCallback& callback) {
28 DCHECK (jni_runtime_->ui_task_runner()->BelongsToCurrentThread());
29
30 if (!jni_client_) {
31 return;
32 }
33
34 // Delete pairing credentials if they exist.
35 jni_client_->CommitPairingCredentials(host_id_, "", "");
36
37 callback_ = callback;
38 jni_client_->DisplayAuthenticationPrompt(pairable);
39 }
40
41 void JniPairingSecretFetcher::ProvideSecret(const std::string& pin) {
42 DCHECK(jni_runtime_->ui_task_runner()->BelongsToCurrentThread());
43 DCHECK(!callback_.is_null());
44
45 jni_runtime_->network_task_runner()->PostTask(FROM_HERE,
46 base::Bind(callback_, pin));
47 }
48
49 base::WeakPtr<JniPairingSecretFetcher> JniPairingSecretFetcher::GetWeakPtr() {
50 return weak_factory_.GetWeakPtr();
51 }
52
53 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/jni/jni_pairing_secret_fetcher.h ('k') | remoting/client/jni/remoting_jni_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698