OLD | NEW |
(Empty) | |
| 1 #include "headless/public/headless_browser.h" |
| 2 |
| 3 #include "net/url_request/url_request_context_getter.h" |
| 4 |
| 5 using Options = headless::HeadlessBrowser::Options; |
| 6 using Builder = headless::HeadlessBrowser::Options::Builder; |
| 7 |
| 8 namespace headless { |
| 9 |
| 10 Options::Options(int argc, const char** argv) |
| 11 : argc(argc), argv(argv) {} |
| 12 |
| 13 Options::Options(Options&& options) |
| 14 : argc(std::move(options.argc)) |
| 15 , argv(std::move(options.argv)) |
| 16 , user_agent(std::move(options.user_agent)) |
| 17 , devtools_http_port(std::move(options.devtools_http_port)) |
| 18 , url_request_context_getter(std::move(options.url_request_context_getter)) {} |
| 19 |
| 20 Options::~Options() {} |
| 21 |
| 22 Builder::Builder(int argc, const char** argv) |
| 23 : options_(argc, argv) {} |
| 24 |
| 25 Builder::~Builder() {} |
| 26 |
| 27 Builder& Builder::SetUserAgent(const std::string& user_agent) { |
| 28 options_.user_agent = make_scoped_ptr(new std::string(user_agent)); |
| 29 return *this; |
| 30 } |
| 31 |
| 32 Builder& Builder::EnableDevtoolsServer(int port) { |
| 33 options_.devtools_http_port = make_scoped_ptr(new int(port)); |
| 34 return *this; |
| 35 } |
| 36 |
| 37 Builder& Builder::SetURLRequestContextGetter( |
| 38 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter) |
| 39 { |
| 40 options_.url_request_context_getter = url_request_context_getter; |
| 41 return *this; |
| 42 } |
| 43 |
| 44 Options Builder::Build() { |
| 45 return std::move(options_); |
| 46 } |
| 47 |
| 48 } // namespace headless |
OLD | NEW |