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_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/tcp_client_socket_pool.h" | 21 #include "net/socket/tcp_client_socket_pool.h" |
22 | 22 |
23 namespace net { | 23 namespace net { |
24 | 24 |
25 class ClientSocketFactory; | 25 class ClientSocketFactory; |
26 class ConnectJobFactory; | 26 class ConnectJobFactory; |
27 class HttpAuthController; | 27 class HttpAuthController; |
28 | 28 |
29 class HttpProxySocketParams : public base::RefCounted<HttpProxySocketParams> { | 29 class HttpProxySocketParams : public base::RefCounted<HttpProxySocketParams> { |
30 public: | 30 public: |
| 31 // Takes ownership of |auth_controller|. |
31 HttpProxySocketParams(const scoped_refptr<TCPSocketParams>& proxy_server, | 32 HttpProxySocketParams(const scoped_refptr<TCPSocketParams>& proxy_server, |
32 const GURL& request_url, HostPortPair endpoint, | 33 const GURL& request_url, HostPortPair endpoint, |
33 scoped_refptr<HttpAuthController> auth_controller, | 34 HttpAuthController* auth_controller, bool tunnel); |
34 bool tunnel); | |
35 | 35 |
36 const scoped_refptr<TCPSocketParams>& tcp_params() const { | 36 const scoped_refptr<TCPSocketParams>& tcp_params() const { |
37 return tcp_params_; | 37 return tcp_params_; |
38 } | 38 } |
39 const GURL& request_url() const { return request_url_; } | 39 const GURL& request_url() const { return request_url_; } |
40 const HostPortPair& endpoint() const { return endpoint_; } | 40 const HostPortPair& endpoint() const { return endpoint_; } |
41 const scoped_refptr<HttpAuthController>& auth_controller() { | 41 HttpAuthController* ReleaseAuthController() { |
42 return auth_controller_; | 42 return auth_controller_.release(); |
43 } | 43 } |
44 bool tunnel() const { return tunnel_; } | 44 bool tunnel() const { return tunnel_; } |
45 | 45 |
| 46 // Takes ownership of |auth_controller|. |
| 47 void set_auth_controller(HttpAuthController* auth_controller) { |
| 48 auth_controller_.reset(auth_controller); |
| 49 } |
| 50 |
46 private: | 51 private: |
47 friend class base::RefCounted<HttpProxySocketParams>; | 52 friend class base::RefCounted<HttpProxySocketParams>; |
48 ~HttpProxySocketParams(); | 53 ~HttpProxySocketParams(); |
49 | 54 |
50 const scoped_refptr<TCPSocketParams> tcp_params_; | 55 const scoped_refptr<TCPSocketParams> tcp_params_; |
51 const GURL request_url_; | 56 const GURL request_url_; |
52 const HostPortPair endpoint_; | 57 const HostPortPair endpoint_; |
53 const scoped_refptr<HttpAuthController> auth_controller_; | 58 scoped_ptr<HttpAuthController> auth_controller_; |
54 const bool tunnel_; | 59 const bool tunnel_; |
55 | 60 |
56 DISALLOW_COPY_AND_ASSIGN(HttpProxySocketParams); | 61 DISALLOW_COPY_AND_ASSIGN(HttpProxySocketParams); |
57 }; | 62 }; |
58 | 63 |
59 // HttpProxyConnectJob optionally establishes a tunnel through the proxy | 64 // HttpProxyConnectJob optionally establishes a tunnel through the proxy |
60 // server after connecting the underlying transport socket. | 65 // server after connecting the underlying transport socket. |
61 class HttpProxyConnectJob : public ConnectJob { | 66 class HttpProxyConnectJob : public ConnectJob { |
62 public: | 67 public: |
63 HttpProxyConnectJob(const std::string& group_name, | 68 HttpProxyConnectJob(const std::string& group_name, |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 200 |
196 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocketPool); | 201 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocketPool); |
197 }; | 202 }; |
198 | 203 |
199 REGISTER_SOCKET_PARAMS_FOR_POOL(HttpProxyClientSocketPool, | 204 REGISTER_SOCKET_PARAMS_FOR_POOL(HttpProxyClientSocketPool, |
200 HttpProxySocketParams); | 205 HttpProxySocketParams); |
201 | 206 |
202 } // namespace net | 207 } // namespace net |
203 | 208 |
204 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_ | 209 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_ |
OLD | NEW |