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

Unified Diff: headless/app/headless_shell.cc

Issue 1781193004: headless: Make it possible to configure an HTTP proxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments. Created 4 years, 9 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 | « headless/README.md ('k') | headless/app/headless_shell_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/app/headless_shell.cc
diff --git a/headless/app/headless_shell.cc b/headless/app/headless_shell.cc
index 40b40ee05d6bfbb12315e360fd88d0d85f537608..b04d7760e75def88f58c90d1ca15087b3d1c3c66 100644
--- a/headless/app/headless_shell.cc
+++ b/headless/app/headless_shell.cc
@@ -10,6 +10,7 @@
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_number_conversions.h"
#include "content/public/common/content_switches.h"
+#include "headless/app/headless_shell_switches.h"
#include "headless/public/headless_browser.h"
#include "headless/public/headless_web_contents.h"
#include "net/base/ip_address.h"
@@ -68,6 +69,8 @@ class HeadlessShell : public HeadlessWebContents::Observer {
ShutdownIfNeeded();
}
+ void DidFinishNavigation(bool success) override {}
+
private:
HeadlessBrowser* browser_; // Not owned.
scoped_ptr<HeadlessWebContents> web_contents_;
@@ -96,6 +99,18 @@ int main(int argc, const char** argv) {
}
}
+ if (command_line.HasSwitch(headless::switches::kProxyServer)) {
+ std::string proxy_server =
+ command_line.GetSwitchValueASCII(headless::switches::kProxyServer);
+ net::HostPortPair parsed_proxy_server =
+ net::HostPortPair::FromString(proxy_server);
+ if (parsed_proxy_server.host().empty() || !parsed_proxy_server.port()) {
+ LOG(ERROR) << "Malformed proxy server url";
+ return EXIT_FAILURE;
+ }
+ builder.SetProxyServer(parsed_proxy_server);
+ }
+
return HeadlessBrowserMain(
builder.Build(),
base::Bind(&HeadlessShell::OnStart, base::Unretained(&shell)));
« no previous file with comments | « headless/README.md ('k') | headless/app/headless_shell_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698