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

Side by Side Diff: headless/public/headless_browser.cc

Issue 1781193004: headless: Make it possible to configure an HTTP proxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments. Created 4 years, 9 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 "content/public/common/user_agent.h"
6 #include "headless/public/headless_browser.h" 6 #include "headless/public/headless_browser.h"
7 #include "net/url_request/url_request_context_getter.h" 7 #include "net/url_request/url_request_context_getter.h"
8 8
9 using Options = headless::HeadlessBrowser::Options; 9 using Options = headless::HeadlessBrowser::Options;
10 using Builder = headless::HeadlessBrowser::Options::Builder; 10 using Builder = headless::HeadlessBrowser::Options::Builder;
11 11
12 namespace headless { 12 namespace headless {
13 13
14 // Product name for building the default user agent string. 14 // Product name for building the default user agent string.
15 namespace { 15 namespace {
16 const char kProductName[] = "HeadlessChrome"; 16 const char kProductName[] = "HeadlessChrome";
17 } 17 }
18 18
19 Options::Options(int argc, const char** argv) 19 Options::Options(int argc, const char** argv)
20 : argc(argc), 20 : argc(argc),
21 argv(argv), 21 argv(argv),
22 user_agent(content::BuildUserAgentFromProduct(kProductName)), 22 user_agent(content::BuildUserAgentFromProduct(kProductName)),
23 message_pump(nullptr) {} 23 message_pump(nullptr) {}
24 24
25 Options::~Options() {} 25 Options::~Options() {}
26 26
27 Builder::Builder(int argc, const char** argv) : options_(argc, argv) {} 27 Builder::Builder(int argc, const char** argv) : options_(argc, argv) {}
28 28
29 Builder::Builder() : options_(0, nullptr) {}
30
29 Builder::~Builder() {} 31 Builder::~Builder() {}
30 32
31 Builder& Builder::SetUserAgent(const std::string& user_agent) { 33 Builder& Builder::SetUserAgent(const std::string& user_agent) {
32 options_.user_agent = user_agent; 34 options_.user_agent = user_agent;
33 return *this; 35 return *this;
34 } 36 }
35 37
36 Builder& Builder::EnableDevToolsServer(const net::IPEndPoint& endpoint) { 38 Builder& Builder::EnableDevToolsServer(const net::IPEndPoint& endpoint) {
37 options_.devtools_endpoint = endpoint; 39 options_.devtools_endpoint = endpoint;
38 return *this; 40 return *this;
39 } 41 }
40 42
41 Builder& Builder::SetMessagePump(base::MessagePump* message_pump) { 43 Builder& Builder::SetMessagePump(base::MessagePump* message_pump) {
42 options_.message_pump = message_pump; 44 options_.message_pump = message_pump;
43 return *this; 45 return *this;
44 } 46 }
45 47
48 Builder& Builder::SetProxyServer(const net::HostPortPair& proxy_server) {
49 options_.proxy_server = proxy_server;
50 return *this;
51 }
52
46 Options Builder::Build() { 53 Options Builder::Build() {
47 return options_; 54 return options_;
48 } 55 }
49 56
50 } // namespace headless 57 } // 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