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

Side by Side 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: Fine, no console logging Mr. Presubmit. 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 unified diff | Download patch
« no previous file with comments | « headless/public/headless_browser.h ('k') | headless/public/headless_web_contents.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/public/common/user_agent.h"
5 #include "headless/public/headless_browser.h" 6 #include "headless/public/headless_browser.h"
7 #include "net/url_request/url_request_context_getter.h"
6 8
7 using Options = headless::HeadlessBrowser::Options; 9 using Options = headless::HeadlessBrowser::Options;
8 using Builder = headless::HeadlessBrowser::Options::Builder; 10 using Builder = headless::HeadlessBrowser::Options::Builder;
9 11
10 namespace headless { 12 namespace headless {
11 13
14 // Product name for building the default user agent string.
15 namespace {
16 const char kProductName[] = "HeadlessChrome";
17 }
18
12 Options::Options(int argc, const char** argv) 19 Options::Options(int argc, const char** argv)
13 : argc(argc), argv(argv), devtools_http_port(kInvalidPort) {} 20 : argc(argc),
21 argv(argv),
22 user_agent(content::BuildUserAgentFromProduct(kProductName)),
23 message_pump(nullptr) {}
14 24
15 Options::~Options() {} 25 Options::~Options() {}
16 26
17 Builder::Builder(int argc, const char** argv) : options_(argc, argv) {} 27 Builder::Builder(int argc, const char** argv) : options_(argc, argv) {}
18 28
19 Builder::~Builder() {} 29 Builder::~Builder() {}
20 30
21 Builder& Builder::SetUserAgent(const std::string& user_agent) { 31 Builder& Builder::SetUserAgent(const std::string& user_agent) {
22 options_.user_agent = user_agent; 32 options_.user_agent = user_agent;
23 return *this; 33 return *this;
24 } 34 }
25 35
26 Builder& Builder::EnableDevToolsServer(int port) { 36 Builder& Builder::EnableDevToolsServer(const net::IPEndPoint& endpoint) {
27 options_.devtools_http_port = port; 37 options_.devtools_endpoint = endpoint;
28 return *this; 38 return *this;
29 } 39 }
30 40
31 Builder& Builder::SetURLRequestContextGetter( 41 Builder& Builder::SetMessagePump(base::MessagePump* message_pump) {
32 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter) { 42 options_.message_pump = message_pump;
33 options_.url_request_context_getter = url_request_context_getter;
34 return *this; 43 return *this;
35 } 44 }
36 45
37 Options Builder::Build() { 46 Options Builder::Build() {
38 return options_; 47 return options_;
39 } 48 }
40 49
41 } // namespace headless 50 } // namespace headless
OLDNEW
« no previous file with comments | « headless/public/headless_browser.h ('k') | headless/public/headless_web_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698