OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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_REJECTING_AUTHENTICATOR_FACTORY_H_ | 5 #ifndef REMOTING_PROTOCOL_REJECTING_AUTHENTICATOR_FACTORY_H_ |
6 #define REMOTING_PROTOCOL_REJECTING_AUTHENTICATOR_FACTORY_H_ | 6 #define REMOTING_PROTOCOL_REJECTING_AUTHENTICATOR_FACTORY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "remoting/protocol/authenticator.h" | 11 #include "remoting/protocol/authenticator.h" |
12 | 12 |
13 namespace remoting { | 13 namespace remoting { |
14 namespace protocol { | 14 namespace protocol { |
15 | 15 |
16 // Authenticator that accepts one message and rejects connection after that. | 16 // Authenticator that accepts one message and rejects connection after that. |
17 class RejectingAuthenticator : public Authenticator { | 17 class RejectingAuthenticator : public Authenticator { |
18 public: | 18 public: |
19 RejectingAuthenticator(RejectionReason rejection_reason); | 19 RejectingAuthenticator(RejectionReason rejection_reason); |
20 ~RejectingAuthenticator() override; | 20 ~RejectingAuthenticator() override; |
21 | 21 |
22 // Authenticator interface | 22 // Authenticator interface |
23 State state() const override; | 23 State state() const override; |
24 bool started() const override; | 24 bool started() const override; |
25 RejectionReason rejection_reason() const override; | 25 RejectionReason rejection_reason() const override; |
26 void ProcessMessage(const buzz::XmlElement* message, | 26 void ProcessMessage(const buzz::XmlElement* message, |
27 const base::Closure& resume_callback) override; | 27 const base::Closure& resume_callback) override; |
28 scoped_ptr<buzz::XmlElement> GetNextMessage() override; | 28 std::unique_ptr<buzz::XmlElement> GetNextMessage() override; |
29 const std::string& GetAuthKey() const override; | 29 const std::string& GetAuthKey() const override; |
30 scoped_ptr<ChannelAuthenticator> CreateChannelAuthenticator() const override; | 30 std::unique_ptr<ChannelAuthenticator> CreateChannelAuthenticator() |
| 31 const override; |
31 | 32 |
32 private: | 33 private: |
33 RejectionReason rejection_reason_; | 34 RejectionReason rejection_reason_; |
34 State state_ = WAITING_MESSAGE; | 35 State state_ = WAITING_MESSAGE; |
35 std::string auth_key_; | 36 std::string auth_key_; |
36 | 37 |
37 DISALLOW_COPY_AND_ASSIGN(RejectingAuthenticator); | 38 DISALLOW_COPY_AND_ASSIGN(RejectingAuthenticator); |
38 }; | 39 }; |
39 | 40 |
40 } // namespace protocol | 41 } // namespace protocol |
41 } // namespace remoting | 42 } // namespace remoting |
42 | 43 |
43 #endif // REMOTING_PROTOCOL_REJECTING_AUTHENTICATOR_FACTORY_H_ | 44 #endif // REMOTING_PROTOCOL_REJECTING_AUTHENTICATOR_FACTORY_H_ |
OLD | NEW |