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

Unified Diff: headless/public/headless_browser.cc

Issue 1674263002: headless: Initial headless embedder API implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix shutdown memory leak. Created 4 years, 10 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
Index: headless/public/headless_browser.cc
diff --git a/headless/public/headless_browser.cc b/headless/public/headless_browser.cc
index cb8a855243a2a1314c7db517e502de2cd4491d57..9ff35dc25c7f90528506fdb19e34fafd3d163703 100644
--- a/headless/public/headless_browser.cc
+++ b/headless/public/headless_browser.cc
@@ -2,15 +2,26 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "content/public/common/user_agent.h"
#include "headless/public/headless_browser.h"
+#include "net/url_request/url_request_context_getter.h"
using Options = headless::HeadlessBrowser::Options;
using Builder = headless::HeadlessBrowser::Options::Builder;
namespace headless {
+// Product name for building the default user agent string.
+namespace {
+const char kProductName[] = "HeadlessChrome";
+}
+
Options::Options(int argc, const char** argv)
- : argc(argc), argv(argv), devtools_http_port(kInvalidPort) {}
+ : argc(argc),
+ argv(argv),
+ user_agent(content::BuildUserAgentFromProduct(kProductName)),
+ devtools_http_port(kInvalidPort),
+ message_pump(nullptr) {}
Options::~Options() {}
@@ -23,14 +34,14 @@ Builder& Builder::SetUserAgent(const std::string& user_agent) {
return *this;
}
-Builder& Builder::EnableDevToolsServer(int port) {
+Builder& Builder::EnableDevToolsServer(const std::string& address, int port) {
+ options_.devtools_http_address = address;
options_.devtools_http_port = port;
return *this;
}
-Builder& Builder::SetURLRequestContextGetter(
- scoped_refptr<net::URLRequestContextGetter> url_request_context_getter) {
- options_.url_request_context_getter = url_request_context_getter;
+Builder& Builder::SetMessagePump(base::MessagePump* message_pump) {
+ options_.message_pump = message_pump;
return *this;
}

Powered by Google App Engine
This is Rietveld 408576698