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

Unified Diff: headless/app/headless_shell.cc

Issue 2043603004: headless: Introduce a browser context (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits Created 4 years, 6 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/BUILD.gn ('k') | headless/lib/browser/headless_browser_context.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 f8145054054325e9a5ccaa029622485a36f86b0f..f596ae2a7e707a4d7ea8852d467bedbb9cc4b097 100644
--- a/headless/app/headless_shell.cc
+++ b/headless/app/headless_shell.cc
@@ -56,17 +56,14 @@ class HeadlessShell : public HeadlessWebContents::Observer, page::Observer {
void OnStart(HeadlessBrowser* browser) {
browser_ = browser;
+ HeadlessWebContents::Builder builder(browser_->CreateWebContentsBuilder());
base::CommandLine::StringVector args =
base::CommandLine::ForCurrentProcess()->GetArgs();
- const char kDefaultUrl[] = "about:blank";
- if (args.empty() || args[0].empty()) {
- url_ = GURL(kDefaultUrl);
- } else {
- url_ = GURL(args[0]);
- }
+ if (!args.empty() && !args[0].empty())
+ builder.SetInitialURL(GURL(args[0]));
- web_contents_ = browser->CreateWebContents(url_, gfx::Size(800, 600));
+ web_contents_ = builder.Build();
if (!web_contents_) {
LOG(ERROR) << "Navigation failed";
browser_->Shutdown();
« no previous file with comments | « headless/BUILD.gn ('k') | headless/lib/browser/headless_browser_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698