| 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 14 matching lines...) Expand all Loading... |
| 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/socket/next_proto.h" |
| 35 #include "net/ssl/default_server_bound_cert_store.h" | 35 #include "net/ssl/default_channel_id_store.h" |
| 36 #include "net/url_request/data_protocol_handler.h" | 36 #include "net/url_request/data_protocol_handler.h" |
| 37 #include "net/url_request/file_protocol_handler.h" | 37 #include "net/url_request/file_protocol_handler.h" |
| 38 #include "net/url_request/url_request_context_builder.h" | 38 #include "net/url_request/url_request_context_builder.h" |
| 39 #include "net/url_request/url_request_context.h" | 39 #include "net/url_request/url_request_context.h" |
| 40 #include "net/url_request/url_request_intercepting_job_factory.h" | 40 #include "net/url_request/url_request_intercepting_job_factory.h" |
| 41 #include "net/url_request/url_request_interceptor.h" | 41 #include "net/url_request/url_request_interceptor.h" |
| 42 | 42 |
| 43 using content::BrowserThread; | 43 using content::BrowserThread; |
| 44 using data_reduction_proxy::DataReductionProxySettings; | 44 using data_reduction_proxy::DataReductionProxySettings; |
| 45 | 45 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 switches::kTestingFixedHttpsPort), &value); | 78 switches::kTestingFixedHttpsPort), &value); |
| 79 params->testing_fixed_https_port = value; | 79 params->testing_fixed_https_port = value; |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 void PopulateNetworkSessionParams( | 83 void PopulateNetworkSessionParams( |
| 84 net::URLRequestContext* context, | 84 net::URLRequestContext* context, |
| 85 net::HttpNetworkSession::Params* params) { | 85 net::HttpNetworkSession::Params* params) { |
| 86 params->host_resolver = context->host_resolver(); | 86 params->host_resolver = context->host_resolver(); |
| 87 params->cert_verifier = context->cert_verifier(); | 87 params->cert_verifier = context->cert_verifier(); |
| 88 params->server_bound_cert_service = context->server_bound_cert_service(); | 88 params->channel_id_service = context->channel_id_service(); |
| 89 params->transport_security_state = context->transport_security_state(); | 89 params->transport_security_state = context->transport_security_state(); |
| 90 params->proxy_service = context->proxy_service(); | 90 params->proxy_service = context->proxy_service(); |
| 91 params->ssl_config_service = context->ssl_config_service(); | 91 params->ssl_config_service = context->ssl_config_service(); |
| 92 params->http_auth_handler_factory = context->http_auth_handler_factory(); | 92 params->http_auth_handler_factory = context->http_auth_handler_factory(); |
| 93 params->network_delegate = context->network_delegate(); | 93 params->network_delegate = context->network_delegate(); |
| 94 params->http_server_properties = context->http_server_properties(); | 94 params->http_server_properties = context->http_server_properties(); |
| 95 params->net_log = context->net_log(); | 95 params->net_log = context->net_log(); |
| 96 // TODO(sgurun) remove once crbug.com/329681 is fixed. | 96 // TODO(sgurun) remove once crbug.com/329681 is fixed. |
| 97 params->next_protos = net::NextProtosSpdy31(); | 97 params->next_protos = net::NextProtosSpdy31(); |
| 98 params->use_alternate_protocols = true; | 98 params->use_alternate_protocols = true; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 builder.set_network_delegate(aw_network_delegate); | 192 builder.set_network_delegate(aw_network_delegate); |
| 193 #if !defined(DISABLE_FTP_SUPPORT) | 193 #if !defined(DISABLE_FTP_SUPPORT) |
| 194 builder.set_ftp_enabled(false); // Android WebView does not support ftp yet. | 194 builder.set_ftp_enabled(false); // Android WebView does not support ftp yet. |
| 195 #endif | 195 #endif |
| 196 builder.set_proxy_config_service(proxy_config_service_.release()); | 196 builder.set_proxy_config_service(proxy_config_service_.release()); |
| 197 builder.set_accept_language(net::HttpUtil::GenerateAcceptLanguageHeader( | 197 builder.set_accept_language(net::HttpUtil::GenerateAcceptLanguageHeader( |
| 198 AwContentBrowserClient::GetAcceptLangsImpl())); | 198 AwContentBrowserClient::GetAcceptLangsImpl())); |
| 199 ApplyCmdlineOverridesToURLRequestContextBuilder(&builder); | 199 ApplyCmdlineOverridesToURLRequestContextBuilder(&builder); |
| 200 | 200 |
| 201 url_request_context_.reset(builder.Build()); | 201 url_request_context_.reset(builder.Build()); |
| 202 server_bound_cert_service_.reset( | 202 channel_id_service_.reset( |
| 203 new net::ServerBoundCertService( | 203 new net::ChannelIDService( |
| 204 new net::DefaultServerBoundCertStore(NULL), | 204 new net::DefaultChannelIDStore(NULL), |
| 205 base::WorkerPool::GetTaskRunner(true))); | 205 base::WorkerPool::GetTaskRunner(true))); |
| 206 url_request_context_->set_server_bound_cert_service( | 206 url_request_context_->set_channel_id_service(channel_id_service_.get()); |
| 207 server_bound_cert_service_.get()); | |
| 208 // TODO(mnaganov): Fix URLRequestContextBuilder to use proper threads. | 207 // TODO(mnaganov): Fix URLRequestContextBuilder to use proper threads. |
| 209 net::HttpNetworkSession::Params network_session_params; | 208 net::HttpNetworkSession::Params network_session_params; |
| 210 | 209 |
| 211 PopulateNetworkSessionParams(url_request_context_.get(), | 210 PopulateNetworkSessionParams(url_request_context_.get(), |
| 212 &network_session_params); | 211 &network_session_params); |
| 213 | 212 |
| 214 net::HttpCache* main_cache = new net::HttpCache( | 213 net::HttpCache* main_cache = new net::HttpCache( |
| 215 network_session_params, | 214 network_session_params, |
| 216 new net::HttpCache::DefaultBackend( | 215 new net::HttpCache::DefaultBackend( |
| 217 net::DISK_CACHE, | 216 net::DISK_CACHE, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 request_interceptors_.swap(request_interceptors); | 261 request_interceptors_.swap(request_interceptors); |
| 263 } | 262 } |
| 264 | 263 |
| 265 DataReductionProxyConfigService* | 264 DataReductionProxyConfigService* |
| 266 AwURLRequestContextGetter::proxy_config_service() { | 265 AwURLRequestContextGetter::proxy_config_service() { |
| 267 // TODO(bengr): return system config if data reduction proxy is disabled. | 266 // TODO(bengr): return system config if data reduction proxy is disabled. |
| 268 return proxy_config_service_.get(); | 267 return proxy_config_service_.get(); |
| 269 } | 268 } |
| 270 | 269 |
| 271 } // namespace android_webview | 270 } // namespace android_webview |
| OLD | NEW |