Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2124)

Unified Diff: android_webview/browser/net/aw_url_request_context_getter.cc

Issue 2325763004: ProxyServer commandline flag for android webview (Closed)
Patch Set: ProxyServer commandline flag for android webview Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698