| 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_AUTH_HANDLER_H_ | 5 #ifndef REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_AUTH_HANDLER_H_ |
| 6 #define REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_AUTH_HANDLER_H_ | 6 #define REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_AUTH_HANDLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // Creates a platform-specific SecurityKeyAuthHandler. | 34 // Creates a platform-specific SecurityKeyAuthHandler. |
| 35 // All invocations of |send_message_callback| are guaranteed to occur before | 35 // All invocations of |send_message_callback| are guaranteed to occur before |
| 36 // the underlying SecurityKeyAuthHandler object is destroyed. It is not safe | 36 // the underlying SecurityKeyAuthHandler object is destroyed. It is not safe |
| 37 // to destroy the SecurityKeyAuthHandler object within the callback. | 37 // to destroy the SecurityKeyAuthHandler object within the callback. |
| 38 // |client_session_details| will be valid until this instance is destroyed. | 38 // |client_session_details| will be valid until this instance is destroyed. |
| 39 static std::unique_ptr<SecurityKeyAuthHandler> Create( | 39 static std::unique_ptr<SecurityKeyAuthHandler> Create( |
| 40 ClientSessionDetails* client_session_details, | 40 ClientSessionDetails* client_session_details, |
| 41 const SendMessageCallback& send_message_callback, | 41 const SendMessageCallback& send_message_callback, |
| 42 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner); | 42 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner); |
| 43 | 43 |
| 44 #if defined(OS_LINUX) | 44 #if defined(OS_POSIX) |
| 45 // Specify the name of the socket to listen to security key requests on. | 45 // Specify the name of the socket to listen to security key requests on. |
| 46 static void SetSecurityKeySocketName( | 46 static void SetSecurityKeySocketName( |
| 47 const base::FilePath& security_key_socket_name); | 47 const base::FilePath& security_key_socket_name); |
| 48 #endif // defined(OS_LINUX) | 48 #endif // defined(OS_POSIX) |
| 49 | 49 |
| 50 // Sets the callback used to send messages to the client. | 50 // Sets the callback used to send messages to the client. |
| 51 virtual void SetSendMessageCallback(const SendMessageCallback& callback) = 0; | 51 virtual void SetSendMessageCallback(const SendMessageCallback& callback) = 0; |
| 52 | 52 |
| 53 // Creates the platform specific connection to handle security key requests. | 53 // Creates the platform specific connection to handle security key requests. |
| 54 virtual void CreateSecurityKeyConnection() = 0; | 54 virtual void CreateSecurityKeyConnection() = 0; |
| 55 | 55 |
| 56 // Returns true if |security_key_connection_id| represents a valid connection. | 56 // Returns true if |security_key_connection_id| represents a valid connection. |
| 57 virtual bool IsValidConnectionId(int security_key_connection_id) const = 0; | 57 virtual bool IsValidConnectionId(int security_key_connection_id) const = 0; |
| 58 | 58 |
| 59 // Sends security key response from client to local security key agent. | 59 // Sends security key response from client to local security key agent. |
| 60 virtual void SendClientResponse(int security_key_connection_id, | 60 virtual void SendClientResponse(int security_key_connection_id, |
| 61 const std::string& response) = 0; | 61 const std::string& response) = 0; |
| 62 | 62 |
| 63 // Closes key connection represented by |security_key_connection_id|. | 63 // Closes key connection represented by |security_key_connection_id|. |
| 64 virtual void SendErrorAndCloseConnection(int security_key_connection_id) = 0; | 64 virtual void SendErrorAndCloseConnection(int security_key_connection_id) = 0; |
| 65 | 65 |
| 66 // Returns the number of active security key connections. | 66 // Returns the number of active security key connections. |
| 67 virtual size_t GetActiveConnectionCountForTest() const = 0; | 67 virtual size_t GetActiveConnectionCountForTest() const = 0; |
| 68 | 68 |
| 69 // Sets the timeout used when waiting for a security key response. | 69 // Sets the timeout used when waiting for a security key response. |
| 70 virtual void SetRequestTimeoutForTest(base::TimeDelta timeout) = 0; | 70 virtual void SetRequestTimeoutForTest(base::TimeDelta timeout) = 0; |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 } // namespace remoting | 73 } // namespace remoting |
| 74 | 74 |
| 75 #endif // REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_AUTH_HANDLER_H_ | 75 #endif // REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_AUTH_HANDLER_H_ |
| OLD | NEW |