OLD | NEW |
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 single_process_mode(false) {} | 24 single_process_mode(false) {} |
25 | 25 |
26 Options::Options(const Options& other) = default; | 26 Options::Options(Options&& options) = default; |
27 | 27 |
28 Options::~Options() {} | 28 Options::~Options() {} |
29 | 29 |
| 30 Options& Options::operator=(Options&& options) = default; |
| 31 |
30 Builder::Builder(int argc, const char** argv) : options_(argc, argv) {} | 32 Builder::Builder(int argc, const char** argv) : options_(argc, argv) {} |
31 | 33 |
32 Builder::Builder() : options_(0, nullptr) {} | 34 Builder::Builder() : options_(0, nullptr) {} |
33 | 35 |
34 Builder::~Builder() {} | 36 Builder::~Builder() {} |
35 | 37 |
36 Builder& Builder::SetUserAgent(const std::string& user_agent) { | 38 Builder& Builder::SetUserAgent(const std::string& user_agent) { |
37 options_.user_agent = user_agent; | 39 options_.user_agent = user_agent; |
38 return *this; | 40 return *this; |
39 } | 41 } |
(...skipping 17 matching lines...) Expand all Loading... |
57 options_.host_resolver_rules = host_resolver_rules; | 59 options_.host_resolver_rules = host_resolver_rules; |
58 return *this; | 60 return *this; |
59 } | 61 } |
60 | 62 |
61 Builder& Builder::SetSingleProcessMode(bool single_process_mode) { | 63 Builder& Builder::SetSingleProcessMode(bool single_process_mode) { |
62 options_.single_process_mode = single_process_mode; | 64 options_.single_process_mode = single_process_mode; |
63 return *this; | 65 return *this; |
64 } | 66 } |
65 | 67 |
66 Options Builder::Build() { | 68 Options Builder::Build() { |
67 return options_; | 69 return std::move(options_); |
68 } | 70 } |
69 | 71 |
70 } // namespace headless | 72 } // namespace headless |
OLD | NEW |