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" |
11 #include "android_webview/browser/aw_request_interceptor.h" | 11 #include "android_webview/browser/aw_request_interceptor.h" |
12 #include "android_webview/browser/net/aw_network_delegate.h" | 12 #include "android_webview/browser/net/aw_network_delegate.h" |
13 #include "android_webview/browser/net/aw_url_request_job_factory.h" | 13 #include "android_webview/browser/net/aw_url_request_job_factory.h" |
14 #include "android_webview/browser/net/init_native_callback.h" | 14 #include "android_webview/browser/net/init_native_callback.h" |
15 #include "android_webview/common/aw_content_client.h" | 15 #include "android_webview/common/aw_content_client.h" |
16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
18 #include "base/threading/sequenced_worker_pool.h" | 18 #include "base/threading/sequenced_worker_pool.h" |
| 19 #include "base/threading/worker_pool.h" |
19 #include "components/data_reduction_proxy/browser/data_reduction_proxy_config_se
rvice.h" | 20 #include "components/data_reduction_proxy/browser/data_reduction_proxy_config_se
rvice.h" |
20 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.
h" | 21 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.
h" |
21 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
22 #include "content/public/browser/content_browser_client.h" | 23 #include "content/public/browser/content_browser_client.h" |
23 #include "content/public/browser/cookie_store_factory.h" | 24 #include "content/public/browser/cookie_store_factory.h" |
24 #include "content/public/common/content_client.h" | 25 #include "content/public/common/content_client.h" |
25 #include "content/public/common/content_switches.h" | 26 #include "content/public/common/content_switches.h" |
26 #include "content/public/common/url_constants.h" | 27 #include "content/public/common/url_constants.h" |
27 #include "net/base/cache_type.h" | 28 #include "net/base/cache_type.h" |
28 #include "net/cookies/cookie_store.h" | 29 #include "net/cookies/cookie_store.h" |
29 #include "net/dns/mapped_host_resolver.h" | 30 #include "net/dns/mapped_host_resolver.h" |
30 #include "net/http/http_cache.h" | 31 #include "net/http/http_cache.h" |
31 #include "net/http/http_stream_factory.h" | 32 #include "net/http/http_stream_factory.h" |
32 #include "net/proxy/proxy_service.h" | 33 #include "net/proxy/proxy_service.h" |
33 #include "net/socket/next_proto.h" | 34 #include "net/socket/next_proto.h" |
| 35 #include "net/ssl/default_server_bound_cert_store.h" |
34 #include "net/url_request/data_protocol_handler.h" | 36 #include "net/url_request/data_protocol_handler.h" |
35 #include "net/url_request/file_protocol_handler.h" | 37 #include "net/url_request/file_protocol_handler.h" |
36 #include "net/url_request/url_request_context_builder.h" | 38 #include "net/url_request/url_request_context_builder.h" |
37 #include "net/url_request/url_request_context.h" | 39 #include "net/url_request/url_request_context.h" |
38 #include "net/url_request/url_request_intercepting_job_factory.h" | 40 #include "net/url_request/url_request_intercepting_job_factory.h" |
39 #include "net/url_request/url_request_interceptor.h" | 41 #include "net/url_request/url_request_interceptor.h" |
40 | 42 |
41 using content::BrowserThread; | 43 using content::BrowserThread; |
42 using data_reduction_proxy::DataReductionProxySettings; | 44 using data_reduction_proxy::DataReductionProxySettings; |
43 | 45 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 builder.set_network_delegate(aw_network_delegate); | 192 builder.set_network_delegate(aw_network_delegate); |
191 #if !defined(DISABLE_FTP_SUPPORT) | 193 #if !defined(DISABLE_FTP_SUPPORT) |
192 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. |
193 #endif | 195 #endif |
194 builder.set_proxy_config_service(proxy_config_service_.release()); | 196 builder.set_proxy_config_service(proxy_config_service_.release()); |
195 builder.set_accept_language(net::HttpUtil::GenerateAcceptLanguageHeader( | 197 builder.set_accept_language(net::HttpUtil::GenerateAcceptLanguageHeader( |
196 AwContentBrowserClient::GetAcceptLangsImpl())); | 198 AwContentBrowserClient::GetAcceptLangsImpl())); |
197 ApplyCmdlineOverridesToURLRequestContextBuilder(&builder); | 199 ApplyCmdlineOverridesToURLRequestContextBuilder(&builder); |
198 | 200 |
199 url_request_context_.reset(builder.Build()); | 201 url_request_context_.reset(builder.Build()); |
| 202 server_bound_cert_service_.reset( |
| 203 new net::ServerBoundCertService( |
| 204 new net::DefaultServerBoundCertStore(NULL), |
| 205 base::WorkerPool::GetTaskRunner(true))); |
| 206 url_request_context_->set_server_bound_cert_service( |
| 207 server_bound_cert_service_.get()); |
200 // TODO(mnaganov): Fix URLRequestContextBuilder to use proper threads. | 208 // TODO(mnaganov): Fix URLRequestContextBuilder to use proper threads. |
201 net::HttpNetworkSession::Params network_session_params; | 209 net::HttpNetworkSession::Params network_session_params; |
202 | 210 |
203 PopulateNetworkSessionParams(url_request_context_.get(), | 211 PopulateNetworkSessionParams(url_request_context_.get(), |
204 &network_session_params); | 212 &network_session_params); |
205 | 213 |
206 net::HttpCache* main_cache = new net::HttpCache( | 214 net::HttpCache* main_cache = new net::HttpCache( |
207 network_session_params, | 215 network_session_params, |
208 new net::HttpCache::DefaultBackend( | 216 new net::HttpCache::DefaultBackend( |
209 net::DISK_CACHE, | 217 net::DISK_CACHE, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 request_interceptors_.swap(request_interceptors); | 262 request_interceptors_.swap(request_interceptors); |
255 } | 263 } |
256 | 264 |
257 DataReductionProxyConfigService* | 265 DataReductionProxyConfigService* |
258 AwURLRequestContextGetter::proxy_config_service() { | 266 AwURLRequestContextGetter::proxy_config_service() { |
259 // TODO(bengr): return system config if data reduction proxy is disabled. | 267 // TODO(bengr): return system config if data reduction proxy is disabled. |
260 return proxy_config_service_.get(); | 268 return proxy_config_service_.get(); |
261 } | 269 } |
262 | 270 |
263 } // namespace android_webview | 271 } // namespace android_webview |
OLD | NEW |