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/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 // Set HeadlessBrowser::Options::incognito_mode. | 41 // Set HeadlessBrowser::Options::incognito_mode. |
42 bool incognito_mode() const; | 42 bool incognito_mode() const; |
43 | 43 |
44 // Custom network protocol handlers. These can be used to override URL | 44 // Custom network protocol handlers. These can be used to override URL |
45 // fetching for different network schemes. | 45 // fetching for different network schemes. |
46 const ProtocolHandlerMap& protocol_handlers() const; | 46 const ProtocolHandlerMap& protocol_handlers() const; |
47 // Since ProtocolHandlerMap is move-only, this method takes ownership of them. | 47 // Since ProtocolHandlerMap is move-only, this method takes ownership of them. |
48 ProtocolHandlerMap TakeProtocolHandlers(); | 48 ProtocolHandlerMap TakeProtocolHandlers(); |
49 | 49 |
| 50 // Callback that is invoked to override WebPreferences for RenderViews |
| 51 // created within this HeadlessBrowserContext. |
| 52 const std::function<void(WebPreferences*)>& |
| 53 override_web_preferences_callback() const; |
| 54 |
50 private: | 55 private: |
51 friend class HeadlessBrowserContext::Builder; | 56 friend class HeadlessBrowserContext::Builder; |
52 | 57 |
53 explicit HeadlessBrowserContextOptions(HeadlessBrowser::Options*); | 58 explicit HeadlessBrowserContextOptions(HeadlessBrowser::Options*); |
54 | 59 |
55 HeadlessBrowser::Options* browser_options_; | 60 HeadlessBrowser::Options* browser_options_; |
56 | 61 |
57 base::Optional<std::string> user_agent_; | 62 base::Optional<std::string> user_agent_; |
58 base::Optional<net::HostPortPair> proxy_server_; | 63 base::Optional<net::HostPortPair> proxy_server_; |
59 base::Optional<std::string> host_resolver_rules_; | 64 base::Optional<std::string> host_resolver_rules_; |
60 base::Optional<gfx::Size> window_size_; | 65 base::Optional<gfx::Size> window_size_; |
61 base::Optional<base::FilePath> user_data_dir_; | 66 base::Optional<base::FilePath> user_data_dir_; |
62 base::Optional<bool> incognito_mode_; | 67 base::Optional<bool> incognito_mode_; |
63 | 68 |
64 ProtocolHandlerMap protocol_handlers_; | 69 ProtocolHandlerMap protocol_handlers_; |
| 70 std::function<void(WebPreferences*)> override_web_preferences_callback_; |
65 | 71 |
66 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserContextOptions); | 72 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserContextOptions); |
67 }; | 73 }; |
68 | 74 |
69 } // namespace headless | 75 } // namespace headless |
70 | 76 |
71 #endif // HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_OPTIONS_H_ | 77 #endif // HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_OPTIONS_H_ |
OLD | NEW |