| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SSL_CLIENT_SOCKET_POOL_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ |
| 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 SOCKSClientSocketPool* socks_pool, | 99 SOCKSClientSocketPool* socks_pool, |
| 100 HttpProxyClientSocketPool* http_proxy_pool, | 100 HttpProxyClientSocketPool* http_proxy_pool, |
| 101 ClientSocketFactory* client_socket_factory, | 101 ClientSocketFactory* client_socket_factory, |
| 102 HostResolver* host_resolver, | 102 HostResolver* host_resolver, |
| 103 const SSLClientSocketContext& context, | 103 const SSLClientSocketContext& context, |
| 104 Delegate* delegate, | 104 Delegate* delegate, |
| 105 NetLog* net_log); | 105 NetLog* net_log); |
| 106 virtual ~SSLConnectJob(); | 106 virtual ~SSLConnectJob(); |
| 107 | 107 |
| 108 // ConnectJob methods. | 108 // ConnectJob methods. |
| 109 virtual LoadState GetLoadState() const; | 109 virtual LoadState GetLoadState() const OVERRIDE; |
| 110 | 110 |
| 111 virtual void GetAdditionalErrorState(ClientSocketHandle * handle); | 111 virtual void GetAdditionalErrorState(ClientSocketHandle * handle) OVERRIDE; |
| 112 | 112 |
| 113 private: | 113 private: |
| 114 enum State { | 114 enum State { |
| 115 STATE_TRANSPORT_CONNECT, | 115 STATE_TRANSPORT_CONNECT, |
| 116 STATE_TRANSPORT_CONNECT_COMPLETE, | 116 STATE_TRANSPORT_CONNECT_COMPLETE, |
| 117 STATE_SOCKS_CONNECT, | 117 STATE_SOCKS_CONNECT, |
| 118 STATE_SOCKS_CONNECT_COMPLETE, | 118 STATE_SOCKS_CONNECT_COMPLETE, |
| 119 STATE_TUNNEL_CONNECT, | 119 STATE_TUNNEL_CONNECT, |
| 120 STATE_TUNNEL_CONNECT_COMPLETE, | 120 STATE_TUNNEL_CONNECT_COMPLETE, |
| 121 STATE_SSL_CONNECT, | 121 STATE_SSL_CONNECT, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 133 int DoSOCKSConnect(); | 133 int DoSOCKSConnect(); |
| 134 int DoSOCKSConnectComplete(int result); | 134 int DoSOCKSConnectComplete(int result); |
| 135 int DoTunnelConnect(); | 135 int DoTunnelConnect(); |
| 136 int DoTunnelConnectComplete(int result); | 136 int DoTunnelConnectComplete(int result); |
| 137 int DoSSLConnect(); | 137 int DoSSLConnect(); |
| 138 int DoSSLConnectComplete(int result); | 138 int DoSSLConnectComplete(int result); |
| 139 | 139 |
| 140 // Starts the SSL connection process. Returns OK on success and | 140 // Starts the SSL connection process. Returns OK on success and |
| 141 // ERR_IO_PENDING if it cannot immediately service the request. | 141 // ERR_IO_PENDING if it cannot immediately service the request. |
| 142 // Otherwise, it returns a net error code. | 142 // Otherwise, it returns a net error code. |
| 143 virtual int ConnectInternal(); | 143 virtual int ConnectInternal() OVERRIDE; |
| 144 | 144 |
| 145 scoped_refptr<SSLSocketParams> params_; | 145 scoped_refptr<SSLSocketParams> params_; |
| 146 TransportClientSocketPool* const transport_pool_; | 146 TransportClientSocketPool* const transport_pool_; |
| 147 SOCKSClientSocketPool* const socks_pool_; | 147 SOCKSClientSocketPool* const socks_pool_; |
| 148 HttpProxyClientSocketPool* const http_proxy_pool_; | 148 HttpProxyClientSocketPool* const http_proxy_pool_; |
| 149 ClientSocketFactory* const client_socket_factory_; | 149 ClientSocketFactory* const client_socket_factory_; |
| 150 HostResolver* const host_resolver_; | 150 HostResolver* const host_resolver_; |
| 151 | 151 |
| 152 const SSLClientSocketContext context_; | 152 const SSLClientSocketContext context_; |
| 153 | 153 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 NetLog* net_log); | 189 NetLog* net_log); |
| 190 | 190 |
| 191 virtual ~SSLClientSocketPool(); | 191 virtual ~SSLClientSocketPool(); |
| 192 | 192 |
| 193 // ClientSocketPool methods: | 193 // ClientSocketPool methods: |
| 194 virtual int RequestSocket(const std::string& group_name, | 194 virtual int RequestSocket(const std::string& group_name, |
| 195 const void* connect_params, | 195 const void* connect_params, |
| 196 RequestPriority priority, | 196 RequestPriority priority, |
| 197 ClientSocketHandle* handle, | 197 ClientSocketHandle* handle, |
| 198 OldCompletionCallback* callback, | 198 OldCompletionCallback* callback, |
| 199 const BoundNetLog& net_log); | 199 const BoundNetLog& net_log) OVERRIDE; |
| 200 | 200 |
| 201 virtual void RequestSockets(const std::string& group_name, | 201 virtual void RequestSockets(const std::string& group_name, |
| 202 const void* params, | 202 const void* params, |
| 203 int num_sockets, | 203 int num_sockets, |
| 204 const BoundNetLog& net_log); | 204 const BoundNetLog& net_log) OVERRIDE; |
| 205 | 205 |
| 206 virtual void CancelRequest(const std::string& group_name, | 206 virtual void CancelRequest(const std::string& group_name, |
| 207 ClientSocketHandle* handle); | 207 ClientSocketHandle* handle) OVERRIDE; |
| 208 | 208 |
| 209 virtual void ReleaseSocket(const std::string& group_name, | 209 virtual void ReleaseSocket(const std::string& group_name, |
| 210 StreamSocket* socket, | 210 StreamSocket* socket, |
| 211 int id); | 211 int id) OVERRIDE; |
| 212 | 212 |
| 213 virtual void Flush(); | 213 virtual void Flush() OVERRIDE; |
| 214 | 214 |
| 215 virtual void CloseIdleSockets(); | 215 virtual void CloseIdleSockets() OVERRIDE; |
| 216 | 216 |
| 217 virtual int IdleSocketCount() const; | 217 virtual int IdleSocketCount() const OVERRIDE; |
| 218 | 218 |
| 219 virtual int IdleSocketCountInGroup(const std::string& group_name) const; | 219 virtual int IdleSocketCountInGroup( |
| 220 const std::string& group_name) const OVERRIDE; |
| 220 | 221 |
| 221 virtual LoadState GetLoadState(const std::string& group_name, | 222 virtual LoadState GetLoadState( |
| 222 const ClientSocketHandle* handle) const; | 223 const std::string& group_name, |
| 224 const ClientSocketHandle* handle) const OVERRIDE; |
| 223 | 225 |
| 224 virtual base::DictionaryValue* GetInfoAsValue( | 226 virtual base::DictionaryValue* GetInfoAsValue( |
| 225 const std::string& name, | 227 const std::string& name, |
| 226 const std::string& type, | 228 const std::string& type, |
| 227 bool include_nested_pools) const; | 229 bool include_nested_pools) const OVERRIDE; |
| 228 | 230 |
| 229 virtual base::TimeDelta ConnectionTimeout() const; | 231 virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; |
| 230 | 232 |
| 231 virtual ClientSocketPoolHistograms* histograms() const; | 233 virtual ClientSocketPoolHistograms* histograms() const OVERRIDE; |
| 232 | 234 |
| 233 private: | 235 private: |
| 234 typedef ClientSocketPoolBase<SSLSocketParams> PoolBase; | 236 typedef ClientSocketPoolBase<SSLSocketParams> PoolBase; |
| 235 | 237 |
| 236 // SSLConfigService::Observer methods: | 238 // SSLConfigService::Observer methods: |
| 237 | 239 |
| 238 // When the user changes the SSL config, we flush all idle sockets so they | 240 // When the user changes the SSL config, we flush all idle sockets so they |
| 239 // won't get re-used. | 241 // won't get re-used. |
| 240 virtual void OnSSLConfigChanged(); | 242 virtual void OnSSLConfigChanged() OVERRIDE; |
| 241 | 243 |
| 242 class SSLConnectJobFactory : public PoolBase::ConnectJobFactory { | 244 class SSLConnectJobFactory : public PoolBase::ConnectJobFactory { |
| 243 public: | 245 public: |
| 244 SSLConnectJobFactory( | 246 SSLConnectJobFactory( |
| 245 TransportClientSocketPool* transport_pool, | 247 TransportClientSocketPool* transport_pool, |
| 246 SOCKSClientSocketPool* socks_pool, | 248 SOCKSClientSocketPool* socks_pool, |
| 247 HttpProxyClientSocketPool* http_proxy_pool, | 249 HttpProxyClientSocketPool* http_proxy_pool, |
| 248 ClientSocketFactory* client_socket_factory, | 250 ClientSocketFactory* client_socket_factory, |
| 249 HostResolver* host_resolver, | 251 HostResolver* host_resolver, |
| 250 const SSLClientSocketContext& context, | 252 const SSLClientSocketContext& context, |
| 251 NetLog* net_log); | 253 NetLog* net_log); |
| 252 | 254 |
| 253 virtual ~SSLConnectJobFactory() {} | 255 virtual ~SSLConnectJobFactory() {} |
| 254 | 256 |
| 255 // ClientSocketPoolBase::ConnectJobFactory methods. | 257 // ClientSocketPoolBase::ConnectJobFactory methods. |
| 256 virtual ConnectJob* NewConnectJob( | 258 virtual ConnectJob* NewConnectJob( |
| 257 const std::string& group_name, | 259 const std::string& group_name, |
| 258 const PoolBase::Request& request, | 260 const PoolBase::Request& request, |
| 259 ConnectJob::Delegate* delegate) const; | 261 ConnectJob::Delegate* delegate) const OVERRIDE; |
| 260 | 262 |
| 261 virtual base::TimeDelta ConnectionTimeout() const { return timeout_; } | 263 virtual base::TimeDelta ConnectionTimeout() const OVERRIDE { |
| 264 return timeout_; |
| 265 } |
| 262 | 266 |
| 263 private: | 267 private: |
| 264 TransportClientSocketPool* const transport_pool_; | 268 TransportClientSocketPool* const transport_pool_; |
| 265 SOCKSClientSocketPool* const socks_pool_; | 269 SOCKSClientSocketPool* const socks_pool_; |
| 266 HttpProxyClientSocketPool* const http_proxy_pool_; | 270 HttpProxyClientSocketPool* const http_proxy_pool_; |
| 267 ClientSocketFactory* const client_socket_factory_; | 271 ClientSocketFactory* const client_socket_factory_; |
| 268 HostResolver* const host_resolver_; | 272 HostResolver* const host_resolver_; |
| 269 const SSLClientSocketContext context_; | 273 const SSLClientSocketContext context_; |
| 270 base::TimeDelta timeout_; | 274 base::TimeDelta timeout_; |
| 271 NetLog* net_log_; | 275 NetLog* net_log_; |
| 272 | 276 |
| 273 DISALLOW_COPY_AND_ASSIGN(SSLConnectJobFactory); | 277 DISALLOW_COPY_AND_ASSIGN(SSLConnectJobFactory); |
| 274 }; | 278 }; |
| 275 | 279 |
| 276 TransportClientSocketPool* const transport_pool_; | 280 TransportClientSocketPool* const transport_pool_; |
| 277 SOCKSClientSocketPool* const socks_pool_; | 281 SOCKSClientSocketPool* const socks_pool_; |
| 278 HttpProxyClientSocketPool* const http_proxy_pool_; | 282 HttpProxyClientSocketPool* const http_proxy_pool_; |
| 279 PoolBase base_; | 283 PoolBase base_; |
| 280 const scoped_refptr<SSLConfigService> ssl_config_service_; | 284 const scoped_refptr<SSLConfigService> ssl_config_service_; |
| 281 | 285 |
| 282 DISALLOW_COPY_AND_ASSIGN(SSLClientSocketPool); | 286 DISALLOW_COPY_AND_ASSIGN(SSLClientSocketPool); |
| 283 }; | 287 }; |
| 284 | 288 |
| 285 REGISTER_SOCKET_PARAMS_FOR_POOL(SSLClientSocketPool, SSLSocketParams); | 289 REGISTER_SOCKET_PARAMS_FOR_POOL(SSLClientSocketPool, SSLSocketParams); |
| 286 | 290 |
| 287 } // namespace net | 291 } // namespace net |
| 288 | 292 |
| 289 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ | 293 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ |
| OLD | NEW |