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 "android_webview/browser/net/aw_url_request_context_getter.h" | 5 #include "android_webview/browser/net/aw_url_request_context_getter.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "android_webview/browser/aw_browser_context.h" | 9 #include "android_webview/browser/aw_browser_context.h" |
10 #include "android_webview/browser/aw_content_browser_client.h" | 10 #include "android_webview/browser/aw_content_browser_client.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "content/public/browser/cookie_store_factory.h" | 24 #include "content/public/browser/cookie_store_factory.h" |
25 #include "content/public/common/content_client.h" | 25 #include "content/public/common/content_client.h" |
26 #include "content/public/common/content_switches.h" | 26 #include "content/public/common/content_switches.h" |
27 #include "content/public/common/url_constants.h" | 27 #include "content/public/common/url_constants.h" |
28 #include "net/base/cache_type.h" | 28 #include "net/base/cache_type.h" |
29 #include "net/cookies/cookie_store.h" | 29 #include "net/cookies/cookie_store.h" |
30 #include "net/dns/mapped_host_resolver.h" | 30 #include "net/dns/mapped_host_resolver.h" |
31 #include "net/http/http_cache.h" | 31 #include "net/http/http_cache.h" |
32 #include "net/http/http_stream_factory.h" | 32 #include "net/http/http_stream_factory.h" |
33 #include "net/proxy/proxy_service.h" | 33 #include "net/proxy/proxy_service.h" |
| 34 #include "net/socket/next_proto.h" |
34 #include "net/url_request/data_protocol_handler.h" | 35 #include "net/url_request/data_protocol_handler.h" |
35 #include "net/url_request/file_protocol_handler.h" | 36 #include "net/url_request/file_protocol_handler.h" |
36 #include "net/url_request/protocol_intercept_job_factory.h" | 37 #include "net/url_request/protocol_intercept_job_factory.h" |
37 #include "net/url_request/url_request_context_builder.h" | 38 #include "net/url_request/url_request_context_builder.h" |
38 #include "net/url_request/url_request_context.h" | 39 #include "net/url_request/url_request_context.h" |
39 | 40 |
40 using content::BrowserThread; | 41 using content::BrowserThread; |
41 using data_reduction_proxy::DataReductionProxySettings; | 42 using data_reduction_proxy::DataReductionProxySettings; |
42 | 43 |
43 namespace android_webview { | 44 namespace android_webview { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 params->host_resolver = context->host_resolver(); | 84 params->host_resolver = context->host_resolver(); |
84 params->cert_verifier = context->cert_verifier(); | 85 params->cert_verifier = context->cert_verifier(); |
85 params->server_bound_cert_service = context->server_bound_cert_service(); | 86 params->server_bound_cert_service = context->server_bound_cert_service(); |
86 params->transport_security_state = context->transport_security_state(); | 87 params->transport_security_state = context->transport_security_state(); |
87 params->proxy_service = context->proxy_service(); | 88 params->proxy_service = context->proxy_service(); |
88 params->ssl_config_service = context->ssl_config_service(); | 89 params->ssl_config_service = context->ssl_config_service(); |
89 params->http_auth_handler_factory = context->http_auth_handler_factory(); | 90 params->http_auth_handler_factory = context->http_auth_handler_factory(); |
90 params->network_delegate = context->network_delegate(); | 91 params->network_delegate = context->network_delegate(); |
91 params->http_server_properties = context->http_server_properties(); | 92 params->http_server_properties = context->http_server_properties(); |
92 params->net_log = context->net_log(); | 93 params->net_log = context->net_log(); |
| 94 |
| 95 // TODO(sgurun) remove once crbug.com/329681 is fixed. |
| 96 params->next_protos = net::NextProtosSpdy31(); |
| 97 params->use_alternate_protocols = true; |
| 98 |
93 ApplyCmdlineOverridesToNetworkSessionParams(params); | 99 ApplyCmdlineOverridesToNetworkSessionParams(params); |
94 } | 100 } |
95 | 101 |
96 scoped_ptr<net::URLRequestJobFactory> CreateJobFactory( | 102 scoped_ptr<net::URLRequestJobFactory> CreateJobFactory( |
97 content::ProtocolHandlerMap* protocol_handlers) { | 103 content::ProtocolHandlerMap* protocol_handlers) { |
98 scoped_ptr<AwURLRequestJobFactory> aw_job_factory(new AwURLRequestJobFactory); | 104 scoped_ptr<AwURLRequestJobFactory> aw_job_factory(new AwURLRequestJobFactory); |
99 bool set_protocol = aw_job_factory->SetProtocolHandler( | 105 bool set_protocol = aw_job_factory->SetProtocolHandler( |
100 content::kFileScheme, | 106 content::kFileScheme, |
101 new net::FileProtocolHandler( | 107 new net::FileProtocolHandler( |
102 content::BrowserThread::GetBlockingPool()-> | 108 content::BrowserThread::GetBlockingPool()-> |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 DataReductionProxySettings::InitDataReductionProxySession( | 234 DataReductionProxySettings::InitDataReductionProxySession( |
229 main_cache->GetSession(), drp_settings->key()); | 235 main_cache->GetSession(), drp_settings->key()); |
230 } | 236 } |
231 | 237 |
232 main_http_factory_.reset(main_cache); | 238 main_http_factory_.reset(main_cache); |
233 url_request_context_->set_http_transaction_factory(main_cache); | 239 url_request_context_->set_http_transaction_factory(main_cache); |
234 url_request_context_->set_cookie_store(cookie_store_); | 240 url_request_context_->set_cookie_store(cookie_store_); |
235 | 241 |
236 job_factory_ = CreateJobFactory(&protocol_handlers_); | 242 job_factory_ = CreateJobFactory(&protocol_handlers_); |
237 url_request_context_->set_job_factory(job_factory_.get()); | 243 url_request_context_->set_job_factory(job_factory_.get()); |
238 | |
239 // TODO(sgurun) remove once crbug.com/329681 is fixed. Should be | |
240 // called only once. | |
241 net::HttpStreamFactory::EnableNpnSpdy31(); | |
242 } | 244 } |
243 | 245 |
244 net::URLRequestContext* AwURLRequestContextGetter::GetURLRequestContext() { | 246 net::URLRequestContext* AwURLRequestContextGetter::GetURLRequestContext() { |
245 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 247 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
246 if (!url_request_context_) | 248 if (!url_request_context_) |
247 InitializeURLRequestContext(); | 249 InitializeURLRequestContext(); |
248 | 250 |
249 return url_request_context_.get(); | 251 return url_request_context_.get(); |
250 } | 252 } |
251 | 253 |
252 scoped_refptr<base::SingleThreadTaskRunner> | 254 scoped_refptr<base::SingleThreadTaskRunner> |
253 AwURLRequestContextGetter::GetNetworkTaskRunner() const { | 255 AwURLRequestContextGetter::GetNetworkTaskRunner() const { |
254 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 256 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
255 } | 257 } |
256 | 258 |
257 void AwURLRequestContextGetter::SetProtocolHandlers( | 259 void AwURLRequestContextGetter::SetProtocolHandlers( |
258 content::ProtocolHandlerMap* protocol_handlers) { | 260 content::ProtocolHandlerMap* protocol_handlers) { |
259 std::swap(protocol_handlers_, *protocol_handlers); | 261 std::swap(protocol_handlers_, *protocol_handlers); |
260 } | 262 } |
261 | 263 |
262 DataReductionProxyConfigService* | 264 DataReductionProxyConfigService* |
263 AwURLRequestContextGetter::proxy_config_service() { | 265 AwURLRequestContextGetter::proxy_config_service() { |
264 // TODO(bengr): return system config if data reduction proxy is disabled. | 266 // TODO(bengr): return system config if data reduction proxy is disabled. |
265 return proxy_config_service_.get(); | 267 return proxy_config_service_.get(); |
266 } | 268 } |
267 | 269 |
268 } // namespace android_webview | 270 } // namespace android_webview |
OLD | NEW |