| OLD | NEW | 
|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 NET_SOCKET_CLIENT_SOCKET_FACTORY_H_ | 5 #ifndef NET_SOCKET_CLIENT_SOCKET_FACTORY_H_ | 
| 6 #define NET_SOCKET_CLIENT_SOCKET_FACTORY_H_ | 6 #define NET_SOCKET_CLIENT_SOCKET_FACTORY_H_ | 
| 7 #pragma once | 7 #pragma once | 
| 8 | 8 | 
| 9 #include <string> | 9 #include <string> | 
| 10 | 10 | 
| 11 #include "net/base/net_log.h" | 11 #include "net/base/net_log.h" | 
| 12 | 12 | 
| 13 namespace net { | 13 namespace net { | 
| 14 | 14 | 
| 15 class AddressList; | 15 class AddressList; | 
| 16 class ClientSocket; | 16 class ClientSocket; | 
| 17 class ClientSocketHandle; | 17 class ClientSocketHandle; | 
| 18 class SSLClientSocket; | 18 class SSLClientSocket; | 
| 19 struct SSLConfig; | 19 struct SSLConfig; | 
| 20 class SSLHostInfo; |  | 
| 21 | 20 | 
| 22 // Callback function to create new SSLClientSocket objects. | 21 // Callback function to create new SSLClientSocket objects. | 
| 23 typedef SSLClientSocket* (*SSLClientSocketFactory)( | 22 typedef SSLClientSocket* (*SSLClientSocketFactory)( | 
| 24     ClientSocketHandle* transport_socket, | 23     ClientSocketHandle* transport_socket, | 
| 25     const std::string& hostname, | 24     const std::string& hostname, | 
| 26     const SSLConfig& ssl_config, | 25     const SSLConfig& ssl_config); | 
| 27     SSLHostInfo* ssl_host_info); |  | 
| 28 | 26 | 
| 29 // An interface used to instantiate ClientSocket objects.  Used to facilitate | 27 // An interface used to instantiate ClientSocket objects.  Used to facilitate | 
| 30 // testing code with mock socket implementations. | 28 // testing code with mock socket implementations. | 
| 31 class ClientSocketFactory { | 29 class ClientSocketFactory { | 
| 32  public: | 30  public: | 
| 33   virtual ~ClientSocketFactory() {} | 31   virtual ~ClientSocketFactory() {} | 
| 34 | 32 | 
| 35   // |source| is the NetLog::Source for the entity trying to create the socket, | 33   // |source| is the NetLog::Source for the entity trying to create the socket, | 
| 36   // if it has one. | 34   // if it has one. | 
| 37   virtual ClientSocket* CreateTCPClientSocket( | 35   virtual ClientSocket* CreateTCPClientSocket( | 
| 38       const AddressList& addresses, | 36       const AddressList& addresses, | 
| 39       NetLog* net_log, | 37       NetLog* net_log, | 
| 40       const NetLog::Source& source) = 0; | 38       const NetLog::Source& source) = 0; | 
| 41 | 39 | 
| 42   virtual SSLClientSocket* CreateSSLClientSocket( | 40   virtual SSLClientSocket* CreateSSLClientSocket( | 
| 43       ClientSocketHandle* transport_socket, | 41       ClientSocketHandle* transport_socket, | 
| 44       const std::string& hostname, | 42       const std::string& hostname, | 
| 45       const SSLConfig& ssl_config, | 43       const SSLConfig& ssl_config) = 0; | 
| 46       SSLHostInfo* ssl_host_info) = 0; | 44 | 
| 47 | 45 | 
| 48   // Deprecated function (http://crbug.com/37810) that takes a ClientSocket. | 46   // Deprecated function (http://crbug.com/37810) that takes a ClientSocket. | 
| 49   virtual SSLClientSocket* CreateSSLClientSocket(ClientSocket* transport_socket, | 47   virtual SSLClientSocket* CreateSSLClientSocket(ClientSocket* transport_socket, | 
| 50                                                  const std::string& hostname, | 48                                                  const std::string& hostname, | 
| 51                                                  const SSLConfig& ssl_config, | 49                                                  const SSLConfig& ssl_config); | 
| 52                                                  SSLHostInfo* ssl_host_info); |  | 
| 53 | 50 | 
| 54   // Returns the default ClientSocketFactory. | 51   // Returns the default ClientSocketFactory. | 
| 55   static ClientSocketFactory* GetDefaultFactory(); | 52   static ClientSocketFactory* GetDefaultFactory(); | 
| 56 | 53 | 
| 57   // Instructs the default ClientSocketFactory to use |factory| to create | 54   // Instructs the default ClientSocketFactory to use |factory| to create | 
| 58   // SSLClientSocket objects. | 55   // SSLClientSocket objects. | 
| 59   static void SetSSLClientSocketFactory(SSLClientSocketFactory factory); | 56   static void SetSSLClientSocketFactory(SSLClientSocketFactory factory); | 
| 60 }; | 57 }; | 
| 61 | 58 | 
| 62 }  // namespace net | 59 }  // namespace net | 
| 63 | 60 | 
| 64 #endif  // NET_SOCKET_CLIENT_SOCKET_FACTORY_H_ | 61 #endif  // NET_SOCKET_CLIENT_SOCKET_FACTORY_H_ | 
| OLD | NEW | 
|---|