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 <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "android_webview/browser/aw_browser_context.h" | 10 #include "android_webview/browser/aw_browser_context.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "content/public/common/content_switches.h" | 32 #include "content/public/common/content_switches.h" |
33 #include "content/public/common/url_constants.h" | 33 #include "content/public/common/url_constants.h" |
34 #include "net/base/cache_type.h" | 34 #include "net/base/cache_type.h" |
35 #include "net/cookies/cookie_store.h" | 35 #include "net/cookies/cookie_store.h" |
36 #include "net/dns/mapped_host_resolver.h" | 36 #include "net/dns/mapped_host_resolver.h" |
37 #include "net/extras/sqlite/sqlite_channel_id_store.h" | 37 #include "net/extras/sqlite/sqlite_channel_id_store.h" |
38 #include "net/http/http_auth_filter.h" | 38 #include "net/http/http_auth_filter.h" |
39 #include "net/http/http_auth_handler_factory.h" | 39 #include "net/http/http_auth_handler_factory.h" |
40 #include "net/http/http_auth_preferences.h" | 40 #include "net/http/http_auth_preferences.h" |
41 #include "net/http/http_cache.h" | 41 #include "net/http/http_cache.h" |
| 42 #include "net/http/http_network_session.h" |
42 #include "net/http/http_stream_factory.h" | 43 #include "net/http/http_stream_factory.h" |
43 #include "net/log/net_log.h" | 44 #include "net/log/net_log.h" |
44 #include "net/net_features.h" | 45 #include "net/net_features.h" |
45 #include "net/proxy/proxy_service.h" | 46 #include "net/proxy/proxy_service.h" |
46 #include "net/socket/next_proto.h" | 47 #include "net/socket/next_proto.h" |
47 #include "net/ssl/channel_id_service.h" | 48 #include "net/ssl/channel_id_service.h" |
48 #include "net/url_request/data_protocol_handler.h" | 49 #include "net/url_request/data_protocol_handler.h" |
49 #include "net/url_request/file_protocol_handler.h" | 50 #include "net/url_request/file_protocol_handler.h" |
50 #include "net/url_request/url_request_context.h" | 51 #include "net/url_request/url_request_context.h" |
51 #include "net/url_request/url_request_context_builder.h" | 52 #include "net/url_request/url_request_context_builder.h" |
(...skipping 24 matching lines...) Expand all Loading... |
76 if (command_line.HasSwitch(switches::kHostResolverRules)) { | 77 if (command_line.HasSwitch(switches::kHostResolverRules)) { |
77 // If hostname remappings were specified on the command-line, layer these | 78 // If hostname remappings were specified on the command-line, layer these |
78 // rules on top of the real host resolver. This allows forwarding all | 79 // rules on top of the real host resolver. This allows forwarding all |
79 // requests through a designated test server. | 80 // requests through a designated test server. |
80 host_resolver->SetRulesFromString( | 81 host_resolver->SetRulesFromString( |
81 command_line.GetSwitchValueASCII(switches::kHostResolverRules)); | 82 command_line.GetSwitchValueASCII(switches::kHostResolverRules)); |
82 } | 83 } |
83 } | 84 } |
84 | 85 |
85 void ApplyCmdlineOverridesToNetworkSessionParams( | 86 void ApplyCmdlineOverridesToNetworkSessionParams( |
86 net::URLRequestContextBuilder::HttpNetworkSessionParams* params) { | 87 net::HttpNetworkSession::Params* params) { |
87 int value; | 88 int value; |
88 const base::CommandLine& command_line = | 89 const base::CommandLine& command_line = |
89 *base::CommandLine::ForCurrentProcess(); | 90 *base::CommandLine::ForCurrentProcess(); |
90 if (command_line.HasSwitch(switches::kTestingFixedHttpPort)) { | 91 if (command_line.HasSwitch(switches::kTestingFixedHttpPort)) { |
91 base::StringToInt(command_line.GetSwitchValueASCII( | 92 base::StringToInt(command_line.GetSwitchValueASCII( |
92 switches::kTestingFixedHttpPort), &value); | 93 switches::kTestingFixedHttpPort), &value); |
93 params->testing_fixed_http_port = value; | 94 params->testing_fixed_http_port = value; |
94 } | 95 } |
95 if (command_line.HasSwitch(switches::kTestingFixedHttpsPort)) { | 96 if (command_line.HasSwitch(switches::kTestingFixedHttpsPort)) { |
96 base::StringToInt(command_line.GetSwitchValueASCII( | 97 base::StringToInt(command_line.GetSwitchValueASCII( |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 249 |
249 net::URLRequestContextBuilder::HttpCacheParams cache_params; | 250 net::URLRequestContextBuilder::HttpCacheParams cache_params; |
250 cache_params.type = | 251 cache_params.type = |
251 net::URLRequestContextBuilder::HttpCacheParams::DISK_SIMPLE; | 252 net::URLRequestContextBuilder::HttpCacheParams::DISK_SIMPLE; |
252 cache_params.max_size = 20 * 1024 * 1024; // 20M | 253 cache_params.max_size = 20 * 1024 * 1024; // 20M |
253 cache_params.path = cache_path_; | 254 cache_params.path = cache_path_; |
254 builder.EnableHttpCache(cache_params); | 255 builder.EnableHttpCache(cache_params); |
255 builder.SetFileTaskRunner( | 256 builder.SetFileTaskRunner( |
256 BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE)); | 257 BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE)); |
257 | 258 |
258 net::URLRequestContextBuilder::HttpNetworkSessionParams | 259 net::HttpNetworkSession::Params network_session_params; |
259 network_session_params; | |
260 ApplyCmdlineOverridesToNetworkSessionParams(&network_session_params); | 260 ApplyCmdlineOverridesToNetworkSessionParams(&network_session_params); |
261 builder.set_http_network_session_params(network_session_params); | 261 builder.set_http_network_session_params(network_session_params); |
262 builder.SetSpdyAndQuicEnabled(true, false); | 262 builder.SetSpdyAndQuicEnabled(true, false); |
263 | 263 |
264 std::unique_ptr<net::MappedHostResolver> host_resolver( | 264 std::unique_ptr<net::MappedHostResolver> host_resolver( |
265 new net::MappedHostResolver( | 265 new net::MappedHostResolver( |
266 net::HostResolver::CreateDefaultResolver(nullptr))); | 266 net::HostResolver::CreateDefaultResolver(nullptr))); |
267 ApplyCmdlineOverridesToHostResolver(host_resolver.get()); | 267 ApplyCmdlineOverridesToHostResolver(host_resolver.get()); |
268 builder.SetHttpAuthHandlerFactory( | 268 builder.SetHttpAuthHandlerFactory( |
269 CreateAuthHandlerFactory(host_resolver.get())); | 269 CreateAuthHandlerFactory(host_resolver.get())); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 http_auth_preferences_->set_server_whitelist( | 337 http_auth_preferences_->set_server_whitelist( |
338 auth_server_whitelist_.GetValue()); | 338 auth_server_whitelist_.GetValue()); |
339 } | 339 } |
340 | 340 |
341 void AwURLRequestContextGetter::UpdateAndroidAuthNegotiateAccountType() { | 341 void AwURLRequestContextGetter::UpdateAndroidAuthNegotiateAccountType() { |
342 http_auth_preferences_->set_auth_android_negotiate_account_type( | 342 http_auth_preferences_->set_auth_android_negotiate_account_type( |
343 auth_android_negotiate_account_type_.GetValue()); | 343 auth_android_negotiate_account_type_.GetValue()); |
344 } | 344 } |
345 | 345 |
346 } // namespace android_webview | 346 } // namespace android_webview |
OLD | NEW |