OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "net/http/http_proxy_client_socket_wrapper.h" | 5 #include "net/http/http_proxy_client_socket_wrapper.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/profiler/scoped_tracker.h" | 13 #include "base/profiler/scoped_tracker.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "net/base/proxy_delegate.h" | 15 #include "net/base/proxy_delegate.h" |
16 #include "net/http/http_proxy_client_socket.h" | 16 #include "net/http/http_proxy_client_socket.h" |
17 #include "net/http/http_response_info.h" | 17 #include "net/http/http_response_info.h" |
| 18 #include "net/log/net_log_event_type.h" |
| 19 #include "net/log/net_log_source_type.h" |
18 #include "net/socket/client_socket_handle.h" | 20 #include "net/socket/client_socket_handle.h" |
19 #include "net/spdy/spdy_proxy_client_socket.h" | 21 #include "net/spdy/spdy_proxy_client_socket.h" |
20 #include "net/spdy/spdy_session.h" | 22 #include "net/spdy/spdy_session.h" |
21 #include "net/spdy/spdy_session_pool.h" | 23 #include "net/spdy/spdy_session_pool.h" |
22 #include "net/spdy/spdy_stream.h" | 24 #include "net/spdy/spdy_stream.h" |
23 #include "net/ssl/ssl_cert_request_info.h" | 25 #include "net/ssl/ssl_cert_request_info.h" |
24 #include "url/gurl.h" | 26 #include "url/gurl.h" |
25 | 27 |
26 namespace net { | 28 namespace net { |
27 | 29 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 proxy_delegate_(proxy_delegate), | 62 proxy_delegate_(proxy_delegate), |
61 using_spdy_(false), | 63 using_spdy_(false), |
62 http_auth_controller_( | 64 http_auth_controller_( |
63 tunnel ? new HttpAuthController( | 65 tunnel ? new HttpAuthController( |
64 HttpAuth::AUTH_PROXY, | 66 HttpAuth::AUTH_PROXY, |
65 GURL((ssl_params_.get() ? "https://" : "http://") + | 67 GURL((ssl_params_.get() ? "https://" : "http://") + |
66 GetDestination().host_port_pair().ToString()), | 68 GetDestination().host_port_pair().ToString()), |
67 http_auth_cache, | 69 http_auth_cache, |
68 http_auth_handler_factory) | 70 http_auth_handler_factory) |
69 : nullptr), | 71 : nullptr), |
70 net_log_(BoundNetLog::Make(net_log.net_log(), | 72 net_log_( |
71 NetLog::SOURCE_PROXY_CLIENT_SOCKET_WRAPPER)) { | 73 BoundNetLog::Make(net_log.net_log(), |
72 net_log_.BeginEvent(NetLog::TYPE_SOCKET_ALIVE, | 74 NetLogSourceType::PROXY_CLIENT_SOCKET_WRAPPER)) { |
| 75 net_log_.BeginEvent(NetLogEventType::SOCKET_ALIVE, |
73 net_log.source().ToEventParametersCallback()); | 76 net_log.source().ToEventParametersCallback()); |
74 DCHECK(transport_params || ssl_params); | 77 DCHECK(transport_params || ssl_params); |
75 DCHECK(!transport_params || !ssl_params); | 78 DCHECK(!transport_params || !ssl_params); |
76 } | 79 } |
77 | 80 |
78 HttpProxyClientSocketWrapper::~HttpProxyClientSocketWrapper() { | 81 HttpProxyClientSocketWrapper::~HttpProxyClientSocketWrapper() { |
79 // Make sure no sockets are returned to the lower level socket pools. | 82 // Make sure no sockets are returned to the lower level socket pools. |
80 Disconnect(); | 83 Disconnect(); |
81 | 84 |
82 net_log_.EndEvent(NetLog::TYPE_SOCKET_ALIVE); | 85 net_log_.EndEvent(NetLogEventType::SOCKET_ALIVE); |
83 } | 86 } |
84 | 87 |
85 LoadState HttpProxyClientSocketWrapper::GetConnectLoadState() const { | 88 LoadState HttpProxyClientSocketWrapper::GetConnectLoadState() const { |
86 switch (next_state_) { | 89 switch (next_state_) { |
87 case STATE_BEGIN_CONNECT: | 90 case STATE_BEGIN_CONNECT: |
88 case STATE_TCP_CONNECT: | 91 case STATE_TCP_CONNECT: |
89 case STATE_TCP_CONNECT_COMPLETE: | 92 case STATE_TCP_CONNECT_COMPLETE: |
90 case STATE_SSL_CONNECT: | 93 case STATE_SSL_CONNECT: |
91 case STATE_SSL_CONNECT_COMPLETE: | 94 case STATE_SSL_CONNECT_COMPLETE: |
92 return transport_socket_handle_->GetLoadState(); | 95 return transport_socket_handle_->GetLoadState(); |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 const HostResolver::RequestInfo& | 623 const HostResolver::RequestInfo& |
621 HttpProxyClientSocketWrapper::GetDestination() { | 624 HttpProxyClientSocketWrapper::GetDestination() { |
622 if (transport_params_) { | 625 if (transport_params_) { |
623 return transport_params_->destination(); | 626 return transport_params_->destination(); |
624 } else { | 627 } else { |
625 return ssl_params_->GetDirectConnectionParams()->destination(); | 628 return ssl_params_->GetDirectConnectionParams()->destination(); |
626 } | 629 } |
627 } | 630 } |
628 | 631 |
629 } // namespace net | 632 } // namespace net |
OLD | NEW |