Chromium Code Reviews| Index: android_webview/browser/net/aw_url_request_context_getter.cc |
| diff --git a/android_webview/browser/net/aw_url_request_context_getter.cc b/android_webview/browser/net/aw_url_request_context_getter.cc |
| index 7ad7c4c7bc648a1eb9927ad99ee878826dfdb0e3..a5a7476119a658746fa447c8f9b7db8c4713adcb 100644 |
| --- a/android_webview/browser/net/aw_url_request_context_getter.cc |
| +++ b/android_webview/browser/net/aw_url_request_context_getter.cc |
| @@ -59,6 +59,7 @@ namespace android_webview { |
| namespace { |
| const base::FilePath::CharType kChannelIDFilename[] = "Origin Bound Certs"; |
| +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
|
| void ApplyCmdlineOverridesToHostResolver( |
| net::MappedHostResolver* host_resolver) { |
| @@ -228,8 +229,16 @@ void AwURLRequestContextGetter::InitializeURLRequestContext() { |
| // Android provides a local HTTP proxy that handles all the proxying. |
| // Create the proxy without a resolver since we rely on this local HTTP proxy. |
| // TODO(sgurun) is this behavior guaranteed through SDK? |
| - builder.set_proxy_service(net::ProxyService::CreateWithoutProxyResolver( |
| - std::move(proxy_config_service_), net_log_.get())); |
| + |
| + const base::CommandLine& command_line = |
| + *base::CommandLine::ForCurrentProcess(); |
| + if (command_line.HasSwitch(kProxyServerSwitch)) { |
| + std::string proxy = command_line.GetSwitchValueASCII(kProxyServerSwitch); |
| + builder.set_proxy_service(net::ProxyService::CreateFixed(proxy)); |
| + } else { |
| + builder.set_proxy_service(net::ProxyService::CreateWithoutProxyResolver( |
| + std::move(proxy_config_service_), net_log_.get())); |
| + } |
| builder.set_net_log(net_log_.get()); |
| builder.SetCookieAndChannelIdStores(base::MakeUnique<AwCookieStoreWrapper>(), |
| std::move(channel_id_service)); |