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/bind.h" | 16 #include "base/bind.h" |
17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
19 #include "base/threading/sequenced_worker_pool.h" | 19 #include "base/threading/sequenced_worker_pool.h" |
20 #include "base/threading/worker_pool.h" | 20 #include "base/threading/worker_pool.h" |
21 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_auth
_request_handler.h" | 21 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_auth
_request_handler.h" |
22 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
igurator.h" | |
23 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_inte
rceptor.h" | |
24 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" | 22 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
25 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw
ork_delegate.h" | 23 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw
ork_delegate.h" |
26 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" | |
27 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
28 #include "content/public/browser/content_browser_client.h" | 25 #include "content/public/browser/content_browser_client.h" |
29 #include "content/public/browser/cookie_store_factory.h" | 26 #include "content/public/browser/cookie_store_factory.h" |
30 #include "content/public/common/content_client.h" | 27 #include "content/public/common/content_client.h" |
31 #include "content/public/common/content_switches.h" | 28 #include "content/public/common/content_switches.h" |
32 #include "content/public/common/url_constants.h" | 29 #include "content/public/common/url_constants.h" |
33 #include "net/base/cache_type.h" | 30 #include "net/base/cache_type.h" |
34 #include "net/base/net_log.h" | 31 #include "net/base/net_log.h" |
35 #include "net/cookies/cookie_store.h" | 32 #include "net/cookies/cookie_store.h" |
36 #include "net/dns/mapped_host_resolver.h" | 33 #include "net/dns/mapped_host_resolver.h" |
37 #include "net/http/http_cache.h" | 34 #include "net/http/http_cache.h" |
38 #include "net/http/http_stream_factory.h" | 35 #include "net/http/http_stream_factory.h" |
39 #include "net/proxy/proxy_service.h" | 36 #include "net/proxy/proxy_service.h" |
40 #include "net/socket/next_proto.h" | 37 #include "net/socket/next_proto.h" |
41 #include "net/ssl/channel_id_service.h" | 38 #include "net/ssl/channel_id_service.h" |
42 #include "net/url_request/data_protocol_handler.h" | 39 #include "net/url_request/data_protocol_handler.h" |
43 #include "net/url_request/file_protocol_handler.h" | 40 #include "net/url_request/file_protocol_handler.h" |
44 #include "net/url_request/url_request_context_builder.h" | 41 #include "net/url_request/url_request_context_builder.h" |
45 #include "net/url_request/url_request_context.h" | 42 #include "net/url_request/url_request_context.h" |
46 #include "net/url_request/url_request_intercepting_job_factory.h" | 43 #include "net/url_request/url_request_intercepting_job_factory.h" |
47 #include "net/url_request/url_request_interceptor.h" | 44 #include "net/url_request/url_request_interceptor.h" |
48 | 45 |
49 using content::BrowserThread; | 46 using content::BrowserThread; |
50 using data_reduction_proxy::DataReductionProxySettings; | |
51 | 47 |
52 namespace android_webview { | 48 namespace android_webview { |
53 | 49 |
54 | 50 |
55 namespace { | 51 namespace { |
56 | 52 |
57 void ApplyCmdlineOverridesToURLRequestContextBuilder( | 53 void ApplyCmdlineOverridesToURLRequestContextBuilder( |
58 net::URLRequestContextBuilder* builder) { | 54 net::URLRequestContextBuilder* builder) { |
59 const base::CommandLine& command_line = | 55 const base::CommandLine& command_line = |
60 *base::CommandLine::ForCurrentProcess(); | 56 *base::CommandLine::ForCurrentProcess(); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 260 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
265 } | 261 } |
266 | 262 |
267 void AwURLRequestContextGetter::SetHandlersAndInterceptors( | 263 void AwURLRequestContextGetter::SetHandlersAndInterceptors( |
268 content::ProtocolHandlerMap* protocol_handlers, | 264 content::ProtocolHandlerMap* protocol_handlers, |
269 content::URLRequestInterceptorScopedVector request_interceptors) { | 265 content::URLRequestInterceptorScopedVector request_interceptors) { |
270 std::swap(protocol_handlers_, *protocol_handlers); | 266 std::swap(protocol_handlers_, *protocol_handlers); |
271 request_interceptors_.swap(request_interceptors); | 267 request_interceptors_.swap(request_interceptors); |
272 } | 268 } |
273 | 269 |
274 data_reduction_proxy::DataReductionProxyAuthRequestHandler* | |
275 AwURLRequestContextGetter::GetDataReductionProxyAuthRequestHandler() const { | |
276 return data_reduction_proxy_auth_request_handler_.get(); | |
277 } | |
278 | |
279 net::NetLog* AwURLRequestContextGetter::GetNetLog() { | 270 net::NetLog* AwURLRequestContextGetter::GetNetLog() { |
280 return net_log_.get(); | 271 return net_log_.get(); |
281 } | 272 } |
282 | 273 |
283 void AwURLRequestContextGetter::SetKeyOnIO(const std::string& key) { | 274 void AwURLRequestContextGetter::SetKeyOnIO(const std::string& key) { |
284 DCHECK(data_reduction_proxy_auth_request_handler_); | 275 DCHECK(AwBrowserContext::GetDefault()->GetDataReductionProxyIOData()); |
285 data_reduction_proxy_auth_request_handler_->InitAuthentication(key); | 276 AwBrowserContext::GetDefault()->GetDataReductionProxyIOData()-> |
| 277 auth_request_handler()->InitAuthentication(key); |
286 } | 278 } |
287 | 279 |
288 } // namespace android_webview | 280 } // namespace android_webview |
OLD | NEW |