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