OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef REMOTING_PROTOCOL_PAIRING_HOST_AUTHENTICATOR_H_ | 5 #ifndef REMOTING_PROTOCOL_PAIRING_HOST_AUTHENTICATOR_H_ |
6 #define REMOTING_PROTOCOL_PAIRING_HOST_AUTHENTICATOR_H_ | 6 #define REMOTING_PROTOCOL_PAIRING_HOST_AUTHENTICATOR_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "remoting/protocol/pairing_authenticator_base.h" | 9 #include "remoting/protocol/pairing_authenticator_base.h" |
10 #include "remoting/protocol/pairing_registry.h" | 10 #include "remoting/protocol/pairing_registry.h" |
11 | 11 |
12 namespace remoting { | 12 namespace remoting { |
13 | 13 |
14 class RsaKeyPair; | 14 class RsaKeyPair; |
15 | 15 |
16 namespace protocol { | 16 namespace protocol { |
17 | 17 |
18 class PairingRegistry; | 18 class PairingRegistry; |
19 | 19 |
20 class PairingHostAuthenticator : public PairingAuthenticatorBase { | 20 class PairingHostAuthenticator : public PairingAuthenticatorBase { |
21 public: | 21 public: |
22 PairingHostAuthenticator( | 22 PairingHostAuthenticator( |
23 scoped_refptr<PairingRegistry> pairing_registry, | 23 scoped_refptr<PairingRegistry> pairing_registry, |
24 const std::string& local_cert, | 24 const std::string& local_cert, |
25 scoped_refptr<RsaKeyPair> key_pair, | 25 scoped_refptr<RsaKeyPair> key_pair, |
26 const std::string& pin); | 26 const std::string& pin); |
27 virtual ~PairingHostAuthenticator(); | 27 ~PairingHostAuthenticator() override; |
28 | 28 |
29 // Authenticator interface. | 29 // Authenticator interface. |
30 virtual State state() const override; | 30 State state() const override; |
31 virtual RejectionReason rejection_reason() const override; | 31 RejectionReason rejection_reason() const override; |
32 virtual void ProcessMessage(const buzz::XmlElement* message, | 32 void ProcessMessage(const buzz::XmlElement* message, |
33 const base::Closure& resume_callback) override; | 33 const base::Closure& resume_callback) override; |
34 | 34 |
35 private: | 35 private: |
36 // PairingAuthenticatorBase interface. | 36 // PairingAuthenticatorBase interface. |
37 virtual void CreateV2AuthenticatorWithPIN( | 37 void CreateV2AuthenticatorWithPIN( |
38 State initial_state, | 38 State initial_state, |
39 const SetAuthenticatorCallback& callback) override; | 39 const SetAuthenticatorCallback& callback) override; |
40 virtual void AddPairingElements(buzz::XmlElement* message) override; | 40 void AddPairingElements(buzz::XmlElement* message) override; |
41 | 41 |
42 // Continue processing a protocol message once the pairing information for | 42 // Continue processing a protocol message once the pairing information for |
43 // the client id has been received. | 43 // the client id has been received. |
44 void ProcessMessageWithPairing(const buzz::XmlElement* message, | 44 void ProcessMessageWithPairing(const buzz::XmlElement* message, |
45 const base::Closure& resume_callback, | 45 const base::Closure& resume_callback, |
46 PairingRegistry::Pairing pairing); | 46 PairingRegistry::Pairing pairing); |
47 | 47 |
48 // Protocol state. | 48 // Protocol state. |
49 scoped_refptr<PairingRegistry> pairing_registry_; | 49 scoped_refptr<PairingRegistry> pairing_registry_; |
50 std::string local_cert_; | 50 std::string local_cert_; |
51 scoped_refptr<RsaKeyPair> key_pair_; | 51 scoped_refptr<RsaKeyPair> key_pair_; |
52 const std::string& pin_; | 52 const std::string& pin_; |
53 bool protocol_error_; | 53 bool protocol_error_; |
54 bool waiting_for_paired_secret_; | 54 bool waiting_for_paired_secret_; |
55 | 55 |
56 base::WeakPtrFactory<PairingHostAuthenticator> weak_factory_; | 56 base::WeakPtrFactory<PairingHostAuthenticator> weak_factory_; |
57 | 57 |
58 DISALLOW_COPY_AND_ASSIGN(PairingHostAuthenticator); | 58 DISALLOW_COPY_AND_ASSIGN(PairingHostAuthenticator); |
59 }; | 59 }; |
60 | 60 |
61 } // namespace protocol | 61 } // namespace protocol |
62 } // namespace remoting | 62 } // namespace remoting |
63 | 63 |
64 #endif // REMOTING_PROTOCOL_PAIRING_AUTHENTICATOR_H_ | 64 #endif // REMOTING_PROTOCOL_PAIRING_AUTHENTICATOR_H_ |
OLD | NEW |