password_manager::metrics_util::LogUMAHistogramBoolean should upload
[chromium-blink-merge.git] / remoting / protocol / pairing_host_authenticator.h
blob164bcd24b55f58c48e24bb51ca87adbab03a290e
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
3 // found in the LICENSE file.
5 #ifndef REMOTING_PROTOCOL_PAIRING_HOST_AUTHENTICATOR_H_
6 #define REMOTING_PROTOCOL_PAIRING_HOST_AUTHENTICATOR_H_
8 #include "base/memory/weak_ptr.h"
9 #include "remoting/protocol/pairing_authenticator_base.h"
10 #include "remoting/protocol/pairing_registry.h"
12 namespace remoting {
14 class RsaKeyPair;
16 namespace protocol {
18 class PairingRegistry;
20 class PairingHostAuthenticator : public PairingAuthenticatorBase {
21 public:
22 PairingHostAuthenticator(
23 scoped_refptr<PairingRegistry> pairing_registry,
24 const std::string& local_cert,
25 scoped_refptr<RsaKeyPair> key_pair,
26 const std::string& pin);
27 ~PairingHostAuthenticator() override;
29 // Authenticator interface.
30 State state() const override;
31 RejectionReason rejection_reason() const override;
32 void ProcessMessage(const buzz::XmlElement* message,
33 const base::Closure& resume_callback) override;
35 private:
36 // PairingAuthenticatorBase interface.
37 void CreateV2AuthenticatorWithPIN(
38 State initial_state,
39 const SetAuthenticatorCallback& callback) override;
40 void AddPairingElements(buzz::XmlElement* message) override;
42 // Continue processing a protocol message once the pairing information for
43 // the client id has been received.
44 void ProcessMessageWithPairing(const buzz::XmlElement* message,
45 const base::Closure& resume_callback,
46 PairingRegistry::Pairing pairing);
48 // Protocol state.
49 scoped_refptr<PairingRegistry> pairing_registry_;
50 std::string local_cert_;
51 scoped_refptr<RsaKeyPair> key_pair_;
52 const std::string& pin_;
53 bool protocol_error_;
54 bool waiting_for_paired_secret_;
56 base::WeakPtrFactory<PairingHostAuthenticator> weak_factory_;
58 DISALLOW_COPY_AND_ASSIGN(PairingHostAuthenticator);
61 } // namespace protocol
62 } // namespace remoting
64 #endif // REMOTING_PROTOCOL_PAIRING_AUTHENTICATOR_H_