Commit c2503c05 authored by Alex Clarke's avatar Alex Clarke Committed by Commit Bot

Add --enable-begin-frame-control to HeadlessShell for Puppeteer

This is an experimental feature subject to change without notice.

Change-Id: Ib82560101ba52b058c13120d323988f69f4debb3
Reviewed-on: https://chromium-review.googlesource.com/923944Reviewed-by: default avatarSami Kyöstilä <skyostil@chromium.org>
Commit-Queue: Alex Clarke <alexclarke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537420}
parent 4de65ba0
......@@ -704,6 +704,9 @@ int HeadlessShellMain(int argc, const char** argv) {
builder.SetCrashDumpsDir(dumps_path);
#endif
if (command_line.HasSwitch(switches::kEnableBeginFrameControl))
builder.SetEnableBeginFrameControl(true);
if (command_line.HasSwitch(switches::kEnableCrashReporter))
builder.SetCrashReporterEnabled(true);
if (command_line.HasSwitch(switches::kDisableCrashReporter))
......
......@@ -12,6 +12,10 @@ namespace switches {
// transparent.
const char kDefaultBackgroundColor[] = "default-background-color";
// Whether or not begin frames should be issued over DevToolsProtocol
// (experimental).
const char kEnableBeginFrameControl[] = "enable-begin-frame-control";
// Enable crash reporter for headless.
const char kEnableCrashReporter[] = "enable-crash-reporter";
......
......@@ -15,6 +15,7 @@ extern const char kDefaultBackgroundColor[];
extern const char kDeterministicFetch[];
extern const char kDisableCrashReporter[];
extern const char kDumpDom[];
extern const char kEnableBeginFrameControl[];
extern const char kEnableCrashReporter[];
extern const char kHideScrollbars[];
extern const char kPasswordStore[];
......
......@@ -272,7 +272,8 @@ std::unique_ptr<HeadlessWebContentsImpl> HeadlessWebContentsImpl::Create(
headless_web_contents->mojo_services_ = std::move(builder->mojo_services_);
headless_web_contents->begin_frame_control_enabled_ =
builder->enable_begin_frame_control_;
builder->enable_begin_frame_control_ ||
headless_web_contents->browser()->options()->enable_begin_frame_control;
headless_web_contents->InitializeWindow(gfx::Rect(builder->window_size_));
if (!headless_web_contents->OpenURL(builder->initial_url_))
return nullptr;
......
......@@ -83,6 +83,11 @@ Builder& Builder::SetAcceptLanguage(const std::string& accept_language) {
return *this;
}
Builder& Builder::SetEnableBeginFrameControl(bool enable_begin_frame_control) {
options_.enable_begin_frame_control = enable_begin_frame_control;
return *this;
}
Builder& Builder::EnableDevToolsServer(const net::HostPortPair& endpoint) {
options_.devtools_endpoint = endpoint;
return *this;
......
......@@ -187,6 +187,10 @@ struct HEADLESS_EXPORT HeadlessBrowser::Options {
// Whether cookies are allowed. Enabled by default.
bool allow_cookies = true;
// Whether or not BeginFrames will be issued over DevTools protocol
// (experimental).
bool enable_begin_frame_control = false;
// Set a callback that is invoked to override WebPreferences for RenderViews
// created within the HeadlessBrowser. Called whenever the WebPreferences of a
// RenderView change. Executed on the browser main thread.
......@@ -255,6 +259,7 @@ class HEADLESS_EXPORT HeadlessBrowser::Options::Builder {
Builder& SetProductNameAndVersion(
const std::string& product_name_and_version);
Builder& SetAcceptLanguage(const std::string& accept_language);
Builder& SetEnableBeginFrameControl(bool enable_begin_frame_control);
Builder& SetUserAgent(const std::string& user_agent);
Builder& SetProxyConfig(std::unique_ptr<net::ProxyConfig> proxy_config);
Builder& SetHostResolverRules(const std::string& host_resolver_rules);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment