Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_ | 5 #ifndef NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_ |
| 6 #define NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_ | 6 #define NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 #include "net/socket/client_socket_pool_base.h" | 21 #include "net/socket/client_socket_pool_base.h" |
| 22 #include "net/socket/client_socket_pool_histograms.h" | 22 #include "net/socket/client_socket_pool_histograms.h" |
| 23 #include "net/socket/ssl_client_socket.h" | 23 #include "net/socket/ssl_client_socket.h" |
| 24 #include "net/spdy/spdy_session.h" | 24 #include "net/spdy/spdy_session.h" |
| 25 | 25 |
| 26 namespace net { | 26 namespace net { |
| 27 | 27 |
| 28 class HostResolver; | 28 class HostResolver; |
| 29 class HttpAuthCache; | 29 class HttpAuthCache; |
| 30 class HttpAuthHandlerFactory; | 30 class HttpAuthHandlerFactory; |
| 31 class ProxyDelegate; | |
| 31 class SSLClientSocketPool; | 32 class SSLClientSocketPool; |
| 32 class SSLSocketParams; | 33 class SSLSocketParams; |
| 33 class SpdySessionPool; | 34 class SpdySessionPool; |
| 34 class SpdyStream; | 35 class SpdyStream; |
| 35 class TransportClientSocketPool; | 36 class TransportClientSocketPool; |
| 36 class TransportSocketParams; | 37 class TransportSocketParams; |
| 37 | 38 |
| 38 // HttpProxySocketParams only needs the socket params for one of the proxy | 39 // HttpProxySocketParams only needs the socket params for one of the proxy |
| 39 // types. The other param must be NULL. When using an HTTP Proxy, | 40 // types. The other param must be NULL. When using an HTTP Proxy, |
| 40 // |transport_params| must be set. When using an HTTPS Proxy, |ssl_params| | 41 // |transport_params| must be set. When using an HTTPS Proxy, |ssl_params| |
| 41 // must be set. | 42 // must be set. |
| 42 class NET_EXPORT_PRIVATE HttpProxySocketParams | 43 class NET_EXPORT_PRIVATE HttpProxySocketParams |
| 43 : public base::RefCounted<HttpProxySocketParams> { | 44 : public base::RefCounted<HttpProxySocketParams> { |
| 44 public: | 45 public: |
| 45 HttpProxySocketParams( | 46 HttpProxySocketParams( |
| 46 const scoped_refptr<TransportSocketParams>& transport_params, | 47 const scoped_refptr<TransportSocketParams>& transport_params, |
| 47 const scoped_refptr<SSLSocketParams>& ssl_params, | 48 const scoped_refptr<SSLSocketParams>& ssl_params, |
| 48 const GURL& request_url, | 49 const GURL& request_url, |
| 49 const std::string& user_agent, | 50 const std::string& user_agent, |
| 50 const HostPortPair& endpoint, | 51 const HostPortPair& endpoint, |
| 51 HttpAuthCache* http_auth_cache, | 52 HttpAuthCache* http_auth_cache, |
| 52 HttpAuthHandlerFactory* http_auth_handler_factory, | 53 HttpAuthHandlerFactory* http_auth_handler_factory, |
| 53 SpdySessionPool* spdy_session_pool, | 54 SpdySessionPool* spdy_session_pool, |
| 54 bool tunnel); | 55 bool tunnel, |
| 56 ProxyDelegate* proxy_delegate); | |
| 55 | 57 |
| 56 const scoped_refptr<TransportSocketParams>& transport_params() const { | 58 const scoped_refptr<TransportSocketParams>& transport_params() const { |
| 57 return transport_params_; | 59 return transport_params_; |
| 58 } | 60 } |
| 59 const scoped_refptr<SSLSocketParams>& ssl_params() const { | 61 const scoped_refptr<SSLSocketParams>& ssl_params() const { |
| 60 return ssl_params_; | 62 return ssl_params_; |
| 61 } | 63 } |
| 62 const GURL& request_url() const { return request_url_; } | 64 const GURL& request_url() const { return request_url_; } |
| 63 const std::string& user_agent() const { return user_agent_; } | 65 const std::string& user_agent() const { return user_agent_; } |
| 64 const HostPortPair& endpoint() const { return endpoint_; } | 66 const HostPortPair& endpoint() const { return endpoint_; } |
| 65 HttpAuthCache* http_auth_cache() const { return http_auth_cache_; } | 67 HttpAuthCache* http_auth_cache() const { return http_auth_cache_; } |
| 66 HttpAuthHandlerFactory* http_auth_handler_factory() const { | 68 HttpAuthHandlerFactory* http_auth_handler_factory() const { |
| 67 return http_auth_handler_factory_; | 69 return http_auth_handler_factory_; |
| 68 } | 70 } |
| 69 SpdySessionPool* spdy_session_pool() { | 71 SpdySessionPool* spdy_session_pool() { |
| 70 return spdy_session_pool_; | 72 return spdy_session_pool_; |
| 71 } | 73 } |
| 72 const HostResolver::RequestInfo& destination() const; | 74 const HostResolver::RequestInfo& destination() const; |
| 73 bool tunnel() const { return tunnel_; } | 75 bool tunnel() const { return tunnel_; } |
| 74 bool ignore_limits() const { return ignore_limits_; } | 76 bool ignore_limits() const { return ignore_limits_; } |
| 75 | 77 |
| 78 ProxyDelegate* proxy_delegate() const { | |
| 79 return proxy_delegate_; | |
| 80 } | |
| 81 | |
| 76 private: | 82 private: |
| 77 friend class base::RefCounted<HttpProxySocketParams>; | 83 friend class base::RefCounted<HttpProxySocketParams>; |
| 78 ~HttpProxySocketParams(); | 84 ~HttpProxySocketParams(); |
| 79 | 85 |
| 80 const scoped_refptr<TransportSocketParams> transport_params_; | 86 const scoped_refptr<TransportSocketParams> transport_params_; |
| 81 const scoped_refptr<SSLSocketParams> ssl_params_; | 87 const scoped_refptr<SSLSocketParams> ssl_params_; |
| 82 SpdySessionPool* spdy_session_pool_; | 88 SpdySessionPool* spdy_session_pool_; |
| 83 const GURL request_url_; | 89 const GURL request_url_; |
| 84 const std::string user_agent_; | 90 const std::string user_agent_; |
| 85 const HostPortPair endpoint_; | 91 const HostPortPair endpoint_; |
| 86 HttpAuthCache* const http_auth_cache_; | 92 HttpAuthCache* const http_auth_cache_; |
| 87 HttpAuthHandlerFactory* const http_auth_handler_factory_; | 93 HttpAuthHandlerFactory* const http_auth_handler_factory_; |
| 88 const bool tunnel_; | 94 const bool tunnel_; |
| 89 bool ignore_limits_; | 95 bool ignore_limits_; |
| 96 ProxyDelegate* proxy_delegate_; | |
|
mef
2014/09/08 15:06:48
const
bengr
2014/09/09 01:28:49
Done.
| |
| 90 | 97 |
| 91 DISALLOW_COPY_AND_ASSIGN(HttpProxySocketParams); | 98 DISALLOW_COPY_AND_ASSIGN(HttpProxySocketParams); |
| 92 }; | 99 }; |
| 93 | 100 |
| 94 // HttpProxyConnectJob optionally establishes a tunnel through the proxy | 101 // HttpProxyConnectJob optionally establishes a tunnel through the proxy |
| 95 // server after connecting the underlying transport socket. | 102 // server after connecting the underlying transport socket. |
| 96 class HttpProxyConnectJob : public ConnectJob { | 103 class HttpProxyConnectJob : public ConnectJob { |
| 97 public: | 104 public: |
| 98 HttpProxyConnectJob(const std::string& group_name, | 105 HttpProxyConnectJob(const std::string& group_name, |
| 99 RequestPriority priority, | 106 RequestPriority priority, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 public: | 186 public: |
| 180 typedef HttpProxySocketParams SocketParams; | 187 typedef HttpProxySocketParams SocketParams; |
| 181 | 188 |
| 182 HttpProxyClientSocketPool( | 189 HttpProxyClientSocketPool( |
| 183 int max_sockets, | 190 int max_sockets, |
| 184 int max_sockets_per_group, | 191 int max_sockets_per_group, |
| 185 ClientSocketPoolHistograms* histograms, | 192 ClientSocketPoolHistograms* histograms, |
| 186 HostResolver* host_resolver, | 193 HostResolver* host_resolver, |
| 187 TransportClientSocketPool* transport_pool, | 194 TransportClientSocketPool* transport_pool, |
| 188 SSLClientSocketPool* ssl_pool, | 195 SSLClientSocketPool* ssl_pool, |
| 196 ProxyDelegate* proxy_delegate, | |
| 189 NetLog* net_log); | 197 NetLog* net_log); |
| 190 | 198 |
| 191 virtual ~HttpProxyClientSocketPool(); | 199 virtual ~HttpProxyClientSocketPool(); |
| 192 | 200 |
| 193 // ClientSocketPool implementation. | 201 // ClientSocketPool implementation. |
| 194 virtual int RequestSocket(const std::string& group_name, | 202 virtual int RequestSocket(const std::string& group_name, |
| 195 const void* connect_params, | 203 const void* connect_params, |
| 196 RequestPriority priority, | 204 RequestPriority priority, |
| 197 ClientSocketHandle* handle, | 205 ClientSocketHandle* handle, |
| 198 const CompletionCallback& callback, | 206 const CompletionCallback& callback, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 | 252 |
| 245 private: | 253 private: |
| 246 typedef ClientSocketPoolBase<HttpProxySocketParams> PoolBase; | 254 typedef ClientSocketPoolBase<HttpProxySocketParams> PoolBase; |
| 247 | 255 |
| 248 class HttpProxyConnectJobFactory : public PoolBase::ConnectJobFactory { | 256 class HttpProxyConnectJobFactory : public PoolBase::ConnectJobFactory { |
| 249 public: | 257 public: |
| 250 HttpProxyConnectJobFactory( | 258 HttpProxyConnectJobFactory( |
| 251 TransportClientSocketPool* transport_pool, | 259 TransportClientSocketPool* transport_pool, |
| 252 SSLClientSocketPool* ssl_pool, | 260 SSLClientSocketPool* ssl_pool, |
| 253 HostResolver* host_resolver, | 261 HostResolver* host_resolver, |
| 262 ProxyDelegate* proxy_delegate, | |
| 254 NetLog* net_log); | 263 NetLog* net_log); |
| 255 | 264 |
| 256 // ClientSocketPoolBase::ConnectJobFactory methods. | 265 // ClientSocketPoolBase::ConnectJobFactory methods. |
| 257 virtual scoped_ptr<ConnectJob> NewConnectJob( | 266 virtual scoped_ptr<ConnectJob> NewConnectJob( |
| 258 const std::string& group_name, | 267 const std::string& group_name, |
| 259 const PoolBase::Request& request, | 268 const PoolBase::Request& request, |
| 260 ConnectJob::Delegate* delegate) const OVERRIDE; | 269 ConnectJob::Delegate* delegate) const OVERRIDE; |
| 261 | 270 |
| 262 virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; | 271 virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; |
| 263 | 272 |
| 264 private: | 273 private: |
| 265 TransportClientSocketPool* const transport_pool_; | 274 TransportClientSocketPool* const transport_pool_; |
| 266 SSLClientSocketPool* const ssl_pool_; | 275 SSLClientSocketPool* const ssl_pool_; |
| 267 HostResolver* const host_resolver_; | 276 HostResolver* const host_resolver_; |
| 277 const ProxyDelegate* proxy_delegate_; | |
| 268 NetLog* net_log_; | 278 NetLog* net_log_; |
| 269 base::TimeDelta timeout_; | 279 base::TimeDelta timeout_; |
| 270 | 280 |
| 271 DISALLOW_COPY_AND_ASSIGN(HttpProxyConnectJobFactory); | 281 DISALLOW_COPY_AND_ASSIGN(HttpProxyConnectJobFactory); |
| 272 }; | 282 }; |
| 273 | 283 |
| 274 TransportClientSocketPool* const transport_pool_; | 284 TransportClientSocketPool* const transport_pool_; |
| 275 SSLClientSocketPool* const ssl_pool_; | 285 SSLClientSocketPool* const ssl_pool_; |
| 276 PoolBase base_; | 286 PoolBase base_; |
| 277 | 287 |
| 278 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocketPool); | 288 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocketPool); |
| 279 }; | 289 }; |
| 280 | 290 |
| 281 } // namespace net | 291 } // namespace net |
| 282 | 292 |
| 283 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_ | 293 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_ |
| OLD | NEW |