| 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 | 7 |
| 8 using Options = headless::HeadlessBrowser::Options; | 8 using Options = headless::HeadlessBrowser::Options; |
| 9 using Builder = headless::HeadlessBrowser::Options::Builder; | 9 using Builder = headless::HeadlessBrowser::Options::Builder; |
| 10 | 10 |
| 11 namespace headless { | 11 namespace headless { |
| 12 | 12 |
| 13 // Product name for building the default user agent string. | 13 // Product name for building the default user agent string. |
| 14 namespace { | 14 namespace { |
| 15 const char kProductName[] = "HeadlessChrome"; | 15 const char kProductName[] = "HeadlessChrome"; |
| 16 } | 16 } |
| 17 | 17 |
| 18 Options::Options(int argc, const char** argv) | 18 Options::Options(int argc, const char** argv) |
| 19 : argc(argc), | 19 : argc(argc), |
| 20 argv(argv), | 20 argv(argv), |
| 21 user_agent(content::BuildUserAgentFromProduct(kProductName)), | 21 user_agent(content::BuildUserAgentFromProduct(kProductName)), |
| 22 message_pump(nullptr), | 22 message_pump(nullptr), |
| 23 single_process_mode(false), | 23 single_process_mode(false), |
| 24 disable_sandbox(false) {} | 24 disable_sandbox(false), |
| 25 gl_implementation("osmesa") {} |
| 25 | 26 |
| 26 Options::Options(Options&& options) = default; | 27 Options::Options(Options&& options) = default; |
| 27 | 28 |
| 28 Options::~Options() {} | 29 Options::~Options() {} |
| 29 | 30 |
| 30 Options& Options::operator=(Options&& options) = default; | 31 Options& Options::operator=(Options&& options) = default; |
| 31 | 32 |
| 32 Builder::Builder(int argc, const char** argv) : options_(argc, argv) {} | 33 Builder::Builder(int argc, const char** argv) : options_(argc, argv) {} |
| 33 | 34 |
| 34 Builder::Builder() : options_(0, nullptr) {} | 35 Builder::Builder() : options_(0, nullptr) {} |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 Builder& Builder::SetDisableSandbox(bool disable_sandbox) { | 69 Builder& Builder::SetDisableSandbox(bool disable_sandbox) { |
| 69 options_.disable_sandbox = disable_sandbox; | 70 options_.disable_sandbox = disable_sandbox; |
| 70 return *this; | 71 return *this; |
| 71 } | 72 } |
| 72 | 73 |
| 73 Builder& Builder::SetProtocolHandlers(ProtocolHandlerMap protocol_handlers) { | 74 Builder& Builder::SetProtocolHandlers(ProtocolHandlerMap protocol_handlers) { |
| 74 options_.protocol_handlers = std::move(protocol_handlers); | 75 options_.protocol_handlers = std::move(protocol_handlers); |
| 75 return *this; | 76 return *this; |
| 76 } | 77 } |
| 77 | 78 |
| 79 Builder& Builder::SetGLImplementation(const std::string& gl_implementation) { |
| 80 options_.gl_implementation = gl_implementation; |
| 81 return *this; |
| 82 } |
| 83 |
| 78 Options Builder::Build() { | 84 Options Builder::Build() { |
| 79 return std::move(options_); | 85 return std::move(options_); |
| 80 } | 86 } |
| 81 | 87 |
| 82 } // namespace headless | 88 } // namespace headless |
| OLD | NEW |