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 90 matching lines...) Loading... |
101 // HttpProxyConnectJob optionally establishes a tunnel through the proxy | 101 // HttpProxyConnectJob optionally establishes a tunnel through the proxy |
102 // server after connecting the underlying transport socket. | 102 // server after connecting the underlying transport socket. |
103 class HttpProxyConnectJob : public ConnectJob { | 103 class HttpProxyConnectJob : public ConnectJob { |
104 public: | 104 public: |
105 HttpProxyConnectJob(const std::string& group_name, | 105 HttpProxyConnectJob(const std::string& group_name, |
106 RequestPriority priority, | 106 RequestPriority priority, |
107 const scoped_refptr<HttpProxySocketParams>& params, | 107 const scoped_refptr<HttpProxySocketParams>& params, |
108 const base::TimeDelta& timeout_duration, | 108 const base::TimeDelta& timeout_duration, |
109 TransportClientSocketPool* transport_pool, | 109 TransportClientSocketPool* transport_pool, |
110 SSLClientSocketPool* ssl_pool, | 110 SSLClientSocketPool* ssl_pool, |
111 HostResolver* host_resolver, | |
112 Delegate* delegate, | 111 Delegate* delegate, |
113 NetLog* net_log); | 112 NetLog* net_log); |
114 ~HttpProxyConnectJob() override; | 113 ~HttpProxyConnectJob() override; |
115 | 114 |
116 // ConnectJob methods. | 115 // ConnectJob methods. |
117 LoadState GetLoadState() const override; | 116 LoadState GetLoadState() const override; |
118 | 117 |
119 void GetAdditionalErrorState(ClientSocketHandle* handle) override; | 118 void GetAdditionalErrorState(ClientSocketHandle* handle) override; |
120 | 119 |
121 private: | 120 private: |
(...skipping 35 matching lines...) Loading... |
157 // ERR_IO_PENDING. An OK return from this function or the callback means | 156 // ERR_IO_PENDING. An OK return from this function or the callback means |
158 // that the connection is established; ERR_PROXY_AUTH_REQUESTED means | 157 // that the connection is established; ERR_PROXY_AUTH_REQUESTED means |
159 // that the tunnel needs authentication credentials, the socket will be | 158 // that the tunnel needs authentication credentials, the socket will be |
160 // returned in this case, and must be release back to the pool; or | 159 // returned in this case, and must be release back to the pool; or |
161 // a standard net error code will be returned. | 160 // a standard net error code will be returned. |
162 int ConnectInternal() override; | 161 int ConnectInternal() override; |
163 | 162 |
164 scoped_refptr<HttpProxySocketParams> params_; | 163 scoped_refptr<HttpProxySocketParams> params_; |
165 TransportClientSocketPool* const transport_pool_; | 164 TransportClientSocketPool* const transport_pool_; |
166 SSLClientSocketPool* const ssl_pool_; | 165 SSLClientSocketPool* const ssl_pool_; |
167 HostResolver* const resolver_; | |
168 | 166 |
169 State next_state_; | 167 State next_state_; |
170 CompletionCallback callback_; | 168 CompletionCallback callback_; |
171 scoped_ptr<ClientSocketHandle> transport_socket_handle_; | 169 scoped_ptr<ClientSocketHandle> transport_socket_handle_; |
172 scoped_ptr<ProxyClientSocket> transport_socket_; | 170 scoped_ptr<ProxyClientSocket> transport_socket_; |
173 bool using_spdy_; | 171 bool using_spdy_; |
174 // Protocol negotiated with the server. | 172 // Protocol negotiated with the server. |
175 NextProto protocol_negotiated_; | 173 NextProto protocol_negotiated_; |
176 | 174 |
177 HttpResponseInfo error_response_info_; | 175 HttpResponseInfo error_response_info_; |
(...skipping 11 matching lines...) Loading... |
189 public: | 187 public: |
190 typedef HttpProxySocketParams SocketParams; | 188 typedef HttpProxySocketParams SocketParams; |
191 | 189 |
192 HttpProxyClientSocketPool( | 190 HttpProxyClientSocketPool( |
193 int max_sockets, | 191 int max_sockets, |
194 int max_sockets_per_group, | 192 int max_sockets_per_group, |
195 ClientSocketPoolHistograms* histograms, | 193 ClientSocketPoolHistograms* histograms, |
196 HostResolver* host_resolver, | 194 HostResolver* host_resolver, |
197 TransportClientSocketPool* transport_pool, | 195 TransportClientSocketPool* transport_pool, |
198 SSLClientSocketPool* ssl_pool, | 196 SSLClientSocketPool* ssl_pool, |
199 const ProxyDelegate* proxy_delegate, | |
200 NetLog* net_log); | 197 NetLog* net_log); |
201 | 198 |
202 ~HttpProxyClientSocketPool() override; | 199 ~HttpProxyClientSocketPool() override; |
203 | 200 |
204 // ClientSocketPool implementation. | 201 // ClientSocketPool implementation. |
205 int RequestSocket(const std::string& group_name, | 202 int RequestSocket(const std::string& group_name, |
206 const void* connect_params, | 203 const void* connect_params, |
207 RequestPriority priority, | 204 RequestPriority priority, |
208 ClientSocketHandle* handle, | 205 ClientSocketHandle* handle, |
209 const CompletionCallback& callback, | 206 const CompletionCallback& callback, |
(...skipping 43 matching lines...) Loading... |
253 | 250 |
254 private: | 251 private: |
255 typedef ClientSocketPoolBase<HttpProxySocketParams> PoolBase; | 252 typedef ClientSocketPoolBase<HttpProxySocketParams> PoolBase; |
256 | 253 |
257 class HttpProxyConnectJobFactory : public PoolBase::ConnectJobFactory { | 254 class HttpProxyConnectJobFactory : public PoolBase::ConnectJobFactory { |
258 public: | 255 public: |
259 HttpProxyConnectJobFactory( | 256 HttpProxyConnectJobFactory( |
260 TransportClientSocketPool* transport_pool, | 257 TransportClientSocketPool* transport_pool, |
261 SSLClientSocketPool* ssl_pool, | 258 SSLClientSocketPool* ssl_pool, |
262 HostResolver* host_resolver, | 259 HostResolver* host_resolver, |
263 const ProxyDelegate* proxy_delegate, | |
264 NetLog* net_log); | 260 NetLog* net_log); |
265 | 261 |
266 // ClientSocketPoolBase::ConnectJobFactory methods. | 262 // ClientSocketPoolBase::ConnectJobFactory methods. |
267 scoped_ptr<ConnectJob> NewConnectJob( | 263 scoped_ptr<ConnectJob> NewConnectJob( |
268 const std::string& group_name, | 264 const std::string& group_name, |
269 const PoolBase::Request& request, | 265 const PoolBase::Request& request, |
270 ConnectJob::Delegate* delegate) const override; | 266 ConnectJob::Delegate* delegate) const override; |
271 | 267 |
272 base::TimeDelta ConnectionTimeout() const override; | 268 base::TimeDelta ConnectionTimeout() const override; |
273 | 269 |
274 private: | 270 private: |
275 TransportClientSocketPool* const transport_pool_; | 271 TransportClientSocketPool* const transport_pool_; |
276 SSLClientSocketPool* const ssl_pool_; | 272 SSLClientSocketPool* const ssl_pool_; |
277 HostResolver* const host_resolver_; | 273 HostResolver* const host_resolver_; |
278 const ProxyDelegate* proxy_delegate_; | |
279 NetLog* net_log_; | 274 NetLog* net_log_; |
280 base::TimeDelta timeout_; | 275 base::TimeDelta timeout_; |
281 | 276 |
282 DISALLOW_COPY_AND_ASSIGN(HttpProxyConnectJobFactory); | 277 DISALLOW_COPY_AND_ASSIGN(HttpProxyConnectJobFactory); |
283 }; | 278 }; |
284 | 279 |
285 TransportClientSocketPool* const transport_pool_; | 280 TransportClientSocketPool* const transport_pool_; |
286 SSLClientSocketPool* const ssl_pool_; | 281 SSLClientSocketPool* const ssl_pool_; |
287 PoolBase base_; | 282 PoolBase base_; |
288 | 283 |
289 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocketPool); | 284 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocketPool); |
290 }; | 285 }; |
291 | 286 |
292 } // namespace net | 287 } // namespace net |
293 | 288 |
294 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_ | 289 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_ |
OLD | NEW |