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

Unified Diff: headless/public/headless_browser.cc

Issue 1461693003: [headless] Initial skeleton of headless/public/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes according to skyostil@'s comments Created 5 years 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
new file mode 100644
index 0000000000000000000000000000000000000000..6f5cc57b74c2ef345aa6b975eba5d061bffebb6d
--- /dev/null
+++ b/headless/public/headless_browser.cc
@@ -0,0 +1,46 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
Sami 2015/12/01 17:48:27 I think this file should be headless/src/? (it use
altimin 2015/12/01 18:42:46 I followed example of content/public/, where publi
Sami 2015/12/01 18:53:53 I see. I wonder where we should draw the line. For
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "headless/public/headless_browser.h"
+
+using Options = headless::HeadlessBrowser::Options;
+using Builder = headless::HeadlessBrowser::Options::Builder;
+
+namespace headless {
+
+Options::Options(int argc, const char** argv)
+ : argc(argc), argv(argv), devtools_http_port(kInvalidPort) {}
+
+Options::Options(Options&& options) {
+ *this = options;
Sami 2015/12/01 17:47:33 nit: the documentation seems to suggest that we do
altimin 2015/12/01 18:42:46 Done.
+}
+
+Options::~Options() {}
+
+Builder::Builder(int argc, const char** argv) : options_(argc, argv) {}
+
+Builder::~Builder() {}
+
+Builder& Builder::SetUserAgent(const std::string& user_agent) {
+ options_.user_agent = user_agent;
+ return *this;
+}
+
+Builder& Builder::EnableDevToolsServer(int port) {
+ 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;
+ return *this;
+}
+
+Options Builder::Build() {
+ return options_;
+ // return std::move(options_);
Sami 2015/12/01 17:47:33 Bad edit?
altimin 2015/12/01 18:42:46 Indeed, thanks.
+}
+
+} // namespace headless

Powered by Google App Engine
This is Rietveld 408576698