Reland r247589: <webview>: Fix text selection features in mac.
[chromium-blink-merge.git] / remoting / protocol / pairing_host_authenticator.h
blob57c900c3fde279321f4e7ac866aa70876c910bec
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 virtual ~PairingHostAuthenticator();
29 // Authenticator interface.
30 virtual State state() const OVERRIDE;
31 virtual RejectionReason rejection_reason() const OVERRIDE;
32 virtual void ProcessMessage(const buzz::XmlElement* message,
33 const base::Closure& resume_callback) OVERRIDE;
35 private:
36 // PairingAuthenticatorBase interface.
37 virtual void CreateV2AuthenticatorWithPIN(
38 State initial_state,
39 const SetAuthenticatorCallback& callback) OVERRIDE;
40 virtual 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_