Chromium Code Reviews| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 #include "net/url_request/url_request_interceptor.h" | 52 #include "net/url_request/url_request_interceptor.h" |
| 53 | 53 |
| 54 using content::BrowserThread; | 54 using content::BrowserThread; |
| 55 | 55 |
| 56 namespace android_webview { | 56 namespace android_webview { |
| 57 | 57 |
| 58 | 58 |
| 59 namespace { | 59 namespace { |
| 60 | 60 |
| 61 const base::FilePath::CharType kChannelIDFilename[] = "Origin Bound Certs"; | 61 const base::FilePath::CharType kChannelIDFilename[] = "Origin Bound Certs"; |
| 62 const std::string kProxyServerSwitch = "proxy-server"; | |
|
eroman
2016/09/13 22:34:42
Write this instead as:
const char kProxyServerSwi
Nate Fischer
2016/09/13 22:53:54
Done. Good to know
| |
| 62 | 63 |
| 63 void ApplyCmdlineOverridesToHostResolver( | 64 void ApplyCmdlineOverridesToHostResolver( |
| 64 net::MappedHostResolver* host_resolver) { | 65 net::MappedHostResolver* host_resolver) { |
| 65 const base::CommandLine& command_line = | 66 const base::CommandLine& command_line = |
| 66 *base::CommandLine::ForCurrentProcess(); | 67 *base::CommandLine::ForCurrentProcess(); |
| 67 if (command_line.HasSwitch(switches::kHostResolverRules)) { | 68 if (command_line.HasSwitch(switches::kHostResolverRules)) { |
| 68 // If hostname remappings were specified on the command-line, layer these | 69 // If hostname remappings were specified on the command-line, layer these |
| 69 // rules on top of the real host resolver. This allows forwarding all | 70 // rules on top of the real host resolver. This allows forwarding all |
| 70 // requests through a designated test server. | 71 // requests through a designated test server. |
| 71 host_resolver->SetRulesFromString( | 72 host_resolver->SetRulesFromString( |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 BrowserThread::GetBlockingPool()->GetSequenceToken())); | 222 BrowserThread::GetBlockingPool()->GetSequenceToken())); |
| 222 | 223 |
| 223 channel_id_service.reset(new net::ChannelIDService( | 224 channel_id_service.reset(new net::ChannelIDService( |
| 224 new net::DefaultChannelIDStore(channel_id_db.get()), | 225 new net::DefaultChannelIDStore(channel_id_db.get()), |
| 225 base::WorkerPool::GetTaskRunner(true))); | 226 base::WorkerPool::GetTaskRunner(true))); |
| 226 } | 227 } |
| 227 | 228 |
| 228 // Android provides a local HTTP proxy that handles all the proxying. | 229 // Android provides a local HTTP proxy that handles all the proxying. |
| 229 // Create the proxy without a resolver since we rely on this local HTTP proxy. | 230 // Create the proxy without a resolver since we rely on this local HTTP proxy. |
| 230 // TODO(sgurun) is this behavior guaranteed through SDK? | 231 // TODO(sgurun) is this behavior guaranteed through SDK? |
| 231 builder.set_proxy_service(net::ProxyService::CreateWithoutProxyResolver( | 232 |
| 232 std::move(proxy_config_service_), net_log_.get())); | 233 const base::CommandLine& command_line = |
| 234 *base::CommandLine::ForCurrentProcess(); | |
| 235 if (command_line.HasSwitch(kProxyServerSwitch)) { | |
| 236 std::string proxy = command_line.GetSwitchValueASCII(kProxyServerSwitch); | |
| 237 builder.set_proxy_service(net::ProxyService::CreateFixed(proxy)); | |
| 238 } else { | |
| 239 builder.set_proxy_service(net::ProxyService::CreateWithoutProxyResolver( | |
| 240 std::move(proxy_config_service_), net_log_.get())); | |
| 241 } | |
| 233 builder.set_net_log(net_log_.get()); | 242 builder.set_net_log(net_log_.get()); |
| 234 builder.SetCookieAndChannelIdStores(base::MakeUnique<AwCookieStoreWrapper>(), | 243 builder.SetCookieAndChannelIdStores(base::MakeUnique<AwCookieStoreWrapper>(), |
| 235 std::move(channel_id_service)); | 244 std::move(channel_id_service)); |
| 236 | 245 |
| 237 net::URLRequestContextBuilder::HttpCacheParams cache_params; | 246 net::URLRequestContextBuilder::HttpCacheParams cache_params; |
| 238 cache_params.type = | 247 cache_params.type = |
| 239 net::URLRequestContextBuilder::HttpCacheParams::DISK_SIMPLE; | 248 net::URLRequestContextBuilder::HttpCacheParams::DISK_SIMPLE; |
| 240 cache_params.max_size = 20 * 1024 * 1024; // 20M | 249 cache_params.max_size = 20 * 1024 * 1024; // 20M |
| 241 cache_params.path = cache_path_; | 250 cache_params.path = cache_path_; |
| 242 builder.EnableHttpCache(cache_params); | 251 builder.EnableHttpCache(cache_params); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 312 http_auth_preferences_->set_server_whitelist( | 321 http_auth_preferences_->set_server_whitelist( |
| 313 auth_server_whitelist_.GetValue()); | 322 auth_server_whitelist_.GetValue()); |
| 314 } | 323 } |
| 315 | 324 |
| 316 void AwURLRequestContextGetter::UpdateAndroidAuthNegotiateAccountType() { | 325 void AwURLRequestContextGetter::UpdateAndroidAuthNegotiateAccountType() { |
| 317 http_auth_preferences_->set_auth_android_negotiate_account_type( | 326 http_auth_preferences_->set_auth_android_negotiate_account_type( |
| 318 auth_android_negotiate_account_type_.GetValue()); | 327 auth_android_negotiate_account_type_.GetValue()); |
| 319 } | 328 } |
| 320 | 329 |
| 321 } // namespace android_webview | 330 } // namespace android_webview |
| OLD | NEW |