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_HOST_SECURITY_KEY_GNUBBY_EXTENSION_SESSION_H_ | 5 #ifndef REMOTING_HOST_SECURITY_KEY_GNUBBY_EXTENSION_SESSION_H_ |
6 #define REMOTING_HOST_SECURITY_KEY_GNUBBY_EXTENSION_SESSION_H_ | 6 #define REMOTING_HOST_SECURITY_KEY_GNUBBY_EXTENSION_SESSION_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/callback.h" | 11 #include "base/callback.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
14 #include "remoting/host/host_extension_session.h" | 14 #include "remoting/host/host_extension_session.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class DictionaryValue; | 17 class DictionaryValue; |
18 } | 18 } |
19 | 19 |
20 namespace remoting { | 20 namespace remoting { |
21 | 21 |
22 class GnubbyAuthHandler; | 22 class GnubbyAuthHandler; |
23 | 23 |
24 namespace protocol { | 24 namespace protocol { |
25 class ClientStub; | 25 class ClientStub; |
26 } | 26 } |
27 | 27 |
28 // A HostExtensionSession implementation that enables Security Key support. | 28 // A HostExtensionSession implementation that enables Security Key support. |
29 class GnubbyExtensionSession : public HostExtensionSession { | 29 class GnubbyExtensionSession : public HostExtensionSession { |
30 public: | 30 public: |
31 explicit GnubbyExtensionSession(protocol::ClientStub* client_stub); | 31 explicit GnubbyExtensionSession(protocol::ClientStub* client_stub); |
32 ~GnubbyExtensionSession() override; | 32 ~GnubbyExtensionSession() override; |
33 | 33 |
34 // HostExtensionSession interface. | 34 // HostExtensionSession interface. |
35 bool OnExtensionMessage(ClientSessionControl* client_session_control, | 35 bool OnExtensionMessage(ClientSessionControl* client_session_control, |
36 protocol::ClientStub* client_stub, | 36 protocol::ClientStub* client_stub, |
37 const protocol::ExtensionMessage& message) override; | 37 const protocol::ExtensionMessage& message) override; |
38 | 38 |
39 // Allows the underlying GnubbyAuthHandler to be overridden for unit testing. | 39 // Allows the underlying GnubbyAuthHandler to be overridden for unit testing. |
40 void SetGnubbyAuthHandlerForTesting( | 40 void SetGnubbyAuthHandlerForTesting( |
41 scoped_ptr<GnubbyAuthHandler> gnubby_auth_handler); | 41 std::unique_ptr<GnubbyAuthHandler> gnubby_auth_handler); |
42 | 42 |
43 private: | 43 private: |
44 // These methods process specific gnubby extension message types. | 44 // These methods process specific gnubby extension message types. |
45 void ProcessControlMessage(base::DictionaryValue* message_data) const; | 45 void ProcessControlMessage(base::DictionaryValue* message_data) const; |
46 void ProcessDataMessage(base::DictionaryValue* message_data) const; | 46 void ProcessDataMessage(base::DictionaryValue* message_data) const; |
47 void ProcessErrorMessage(base::DictionaryValue* message_data) const; | 47 void ProcessErrorMessage(base::DictionaryValue* message_data) const; |
48 | 48 |
49 void SendMessageToClient(int connection_id, const std::string& data) const; | 49 void SendMessageToClient(int connection_id, const std::string& data) const; |
50 | 50 |
51 // Ensures GnubbyExtensionSession methods are called on the same thread. | 51 // Ensures GnubbyExtensionSession methods are called on the same thread. |
52 base::ThreadChecker thread_checker_; | 52 base::ThreadChecker thread_checker_; |
53 | 53 |
54 // Interface through which messages can be sent to the client. | 54 // Interface through which messages can be sent to the client. |
55 protocol::ClientStub* client_stub_ = nullptr; | 55 protocol::ClientStub* client_stub_ = nullptr; |
56 | 56 |
57 // Handles platform specific gnubby operations. | 57 // Handles platform specific gnubby operations. |
58 scoped_ptr<GnubbyAuthHandler> gnubby_auth_handler_; | 58 std::unique_ptr<GnubbyAuthHandler> gnubby_auth_handler_; |
59 | 59 |
60 DISALLOW_COPY_AND_ASSIGN(GnubbyExtensionSession); | 60 DISALLOW_COPY_AND_ASSIGN(GnubbyExtensionSession); |
61 }; | 61 }; |
62 | 62 |
63 } // namespace remoting | 63 } // namespace remoting |
64 | 64 |
65 #endif // REMOTING_HOST_SECURITY_KEY_GNUBBY_EXTENSION_SESSION_H_ | 65 #endif // REMOTING_HOST_SECURITY_KEY_GNUBBY_EXTENSION_SESSION_H_ |
OLD | NEW |