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 #include "jingle/notifier/base/proxy_resolving_client_socket.h" | 5 #include "jingle/notifier/base/proxy_resolving_client_socket.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
11 #include "net/base/io_buffer.h" | 11 #include "net/base/io_buffer.h" |
12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
13 #include "net/http/http_network_session.h" | 13 #include "net/http/http_network_session.h" |
14 #include "net/socket/client_socket_handle.h" | 14 #include "net/socket/client_socket_handle.h" |
15 #include "net/socket/client_socket_pool_manager.h" | 15 #include "net/socket/client_socket_pool_manager.h" |
16 #include "net/url_request/url_request_context.h" | 16 #include "net/url_request/url_request_context.h" |
17 #include "net/url_request/url_request_context_getter.h" | 17 #include "net/url_request/url_request_context_getter.h" |
18 | 18 |
19 namespace notifier { | 19 namespace notifier { |
20 | 20 |
21 ProxyResolvingClientSocket::ProxyResolvingClientSocket( | 21 ProxyResolvingClientSocket::ProxyResolvingClientSocket( |
22 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, | 22 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, |
23 const net::SSLConfig& ssl_config, | 23 const net::SSLConfig& ssl_config, |
24 const net::HostPortPair& dest_host_port_pair, | 24 const net::HostPortPair& dest_host_port_pair) |
25 net::NetLog* net_log) | |
26 : proxy_resolve_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this), | 25 : proxy_resolve_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this), |
27 &ProxyResolvingClientSocket::ProcessProxyResolveDone), | 26 &ProxyResolvingClientSocket::ProcessProxyResolveDone), |
28 connect_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this), | 27 connect_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this), |
29 &ProxyResolvingClientSocket::ProcessConnectDone), | 28 &ProxyResolvingClientSocket::ProcessConnectDone), |
30 ssl_config_(ssl_config), | 29 ssl_config_(ssl_config), |
31 pac_request_(NULL), | 30 pac_request_(NULL), |
32 dest_host_port_pair_(dest_host_port_pair), | 31 dest_host_port_pair_(dest_host_port_pair), |
33 tried_direct_connect_fallback_(false), | 32 tried_direct_connect_fallback_(false), |
34 bound_net_log_( | 33 bound_net_log_( |
35 net::BoundNetLog::Make(net_log, net::NetLog::SOURCE_SOCKET)), | 34 net::BoundNetLog::Make( |
35 request_context_getter->GetURLRequestContext()->net_log(), | |
sanjeevr
2011/05/12 18:26:08
I am presuming that passing NULL to BoundNetLog::M
akalin
2011/05/12 18:45:42
Yes, it's fine.
| |
36 net::NetLog::SOURCE_SOCKET)), | |
36 scoped_runnable_method_factory_( | 37 scoped_runnable_method_factory_( |
37 ALLOW_THIS_IN_INITIALIZER_LIST(this)), | 38 ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
38 user_connect_callback_(NULL) { | 39 user_connect_callback_(NULL) { |
39 DCHECK(request_context_getter); | 40 DCHECK(request_context_getter); |
40 net::URLRequestContext* request_context = | 41 net::URLRequestContext* request_context = |
41 request_context_getter->GetURLRequestContext(); | 42 request_context_getter->GetURLRequestContext(); |
42 DCHECK(request_context); | 43 DCHECK(request_context); |
43 net::HttpNetworkSession::Params session_params; | 44 net::HttpNetworkSession::Params session_params; |
45 session_params.client_socket_factory = NULL; | |
sanjeevr
2011/05/12 18:26:08
Can you get willchan to review the session_params
akalin
2011/05/12 18:45:42
Okay.
| |
44 session_params.host_resolver = request_context->host_resolver(); | 46 session_params.host_resolver = request_context->host_resolver(); |
45 session_params.cert_verifier = request_context->cert_verifier(); | 47 session_params.cert_verifier = request_context->cert_verifier(); |
46 session_params.dnsrr_resolver = request_context->dnsrr_resolver(); | 48 session_params.dnsrr_resolver = request_context->dnsrr_resolver(); |
49 session_params.dns_cert_checker = request_context->dns_cert_checker(); | |
47 session_params.proxy_service = request_context->proxy_service(); | 50 session_params.proxy_service = request_context->proxy_service(); |
51 session_params.ssl_host_info_factory = NULL; | |
48 session_params.ssl_config_service = request_context->ssl_config_service(); | 52 session_params.ssl_config_service = request_context->ssl_config_service(); |
49 session_params.http_auth_handler_factory = | 53 session_params.http_auth_handler_factory = |
50 request_context->http_auth_handler_factory(); | 54 request_context->http_auth_handler_factory(); |
55 session_params.network_delegate = request_context->network_delegate(); | |
56 session_params.net_log = request_context->net_log(); | |
51 network_session_ = new net::HttpNetworkSession(session_params); | 57 network_session_ = new net::HttpNetworkSession(session_params); |
52 } | 58 } |
53 | 59 |
54 ProxyResolvingClientSocket::~ProxyResolvingClientSocket() { | 60 ProxyResolvingClientSocket::~ProxyResolvingClientSocket() { |
55 Disconnect(); | 61 Disconnect(); |
56 } | 62 } |
57 | 63 |
58 int ProxyResolvingClientSocket::Read(net::IOBuffer* buf, int buf_len, | 64 int ProxyResolvingClientSocket::Read(net::IOBuffer* buf, int buf_len, |
59 net::CompletionCallback* callback) { | 65 net::CompletionCallback* callback) { |
60 if (transport_.get() && transport_->socket()) | 66 if (transport_.get() && transport_->socket()) |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
336 return false; | 342 return false; |
337 } | 343 } |
338 | 344 |
339 void ProxyResolvingClientSocket::CloseTransportSocket() { | 345 void ProxyResolvingClientSocket::CloseTransportSocket() { |
340 if (transport_.get() && transport_->socket()) | 346 if (transport_.get() && transport_->socket()) |
341 transport_->socket()->Disconnect(); | 347 transport_->socket()->Disconnect(); |
342 transport_.reset(); | 348 transport_.reset(); |
343 } | 349 } |
344 | 350 |
345 } // namespace notifier | 351 } // namespace notifier |
OLD | NEW |