OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_OPTIONS_H_ |
| 6 #define HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_OPTIONS_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/files/file_path.h" |
| 11 #include "base/optional.h" |
| 12 #include "headless/public/headless_browser.h" |
| 13 #include "headless/public/headless_browser_context.h" |
| 14 |
| 15 namespace headless { |
| 16 |
| 17 // Represents options which can be customized for a given BrowserContext. |
| 18 // Provides a fallback to default browser-side options when an option |
| 19 // is not set for a particular BrowserContext. |
| 20 class HeadlessBrowserContextOptions { |
| 21 public: |
| 22 HeadlessBrowserContextOptions(HeadlessBrowserContextOptions&& options); |
| 23 ~HeadlessBrowserContextOptions(); |
| 24 |
| 25 HeadlessBrowserContextOptions& operator=( |
| 26 HeadlessBrowserContextOptions&& options); |
| 27 |
| 28 const std::string& user_agent() const; |
| 29 |
| 30 // See HeadlessBrowser::Options::proxy_server. |
| 31 const net::HostPortPair& proxy_server() const; |
| 32 |
| 33 // See HeadlessBrowser::Options::host_resolver_rules. |
| 34 const std::string& host_resolver_rules() const; |
| 35 |
| 36 const gfx::Size& window_size() const; |
| 37 |
| 38 // See HeadlessBrowser::Options::user_data_dir. |
| 39 const base::FilePath& user_data_dir() const; |
| 40 |
| 41 // Custom network protocol handlers. These can be used to override URL |
| 42 // fetching for different network schemes. |
| 43 const ProtocolHandlerMap& protocol_handlers() const; |
| 44 // Since ProtocolHandlerMap is move-only, this method takes ownership of them. |
| 45 ProtocolHandlerMap TakeProtocolHandlers(); |
| 46 |
| 47 private: |
| 48 friend class HeadlessBrowserContext::Builder; |
| 49 |
| 50 explicit HeadlessBrowserContextOptions(HeadlessBrowser::Options*); |
| 51 |
| 52 HeadlessBrowser::Options* browser_options_; |
| 53 |
| 54 base::Optional<std::string> user_agent_; |
| 55 base::Optional<net::HostPortPair> proxy_server_; |
| 56 base::Optional<std::string> host_resolver_rules_; |
| 57 base::Optional<gfx::Size> window_size_; |
| 58 base::Optional<base::FilePath> user_data_dir_; |
| 59 |
| 60 ProtocolHandlerMap protocol_handlers_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserContextOptions); |
| 63 }; |
| 64 |
| 65 } // namespace headless |
| 66 |
| 67 #endif // HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_OPTIONS_H_ |
OLD | NEW |