Index: headless/app/headless_shell.cc |
diff --git a/headless/app/headless_shell.cc b/headless/app/headless_shell.cc |
index e2d6348cf4285589d62c1a61f0ce7f2c113cf190..1031dbd5446b78a4fa95d7981971fc1a9faca677 100644 |
--- a/headless/app/headless_shell.cc |
+++ b/headless/app/headless_shell.cc |
@@ -37,8 +37,6 @@ class HeadlessShell : public HeadlessWebContents::Observer { |
void OnStart(HeadlessBrowser* browser) { |
browser_ = browser; |
- web_contents_ = browser->CreateWebContents(gfx::Size(800, 600)); |
- web_contents_->AddObserver(this); |
base::CommandLine::StringVector args = |
base::CommandLine::ForCurrentProcess()->GetArgs(); |
@@ -50,11 +48,13 @@ class HeadlessShell : public HeadlessWebContents::Observer { |
} else { |
url = GURL(args[0]); |
} |
- if (!web_contents_->OpenURL(url)) { |
+ web_contents_ = browser->CreateWebContents(url, gfx::Size(800, 600)); |
+ if (!web_contents_) { |
LOG(ERROR) << "Navigation failed"; |
- web_contents_ = nullptr; |
browser_->Shutdown(); |
+ return; |
} |
+ web_contents_->AddObserver(this); |
} |
void ShutdownIfNeeded() { |
@@ -71,8 +71,6 @@ class HeadlessShell : public HeadlessWebContents::Observer { |
ShutdownIfNeeded(); |
} |
- void DidFinishNavigation(bool success) override {} |
- |
private: |
HeadlessBrowser* browser_; // Not owned. |
std::unique_ptr<HeadlessWebContents> web_contents_; |