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 "base/threading/worker_pool.h" |
20 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ
est_handler.h" | 20 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ
est_handler.h" |
21 #include "components/data_reduction_proxy/browser/data_reduction_proxy_config_se
rvice.h" | 21 #include "components/data_reduction_proxy/browser/data_reduction_proxy_config_se
rvice.h" |
22 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.
h" | 22 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.
h" |
23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
24 #include "content/public/browser/content_browser_client.h" | 24 #include "content/public/browser/content_browser_client.h" |
25 #include "content/public/browser/cookie_store_factory.h" | 25 #include "content/public/browser/cookie_store_factory.h" |
26 #include "content/public/common/content_client.h" | 26 #include "content/public/common/content_client.h" |
27 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
28 #include "content/public/common/url_constants.h" | 28 #include "content/public/common/url_constants.h" |
29 #include "net/base/cache_type.h" | 29 #include "net/base/cache_type.h" |
| 30 #include "net/base/net_log.h" |
30 #include "net/cookies/cookie_store.h" | 31 #include "net/cookies/cookie_store.h" |
31 #include "net/dns/mapped_host_resolver.h" | 32 #include "net/dns/mapped_host_resolver.h" |
32 #include "net/http/http_cache.h" | 33 #include "net/http/http_cache.h" |
33 #include "net/http/http_stream_factory.h" | 34 #include "net/http/http_stream_factory.h" |
34 #include "net/proxy/proxy_service.h" | 35 #include "net/proxy/proxy_service.h" |
35 #include "net/socket/next_proto.h" | 36 #include "net/socket/next_proto.h" |
36 #include "net/ssl/default_channel_id_store.h" | 37 #include "net/ssl/default_channel_id_store.h" |
37 #include "net/url_request/data_protocol_handler.h" | 38 #include "net/url_request/data_protocol_handler.h" |
38 #include "net/url_request/file_protocol_handler.h" | 39 #include "net/url_request/file_protocol_handler.h" |
39 #include "net/url_request/url_request_context_builder.h" | 40 #include "net/url_request/url_request_context_builder.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 if (data_reduction_proxy_config_service_.get()) { | 199 if (data_reduction_proxy_config_service_.get()) { |
199 builder.set_proxy_config_service( | 200 builder.set_proxy_config_service( |
200 data_reduction_proxy_config_service_.release()); | 201 data_reduction_proxy_config_service_.release()); |
201 } else { | 202 } else { |
202 builder.set_proxy_config_service( | 203 builder.set_proxy_config_service( |
203 net::ProxyService::CreateSystemProxyConfigService( | 204 net::ProxyService::CreateSystemProxyConfigService( |
204 GetNetworkTaskRunner(), NULL /* Ignored on Android */ )); | 205 GetNetworkTaskRunner(), NULL /* Ignored on Android */ )); |
205 } | 206 } |
206 builder.set_accept_language(net::HttpUtil::GenerateAcceptLanguageHeader( | 207 builder.set_accept_language(net::HttpUtil::GenerateAcceptLanguageHeader( |
207 AwContentBrowserClient::GetAcceptLangsImpl())); | 208 AwContentBrowserClient::GetAcceptLangsImpl())); |
| 209 net_log_.reset(new net::NetLog()); |
| 210 builder.set_net_log(net_log_.get()); |
208 ApplyCmdlineOverridesToURLRequestContextBuilder(&builder); | 211 ApplyCmdlineOverridesToURLRequestContextBuilder(&builder); |
209 | 212 |
210 url_request_context_.reset(builder.Build()); | 213 url_request_context_.reset(builder.Build()); |
211 // TODO(mnaganov): Fix URLRequestContextBuilder to use proper threads. | 214 // TODO(mnaganov): Fix URLRequestContextBuilder to use proper threads. |
212 net::HttpNetworkSession::Params network_session_params; | 215 net::HttpNetworkSession::Params network_session_params; |
213 | 216 |
214 PopulateNetworkSessionParams(url_request_context_.get(), | 217 PopulateNetworkSessionParams(url_request_context_.get(), |
215 &network_session_params); | 218 &network_session_params); |
216 | 219 |
217 net::HttpCache* main_cache = new net::HttpCache( | 220 net::HttpCache* main_cache = new net::HttpCache( |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 content::URLRequestInterceptorScopedVector request_interceptors) { | 272 content::URLRequestInterceptorScopedVector request_interceptors) { |
270 std::swap(protocol_handlers_, *protocol_handlers); | 273 std::swap(protocol_handlers_, *protocol_handlers); |
271 request_interceptors_.swap(request_interceptors); | 274 request_interceptors_.swap(request_interceptors); |
272 } | 275 } |
273 | 276 |
274 data_reduction_proxy::DataReductionProxyAuthRequestHandler* | 277 data_reduction_proxy::DataReductionProxyAuthRequestHandler* |
275 AwURLRequestContextGetter::GetDataReductionProxyAuthRequestHandler() const { | 278 AwURLRequestContextGetter::GetDataReductionProxyAuthRequestHandler() const { |
276 return data_reduction_proxy_auth_request_handler_.get(); | 279 return data_reduction_proxy_auth_request_handler_.get(); |
277 } | 280 } |
278 | 281 |
| 282 net::NetLog* AwURLRequestContextGetter::GetNetLog() const { |
| 283 return net_log_.get(); |
| 284 } |
| 285 |
279 } // namespace android_webview | 286 } // namespace android_webview |
OLD | NEW |