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

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

Issue 2753963002: Refactoring and rewriting the chromoting jni instance to be chromoting session. (Closed)
Patch Set: Pointer not obj. Created 3 years, 9 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.
Yuwei 2017/03/21 20:40:30 What happened to this file...?
nicholss 2017/03/29 20:32:36 Looks like the file dropped the .h and was added w
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 ChromotingClientRuntime;
15 class JniClient;
16
17 // This class fetches the pairing secret on the UI thread. This should be
18 // created on the UI thread but there after used and deleted on the network
19 // thread.
20 class JniPairingSecretFetcher {
21 public:
22 JniPairingSecretFetcher(base::WeakPtr<JniClient> client,
23 const std::string& host_id);
24 virtual ~JniPairingSecretFetcher();
25
26 // Notifies the user interface that the user needs to enter a PIN. The current
27 // authentication attempt is put on hold until |callback| is invoked.
28 void FetchSecret(bool pairable,
29 const protocol::SecretFetchedCallback& callback);
30
31 // Provides the user's PIN and resumes the host authentication attempt. Call
32 // once the user has finished entering this PIN into the UI, but only after
33 // the UI has been asked to provide a PIN (via FetchSecret()).
34 void ProvideSecret(const std::string& pin);
35
36 // Get weak pointer to be used on the network thread.
37 base::WeakPtr<JniPairingSecretFetcher> GetWeakPtr();
38
39 private:
40 static void FetchSecretOnUiThread(base::WeakPtr<JniClient> client,
41 const std::string& host_id,
42 bool pairable);
43
44 ChromotingClientRuntime* runtime_;
45 base::WeakPtr<JniClient> jni_client_;
46
47 std::string host_id_;
48
49 // Pass this the user's PIN once we have it. To be assigned and accessed on
50 // the UI thread, but must be posted to the network thread to call it.
51 protocol::SecretFetchedCallback callback_;
52
53 base::WeakPtr<JniPairingSecretFetcher> weak_ptr_;
54 base::WeakPtrFactory<JniPairingSecretFetcher> weak_factory_;
55
56 DISALLOW_COPY_AND_ASSIGN(JniPairingSecretFetcher);
57 };
58
59 } // namespace remoting
60
61 #endif // REMOTING_CLIENT_JNI_JNI_PAIRING_SECRET_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698