| 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_SECURITY_KEY_IPC_SERVER_H_ | 5 #ifndef REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_IPC_SERVER_H_ |
| 6 #define REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_IPC_SERVER_H_ | 6 #define REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_IPC_SERVER_H_ |
| 7 | 7 |
| 8 #include <cstdint> | 8 #include <cstdint> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "remoting/host/security_key/security_key_auth_handler.h" | 14 #include "remoting/host/security_key/security_key_auth_handler.h" |
| 15 | 15 |
| 16 namespace remoting { | 16 namespace remoting { |
| 17 | 17 |
| 18 class ClientSessionDetails; |
| 18 class SecurityKeyIpcServerFactory; | 19 class SecurityKeyIpcServerFactory; |
| 19 | 20 |
| 20 // Responsible for handing the server end of the IPC channel between the | 21 // Responsible for handing the server end of the IPC channel between the |
| 21 // network process (server) and the remote_security_key process (client). | 22 // network process (server) and the remote_security_key process (client). |
| 22 class SecurityKeyIpcServer { | 23 class SecurityKeyIpcServer { |
| 23 public: | 24 public: |
| 24 virtual ~SecurityKeyIpcServer() {} | 25 virtual ~SecurityKeyIpcServer() {} |
| 25 | 26 |
| 26 // Creates a new SecurityKeyIpcServer instance. | 27 // Creates a new SecurityKeyIpcServer instance. |
| 27 static std::unique_ptr<SecurityKeyIpcServer> Create( | 28 static std::unique_ptr<SecurityKeyIpcServer> Create( |
| 28 int connection_id, | 29 int connection_id, |
| 29 uint32_t peer_session_id, | 30 ClientSessionDetails* client_session_details, |
| 30 base::TimeDelta initial_connect_timeout, | 31 base::TimeDelta initial_connect_timeout, |
| 31 const SecurityKeyAuthHandler::SendMessageCallback& message_callback, | 32 const SecurityKeyAuthHandler::SendMessageCallback& message_callback, |
| 32 const base::Closure& done_callback); | 33 const base::Closure& done_callback); |
| 33 | 34 |
| 34 // Used to set a Factory to generate fake/mock SecurityKeyIpcServer | 35 // Used to set a Factory to generate fake/mock SecurityKeyIpcServer |
| 35 // instances for testing. | 36 // instances for testing. |
| 36 static void SetFactoryForTest(SecurityKeyIpcServerFactory* factory); | 37 static void SetFactoryForTest(SecurityKeyIpcServerFactory* factory); |
| 37 | 38 |
| 38 // Creates and starts listening on an IPC channel with the given name. | 39 // Creates and starts listening on an IPC channel with the given name. |
| 39 virtual bool CreateChannel(const std::string& channel_name, | 40 virtual bool CreateChannel(const std::string& channel_name, |
| 40 base::TimeDelta request_timeout) = 0; | 41 base::TimeDelta request_timeout) = 0; |
| 41 | 42 |
| 42 // Sends a security key response IPC message via the IPC channel. | 43 // Sends a security key response IPC message via the IPC channel. |
| 43 virtual bool SendResponse(const std::string& message_data) = 0; | 44 virtual bool SendResponse(const std::string& message_data) = 0; |
| 44 }; | 45 }; |
| 45 | 46 |
| 46 // Used to allow for creating Fake/Mock SecurityKeyIpcServer for testing. | 47 // Used to allow for creating Fake/Mock SecurityKeyIpcServer for testing. |
| 47 class SecurityKeyIpcServerFactory { | 48 class SecurityKeyIpcServerFactory { |
| 48 public: | 49 public: |
| 49 virtual ~SecurityKeyIpcServerFactory() {} | 50 virtual ~SecurityKeyIpcServerFactory() {} |
| 50 | 51 |
| 51 virtual std::unique_ptr<SecurityKeyIpcServer> Create( | 52 virtual std::unique_ptr<SecurityKeyIpcServer> Create( |
| 52 int connection_id, | 53 int connection_id, |
| 53 uint32_t peer_session_id, | 54 ClientSessionDetails* client_session_details, |
| 54 base::TimeDelta connect_timeout, | 55 base::TimeDelta connect_timeout, |
| 55 const SecurityKeyAuthHandler::SendMessageCallback& message_callback, | 56 const SecurityKeyAuthHandler::SendMessageCallback& message_callback, |
| 56 const base::Closure& done_callback) = 0; | 57 const base::Closure& done_callback) = 0; |
| 57 }; | 58 }; |
| 58 | 59 |
| 59 } // namespace remoting | 60 } // namespace remoting |
| 60 | 61 |
| 61 #endif // REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_IPC_SERVER_H_ | 62 #endif // REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_IPC_SERVER_H_ |
| OLD | NEW |