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/files/file_path.h" | 11 #include "base/files/file_path.h" |
11 #include "base/optional.h" | 12 #include "base/optional.h" |
12 #include "headless/public/headless_browser.h" | 13 #include "headless/public/headless_browser.h" |
13 #include "headless/public/headless_browser_context.h" | 14 #include "headless/public/headless_browser_context.h" |
14 | 15 |
15 namespace headless { | 16 namespace headless { |
16 | 17 |
17 // Represents options which can be customized for a given BrowserContext. | 18 // Represents options which can be customized for a given BrowserContext. |
18 // Provides a fallback to default browser-side options when an option | 19 // Provides a fallback to default browser-side options when an option |
19 // is not set for a particular BrowserContext. | 20 // is not set for a particular BrowserContext. |
(...skipping 20 matching lines...) Expand all Loading... |
40 | 41 |
41 // Set HeadlessBrowser::Options::incognito_mode. | 42 // Set HeadlessBrowser::Options::incognito_mode. |
42 bool incognito_mode() const; | 43 bool incognito_mode() const; |
43 | 44 |
44 // Custom network protocol handlers. These can be used to override URL | 45 // Custom network protocol handlers. These can be used to override URL |
45 // fetching for different network schemes. | 46 // fetching for different network schemes. |
46 const ProtocolHandlerMap& protocol_handlers() const; | 47 const ProtocolHandlerMap& protocol_handlers() const; |
47 // Since ProtocolHandlerMap is move-only, this method takes ownership of them. | 48 // Since ProtocolHandlerMap is move-only, this method takes ownership of them. |
48 ProtocolHandlerMap TakeProtocolHandlers(); | 49 ProtocolHandlerMap TakeProtocolHandlers(); |
49 | 50 |
| 51 // Callback that is invoked to override WebPreferences for RenderViews |
| 52 // created within this HeadlessBrowserContext. |
| 53 const base::Callback<void(WebPreferences*)>& |
| 54 override_web_preferences_callback() const; |
| 55 |
50 private: | 56 private: |
51 friend class HeadlessBrowserContext::Builder; | 57 friend class HeadlessBrowserContext::Builder; |
52 | 58 |
53 explicit HeadlessBrowserContextOptions(HeadlessBrowser::Options*); | 59 explicit HeadlessBrowserContextOptions(HeadlessBrowser::Options*); |
54 | 60 |
55 HeadlessBrowser::Options* browser_options_; | 61 HeadlessBrowser::Options* browser_options_; |
56 | 62 |
57 base::Optional<std::string> user_agent_; | 63 base::Optional<std::string> user_agent_; |
58 base::Optional<net::HostPortPair> proxy_server_; | 64 base::Optional<net::HostPortPair> proxy_server_; |
59 base::Optional<std::string> host_resolver_rules_; | 65 base::Optional<std::string> host_resolver_rules_; |
60 base::Optional<gfx::Size> window_size_; | 66 base::Optional<gfx::Size> window_size_; |
61 base::Optional<base::FilePath> user_data_dir_; | 67 base::Optional<base::FilePath> user_data_dir_; |
62 base::Optional<bool> incognito_mode_; | 68 base::Optional<bool> incognito_mode_; |
63 | 69 |
64 ProtocolHandlerMap protocol_handlers_; | 70 ProtocolHandlerMap protocol_handlers_; |
| 71 base::Callback<void(WebPreferences*)> override_web_preferences_callback_; |
65 | 72 |
66 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserContextOptions); | 73 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserContextOptions); |
67 }; | 74 }; |
68 | 75 |
69 } // namespace headless | 76 } // namespace headless |
70 | 77 |
71 #endif // HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_OPTIONS_H_ | 78 #endif // HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_OPTIONS_H_ |
OLD | NEW |