| OLD | NEW | 
|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_OPTIONS_H_ | 5 #ifndef HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_OPTIONS_H_ | 
| 6 #define HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_OPTIONS_H_ | 6 #define HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_OPTIONS_H_ | 
| 7 | 7 | 
| 8 #include <string> | 8 #include <string> | 
| 9 | 9 | 
| 10 #include "base/callback.h" | 10 #include "base/callback.h" | 
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" | 
| 12 #include "base/optional.h" | 12 #include "base/optional.h" | 
| 13 #include "headless/public/headless_browser.h" | 13 #include "headless/public/headless_browser.h" | 
| 14 #include "headless/public/headless_browser_context.h" | 14 #include "headless/public/headless_browser_context.h" | 
| 15 | 15 | 
| 16 namespace headless { | 16 namespace headless { | 
| 17 | 17 | 
| 18 // Represents options which can be customized for a given BrowserContext. | 18 // Represents options which can be customized for a given BrowserContext. | 
| 19 // Provides a fallback to default browser-side options when an option | 19 // Provides a fallback to default browser-side options when an option | 
| 20 // is not set for a particular BrowserContext. | 20 // is not set for a particular BrowserContext. | 
| 21 class HeadlessBrowserContextOptions { | 21 class HeadlessBrowserContextOptions { | 
| 22  public: | 22  public: | 
| 23   HeadlessBrowserContextOptions(HeadlessBrowserContextOptions&& options); | 23   HeadlessBrowserContextOptions(HeadlessBrowserContextOptions&& options); | 
| 24   ~HeadlessBrowserContextOptions(); | 24   ~HeadlessBrowserContextOptions(); | 
| 25 | 25 | 
| 26   HeadlessBrowserContextOptions& operator=( | 26   HeadlessBrowserContextOptions& operator=( | 
| 27       HeadlessBrowserContextOptions&& options); | 27       HeadlessBrowserContextOptions&& options); | 
| 28 | 28 | 
|  | 29   const std::string& product_name_and_version() const; | 
| 29   const std::string& user_agent() const; | 30   const std::string& user_agent() const; | 
| 30 | 31 | 
| 31   // See HeadlessBrowser::Options::proxy_server. | 32   // See HeadlessBrowser::Options::proxy_server. | 
| 32   const net::HostPortPair& proxy_server() const; | 33   const net::HostPortPair& proxy_server() const; | 
| 33 | 34 | 
| 34   // See HeadlessBrowser::Options::host_resolver_rules. | 35   // See HeadlessBrowser::Options::host_resolver_rules. | 
| 35   const std::string& host_resolver_rules() const; | 36   const std::string& host_resolver_rules() const; | 
| 36 | 37 | 
| 37   const gfx::Size& window_size() const; | 38   const gfx::Size& window_size() const; | 
| 38 | 39 | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 53   const base::Callback<void(WebPreferences*)>& | 54   const base::Callback<void(WebPreferences*)>& | 
| 54   override_web_preferences_callback() const; | 55   override_web_preferences_callback() const; | 
| 55 | 56 | 
| 56  private: | 57  private: | 
| 57   friend class HeadlessBrowserContext::Builder; | 58   friend class HeadlessBrowserContext::Builder; | 
| 58 | 59 | 
| 59   explicit HeadlessBrowserContextOptions(HeadlessBrowser::Options*); | 60   explicit HeadlessBrowserContextOptions(HeadlessBrowser::Options*); | 
| 60 | 61 | 
| 61   HeadlessBrowser::Options* browser_options_; | 62   HeadlessBrowser::Options* browser_options_; | 
| 62 | 63 | 
|  | 64   base::Optional<std::string> product_name_and_version_; | 
| 63   base::Optional<std::string> user_agent_; | 65   base::Optional<std::string> user_agent_; | 
| 64   base::Optional<net::HostPortPair> proxy_server_; | 66   base::Optional<net::HostPortPair> proxy_server_; | 
| 65   base::Optional<std::string> host_resolver_rules_; | 67   base::Optional<std::string> host_resolver_rules_; | 
| 66   base::Optional<gfx::Size> window_size_; | 68   base::Optional<gfx::Size> window_size_; | 
| 67   base::Optional<base::FilePath> user_data_dir_; | 69   base::Optional<base::FilePath> user_data_dir_; | 
| 68   base::Optional<bool> incognito_mode_; | 70   base::Optional<bool> incognito_mode_; | 
| 69   base::Optional<base::Callback<void(WebPreferences*)>> | 71   base::Optional<base::Callback<void(WebPreferences*)>> | 
| 70       override_web_preferences_callback_; | 72       override_web_preferences_callback_; | 
| 71 | 73 | 
| 72   ProtocolHandlerMap protocol_handlers_; | 74   ProtocolHandlerMap protocol_handlers_; | 
| 73 | 75 | 
| 74   DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserContextOptions); | 76   DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserContextOptions); | 
| 75 }; | 77 }; | 
| 76 | 78 | 
| 77 }  // namespace headless | 79 }  // namespace headless | 
| 78 | 80 | 
| 79 #endif  // HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_OPTIONS_H_ | 81 #endif  // HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_OPTIONS_H_ | 
| OLD | NEW | 
|---|