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

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

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 #ifndef REMOTING_CLIENT_JNI_JNI_PAIRING_SECRET_FETCHER_H_
6 #define REMOTING_CLIENT_JNI_JNI_PAIRING_SECRET_FETCHER_H_
7
8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h"
10 #include "remoting/protocol/client_authentication_config.h"
11
12 namespace remoting {
13
14 class ChromotingJniRuntime;
15 class JniClient;
16
17 // This class fetches the pairing secret on the UI thread. It must be deleted
18 // on UI.
19 class JniPairingSecretFetcher {
20 public:
21 JniPairingSecretFetcher(ChromotingJniRuntime* runtime,
22 base::WeakPtr<JniClient> client,
23 const std::string& host_id);
24 virtual ~JniPairingSecretFetcher();
25
26 // Called on UI thread. Notifies the user interface that the user needs to
27 // enter a PIN. The current authentication attempt is put on hold until
28 // |callback| is invoked. |callback| will be run on the network thread.
29 void FetchSecret(bool pairable,
30 const protocol::SecretFetchedCallback& callback);
31
32 // Provides the user's PIN and resumes the host authentication attempt. Call
33 // on the UI thread once the user has finished entering this PIN into the UI,
34 // but only after the UI has been asked to provide a PIN (via FetchSecret()).
35 void ProvideSecret(const std::string& pin);
36
37 // Get weak pointer to be used on the UI thread.
38 base::WeakPtr<JniPairingSecretFetcher> GetWeakPtr();
39
40 private:
41 ChromotingJniRuntime* jni_runtime_;
42 base::WeakPtr<JniClient> jni_client_;
43
44 std::string host_id_;
45
46 // Pass this the user's PIN once we have it. To be assigned and accessed on
47 // the UI thread, but must be posted to the network thread to call it.
48 protocol::SecretFetchedCallback callback_;
49
50 base::WeakPtrFactory<JniPairingSecretFetcher> weak_factory_;
51
52 DISALLOW_COPY_AND_ASSIGN(JniPairingSecretFetcher);
53 };
54
55 } // namespace remoting
56
57 #endif // REMOTING_CLIENT_JNI_JNI_PAIRING_SECRET_FETCHER_H_
OLDNEW
« no previous file with comments | « remoting/client/jni/jni_frame_consumer.cc ('k') | remoting/client/jni/jni_pairing_secret_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698