| 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 net::ClientSocketFactory* socket_factory, |
| 22 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, | 23 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, |
| 23 const net::SSLConfig& ssl_config, | 24 const net::SSLConfig& ssl_config, |
| 24 const net::HostPortPair& dest_host_port_pair) | 25 const net::HostPortPair& dest_host_port_pair) |
| 25 : proxy_resolve_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this), | 26 : proxy_resolve_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this), |
| 26 &ProxyResolvingClientSocket::ProcessProxyResolveDone), | 27 &ProxyResolvingClientSocket::ProcessProxyResolveDone), |
| 27 connect_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this), | 28 connect_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this), |
| 28 &ProxyResolvingClientSocket::ProcessConnectDone), | 29 &ProxyResolvingClientSocket::ProcessConnectDone), |
| 29 ssl_config_(ssl_config), | 30 ssl_config_(ssl_config), |
| 30 pac_request_(NULL), | 31 pac_request_(NULL), |
| 31 dest_host_port_pair_(dest_host_port_pair), | 32 dest_host_port_pair_(dest_host_port_pair), |
| 32 tried_direct_connect_fallback_(false), | 33 tried_direct_connect_fallback_(false), |
| 33 bound_net_log_( | 34 bound_net_log_( |
| 34 net::BoundNetLog::Make( | 35 net::BoundNetLog::Make( |
| 35 request_context_getter->GetURLRequestContext()->net_log(), | 36 request_context_getter->GetURLRequestContext()->net_log(), |
| 36 net::NetLog::SOURCE_SOCKET)), | 37 net::NetLog::SOURCE_SOCKET)), |
| 37 scoped_runnable_method_factory_( | 38 scoped_runnable_method_factory_( |
| 38 ALLOW_THIS_IN_INITIALIZER_LIST(this)), | 39 ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
| 39 user_connect_callback_(NULL) { | 40 user_connect_callback_(NULL) { |
| 40 DCHECK(request_context_getter); | 41 DCHECK(request_context_getter); |
| 41 net::URLRequestContext* request_context = | 42 net::URLRequestContext* request_context = |
| 42 request_context_getter->GetURLRequestContext(); | 43 request_context_getter->GetURLRequestContext(); |
| 43 DCHECK(request_context); | 44 DCHECK(request_context); |
| 44 net::HttpNetworkSession::Params session_params; | 45 net::HttpNetworkSession::Params session_params; |
| 45 session_params.client_socket_factory = NULL; | 46 session_params.client_socket_factory = socket_factory; |
| 46 session_params.host_resolver = request_context->host_resolver(); | 47 session_params.host_resolver = request_context->host_resolver(); |
| 47 session_params.cert_verifier = request_context->cert_verifier(); | 48 session_params.cert_verifier = request_context->cert_verifier(); |
| 48 // TODO(rkn): This is NULL because OriginBoundCertService is not thread safe. | 49 // TODO(rkn): This is NULL because OriginBoundCertService is not thread safe. |
| 49 session_params.origin_bound_cert_service = NULL; | 50 session_params.origin_bound_cert_service = NULL; |
| 50 session_params.dnsrr_resolver = request_context->dnsrr_resolver(); | 51 session_params.dnsrr_resolver = request_context->dnsrr_resolver(); |
| 51 session_params.dns_cert_checker = request_context->dns_cert_checker(); | 52 session_params.dns_cert_checker = request_context->dns_cert_checker(); |
| 52 session_params.proxy_service = request_context->proxy_service(); | 53 session_params.proxy_service = request_context->proxy_service(); |
| 53 session_params.ssl_host_info_factory = NULL; | 54 session_params.ssl_host_info_factory = NULL; |
| 54 session_params.ssl_config_service = request_context->ssl_config_service(); | 55 session_params.ssl_config_service = request_context->ssl_config_service(); |
| 55 session_params.http_auth_handler_factory = | 56 session_params.http_auth_handler_factory = |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 return base::TimeDelta::FromMicroseconds(-1); | 365 return base::TimeDelta::FromMicroseconds(-1); |
| 365 } | 366 } |
| 366 | 367 |
| 367 void ProxyResolvingClientSocket::CloseTransportSocket() { | 368 void ProxyResolvingClientSocket::CloseTransportSocket() { |
| 368 if (transport_.get() && transport_->socket()) | 369 if (transport_.get() && transport_->socket()) |
| 369 transport_->socket()->Disconnect(); | 370 transport_->socket()->Disconnect(); |
| 370 transport_.reset(); | 371 transport_.reset(); |
| 371 } | 372 } |
| 372 | 373 |
| 373 } // namespace notifier | 374 } // namespace notifier |
| OLD | NEW |