Chromium Code Reviews| Index: headless/public/headless_browser.cc |
| diff --git a/headless/public/headless_browser.cc b/headless/public/headless_browser.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d3ba9005f5086a10986ff2f1f8b08e3bbdb4eb2b |
| --- /dev/null |
| +++ b/headless/public/headless_browser.cc |
| @@ -0,0 +1,48 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "headless/public/headless_browser.h" |
| + |
| +using Options = headless::HeadlessBrowser::Options; |
| +using Builder = headless::HeadlessBrowser::Options::Builder; |
| + |
| +namespace headless { |
| + |
| +Options::Options(int argc, const char** argv) : argc(argc), argv(argv) {} |
| + |
| +Options::Options(Options&& options) |
| + : argc(std::move(options.argc)), |
|
Sami
2015/12/01 14:03:57
I think you can just do a *this = std::move(option
altimin
2015/12/01 15:17:28
Done.
|
| + argv(std::move(options.argv)), |
| + user_agent(std::move(options.user_agent)), |
| + devtools_http_port(std::move(options.devtools_http_port)), |
| + url_request_context_getter( |
| + std::move(options.url_request_context_getter)) {} |
| + |
| +Options::~Options() {} |
| + |
| +Builder::Builder(int argc, const char** argv) : options_(argc, argv) {} |
| + |
| +Builder::~Builder() {} |
| + |
| +Builder& Builder::SetUserAgent(const std::string& user_agent) { |
| + options_.user_agent = make_scoped_ptr(new std::string(user_agent)); |
| + return *this; |
| +} |
| + |
| +Builder& Builder::EnableDevtoolsServer(int port) { |
| + options_.devtools_http_port = make_scoped_ptr(new int(port)); |
| + return *this; |
| +} |
| + |
| +Builder& Builder::SetURLRequestContextGetter( |
| + scoped_refptr<net::URLRequestContextGetter> url_request_context_getter) { |
| + options_.url_request_context_getter = url_request_context_getter; |
| + return *this; |
| +} |
| + |
| +Options Builder::Build() { |
| + return std::move(options_); |
|
Sami
2015/12/01 14:03:57
No need for std::move here -- returning already ma
altimin
2015/12/01 15:17:28
No. Returning makes only temporary variables rvalu
Sami
2015/12/01 17:47:33
Ah, right, because we shouldn't move those members
alex clarke (OOO till 29th)
2015/12/01 20:07:30
I'd argue we just don't need to care about the per
|
| +} |
| + |
| +} // namespace headless |