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 #include "jingle/glue/proxy_resolving_client_socket.h" | 5 #include "jingle/glue/proxy_resolving_client_socket.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
13 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
15 #include "net/http/http_network_session.h" | 15 #include "net/http/http_network_session.h" |
16 #include "net/http/http_transaction_factory.h" | |
16 #include "net/socket/client_socket_handle.h" | 17 #include "net/socket/client_socket_handle.h" |
17 #include "net/socket/client_socket_pool_manager.h" | 18 #include "net/socket/client_socket_pool_manager.h" |
18 #include "net/url_request/url_request_context.h" | 19 #include "net/url_request/url_request_context.h" |
19 #include "net/url_request/url_request_context_getter.h" | 20 #include "net/url_request/url_request_context_getter.h" |
20 | 21 |
21 namespace jingle_glue { | 22 namespace jingle_glue { |
22 | 23 |
23 ProxyResolvingClientSocket::ProxyResolvingClientSocket( | 24 ProxyResolvingClientSocket::ProxyResolvingClientSocket( |
24 net::ClientSocketFactory* socket_factory, | 25 net::ClientSocketFactory* socket_factory, |
25 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, | 26 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, |
(...skipping 29 matching lines...) Expand all Loading... | |
55 // transport_security_state is NULL because it's not thread safe. | 56 // transport_security_state is NULL because it's not thread safe. |
56 session_params.transport_security_state = NULL; | 57 session_params.transport_security_state = NULL; |
57 session_params.proxy_service = request_context->proxy_service(); | 58 session_params.proxy_service = request_context->proxy_service(); |
58 session_params.ssl_config_service = request_context->ssl_config_service(); | 59 session_params.ssl_config_service = request_context->ssl_config_service(); |
59 session_params.http_auth_handler_factory = | 60 session_params.http_auth_handler_factory = |
60 request_context->http_auth_handler_factory(); | 61 request_context->http_auth_handler_factory(); |
61 session_params.network_delegate = request_context->network_delegate(); | 62 session_params.network_delegate = request_context->network_delegate(); |
62 session_params.http_server_properties = | 63 session_params.http_server_properties = |
63 request_context->http_server_properties(); | 64 request_context->http_server_properties(); |
64 session_params.net_log = request_context->net_log(); | 65 session_params.net_log = request_context->net_log(); |
66 | |
67 net::HttpTransactionFactory* transaction_factory = | |
akalin
2012/08/31 19:44:48
This seems to violate the principle of least knowl
szager1
2012/08/31 19:59:16
That's kind of at odds with comment #15. Maybe so
| |
68 request_context->http_transaction_factory(); | |
69 if (transaction_factory) { | |
70 net::HttpNetworkSession* network_session = | |
71 transaction_factory->GetSession(); | |
72 if (network_session) { | |
73 const net::HttpNetworkSession::Params& reference_params = | |
74 network_session->params(); | |
75 session_params.host_mapping_rules = reference_params.host_mapping_rules; | |
76 session_params.ignore_certificate_errors = | |
77 reference_params.ignore_certificate_errors; | |
78 session_params.http_pipelining_enabled = | |
79 reference_params.http_pipelining_enabled; | |
80 session_params.testing_fixed_http_port = | |
81 reference_params.testing_fixed_http_port; | |
82 session_params.testing_fixed_https_port = | |
83 reference_params.testing_fixed_https_port; | |
84 session_params.trusted_spdy_proxy = | |
85 reference_params.trusted_spdy_proxy; | |
86 } | |
87 } | |
88 | |
65 network_session_ = new net::HttpNetworkSession(session_params); | 89 network_session_ = new net::HttpNetworkSession(session_params); |
66 } | 90 } |
67 | 91 |
68 ProxyResolvingClientSocket::~ProxyResolvingClientSocket() { | 92 ProxyResolvingClientSocket::~ProxyResolvingClientSocket() { |
69 Disconnect(); | 93 Disconnect(); |
70 } | 94 } |
71 | 95 |
72 int ProxyResolvingClientSocket::Read(net::IOBuffer* buf, int buf_len, | 96 int ProxyResolvingClientSocket::Read(net::IOBuffer* buf, int buf_len, |
73 const net::CompletionCallback& callback) { | 97 const net::CompletionCallback& callback) { |
74 if (transport_.get() && transport_->socket()) | 98 if (transport_.get() && transport_->socket()) |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
385 return false; | 409 return false; |
386 } | 410 } |
387 | 411 |
388 void ProxyResolvingClientSocket::CloseTransportSocket() { | 412 void ProxyResolvingClientSocket::CloseTransportSocket() { |
389 if (transport_.get() && transport_->socket()) | 413 if (transport_.get() && transport_->socket()) |
390 transport_->socket()->Disconnect(); | 414 transport_->socket()->Disconnect(); |
391 transport_.reset(); | 415 transport_.reset(); |
392 } | 416 } |
393 | 417 |
394 } // namespace jingle_glue | 418 } // namespace jingle_glue |
OLD | NEW |