| 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 "headless/public/headless_browser.h" |
| 6 |
| 7 #include <utility> |
| 8 |
| 5 #include "content/public/common/user_agent.h" | 9 #include "content/public/common/user_agent.h" |
| 6 #include "headless/public/headless_browser.h" | |
| 7 | 10 |
| 8 using Options = headless::HeadlessBrowser::Options; | 11 using Options = headless::HeadlessBrowser::Options; |
| 9 using Builder = headless::HeadlessBrowser::Options::Builder; | 12 using Builder = headless::HeadlessBrowser::Options::Builder; |
| 10 | 13 |
| 11 namespace headless { | 14 namespace headless { |
| 12 | 15 |
| 13 // Product name for building the default user agent string. | 16 // Product name for building the default user agent string. |
| 14 namespace { | 17 namespace { |
| 15 const char kProductName[] = "HeadlessChrome"; | 18 const char kProductName[] = "HeadlessChrome"; |
| 16 } | 19 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 Builder& Builder::SetSingleProcessMode(bool single_process_mode) { | 67 Builder& Builder::SetSingleProcessMode(bool single_process_mode) { |
| 65 options_.single_process_mode = single_process_mode; | 68 options_.single_process_mode = single_process_mode; |
| 66 return *this; | 69 return *this; |
| 67 } | 70 } |
| 68 | 71 |
| 69 Builder& Builder::SetDisableSandbox(bool disable_sandbox) { | 72 Builder& Builder::SetDisableSandbox(bool disable_sandbox) { |
| 70 options_.disable_sandbox = disable_sandbox; | 73 options_.disable_sandbox = disable_sandbox; |
| 71 return *this; | 74 return *this; |
| 72 } | 75 } |
| 73 | 76 |
| 74 Builder& Builder::SetProtocolHandlers(ProtocolHandlerMap protocol_handlers) { | |
| 75 options_.protocol_handlers = std::move(protocol_handlers); | |
| 76 return *this; | |
| 77 } | |
| 78 | |
| 79 Builder& Builder::SetGLImplementation(const std::string& gl_implementation) { | 77 Builder& Builder::SetGLImplementation(const std::string& gl_implementation) { |
| 80 options_.gl_implementation = gl_implementation; | 78 options_.gl_implementation = gl_implementation; |
| 81 return *this; | 79 return *this; |
| 82 } | 80 } |
| 83 | 81 |
| 82 Builder& Builder::SetUserDataDir(const base::FilePath& user_data_dir) { |
| 83 options_.user_data_dir = user_data_dir; |
| 84 return *this; |
| 85 } |
| 86 |
| 84 Options Builder::Build() { | 87 Options Builder::Build() { |
| 85 return std::move(options_); | 88 return std::move(options_); |
| 86 } | 89 } |
| 87 | 90 |
| 88 } // namespace headless | 91 } // namespace headless |
| OLD | NEW |