Chromium Code Reviews| Index: headless/lib/browser/headless_browser_context_options.h |
| diff --git a/headless/lib/browser/headless_browser_context_options.h b/headless/lib/browser/headless_browser_context_options.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8d0ca6b198ef88b33e6a854dcad501106df3ff01 |
| --- /dev/null |
| +++ b/headless/lib/browser/headless_browser_context_options.h |
| @@ -0,0 +1,64 @@ |
| +// Copyright 2016 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. |
| + |
| +#ifndef HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_OPTIONS_H_ |
| +#define HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_OPTIONS_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/files/file_path.h" |
| +#include "base/optional.h" |
| +#include "headless/public/headless_browser.h" |
| +#include "headless/public/headless_browser_context.h" |
| + |
| +namespace headless { |
| + |
| +// Represents options which can be customized for a given BrowserContext. |
| +// Provides a fallback to default browser-side options when an option |
| +// is not set for a particular BrowserContext. |
| +class HeadlessBrowserContextOptions { |
| + public: |
| + HeadlessBrowserContextOptions(HeadlessBrowserContextOptions&& options); |
| + ~HeadlessBrowserContextOptions(); |
| + |
| + HeadlessBrowserContextOptions& operator=( |
| + HeadlessBrowserContextOptions&& options); |
| + |
| + const std::string& user_agent() const; |
| + |
| + // See HeadlessBrowser::Options::proxy_server. |
|
Sami
2016/08/03 11:20:30
Since this is an internal implementation class I d
altimin
2016/08/03 11:54:10
I think it's useful to distinguish overridden thin
|
| + const net::HostPortPair& proxy_server() const; |
| + |
| + // See HeadlessBrowser::Options::host_resolver_rules. |
| + const std::string& host_resolver_rules() const; |
| + |
| + // See HeadlessBrowser::Options::user_data_dir. |
| + const base::FilePath& user_data_dir() const; |
| + |
| + // Custom network protocol handlers. These can be used to override URL |
| + // fetching for different network schemes. |
| + const ProtocolHandlerMap& protocol_handlers() const; |
| + // Since ProtocolHandlerMap is move-only, this method takes ownership of them. |
| + ProtocolHandlerMap TakeProtocolHandlers(); |
| + |
| + private: |
| + friend class HeadlessBrowserContext::Builder; |
| + |
| + explicit HeadlessBrowserContextOptions(HeadlessBrowser::Options*); |
| + |
| + HeadlessBrowser::Options* browser_options_; |
| + |
| + base::Optional<std::string> user_agent_; |
| + base::Optional<net::HostPortPair> proxy_server_; |
| + base::Optional<std::string> host_resolver_rules_; |
| + base::Optional<base::FilePath> user_data_dir_; |
| + |
| + ProtocolHandlerMap protocol_handlers_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserContextOptions); |
|
alex clarke (OOO till 29th)
2016/08/03 11:55:19
I wonder if it would be simpler to remove this mac
altimin
2016/08/03 12:46:18
I believe that in this case copy constructor is ge
|
| +}; |
| + |
| +} // namespace headless |
| + |
| +#endif // HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_OPTIONS_H_ |