| 
									
										
										
										
											2023-08-01 14:39:19 -06:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-30 14:01:05 -04:00
										 |  |  | #include <AK/ByteString.h>
 | 
					
						
							|  |  |  | #include <AK/Optional.h>
 | 
					
						
							| 
									
										
										
										
											2024-01-16 18:55:40 +01:00
										 |  |  | #include <AK/String.h>
 | 
					
						
							| 
									
										
										
										
											2024-07-30 14:01:05 -04:00
										 |  |  | #include <AK/Vector.h>
 | 
					
						
							|  |  |  | #include <LibURL/URL.h>
 | 
					
						
							| 
									
										
										
										
											2024-08-01 07:03:03 -04:00
										 |  |  | #include <LibWebView/ProcessType.h>
 | 
					
						
							| 
									
										
										
										
											2024-01-16 18:55:40 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-30 14:01:05 -04:00
										 |  |  | namespace WebView { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-06 15:42:12 -04:00
										 |  |  | enum class HeadlessMode { | 
					
						
							|  |  |  |     Screenshot, | 
					
						
							|  |  |  |     LayoutTree, | 
					
						
							|  |  |  |     Text, | 
					
						
							|  |  |  |     Test, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-30 14:01:05 -04:00
										 |  |  | enum class NewWindow { | 
					
						
							|  |  |  |     No, | 
					
						
							|  |  |  |     Yes, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | enum class ForceNewProcess { | 
					
						
							|  |  |  |     No, | 
					
						
							|  |  |  |     Yes, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | enum class AllowPopups { | 
					
						
							|  |  |  |     No, | 
					
						
							|  |  |  |     Yes, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-04 07:13:40 +01:00
										 |  |  | enum class DisableScripting { | 
					
						
							|  |  |  |     No, | 
					
						
							|  |  |  |     Yes, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-30 14:01:05 -04:00
										 |  |  | enum class DisableSQLDatabase { | 
					
						
							|  |  |  |     No, | 
					
						
							|  |  |  |     Yes, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-22 23:12:36 +01:00
										 |  |  | enum class EnableAutoplay { | 
					
						
							|  |  |  |     No, | 
					
						
							|  |  |  |     Yes, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-01 23:53:43 +01:00
										 |  |  | struct SystemDNS { }; | 
					
						
							|  |  |  | struct DNSOverTLS { | 
					
						
							|  |  |  |     ByteString server_address; | 
					
						
							|  |  |  |     u16 port; | 
					
						
							| 
									
										
										
										
											2025-05-13 12:34:55 +02:00
										 |  |  |     bool validate_dnssec_locally; | 
					
						
							| 
									
										
										
										
											2024-11-01 23:53:43 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | struct DNSOverUDP { | 
					
						
							|  |  |  |     ByteString server_address; | 
					
						
							|  |  |  |     u16 port; | 
					
						
							| 
									
										
										
										
											2025-05-13 12:34:55 +02:00
										 |  |  |     bool validate_dnssec_locally; | 
					
						
							| 
									
										
										
										
											2024-11-01 23:53:43 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | using DNSSettings = Variant<SystemDNS, DNSOverTLS, DNSOverUDP>; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-15 10:09:45 -04:00
										 |  |  | constexpr inline u16 default_devtools_port = 6000; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-15 16:56:52 -04:00
										 |  |  | struct BrowserOptions { | 
					
						
							| 
									
										
										
										
											2024-07-30 14:01:05 -04:00
										 |  |  |     Vector<URL::URL> urls; | 
					
						
							|  |  |  |     Vector<ByteString> raw_urls; | 
					
						
							| 
									
										
										
										
											2025-06-06 15:42:12 -04:00
										 |  |  |     Optional<HeadlessMode> headless_mode; | 
					
						
							|  |  |  |     int window_width { 800 }; | 
					
						
							|  |  |  |     int window_height { 600 }; | 
					
						
							| 
									
										
										
										
											2024-07-30 14:01:05 -04:00
										 |  |  |     NewWindow new_window { NewWindow::No }; | 
					
						
							|  |  |  |     ForceNewProcess force_new_process { ForceNewProcess::No }; | 
					
						
							|  |  |  |     AllowPopups allow_popups { AllowPopups::No }; | 
					
						
							| 
									
										
										
										
											2024-09-04 07:13:40 +01:00
										 |  |  |     DisableScripting disable_scripting { DisableScripting::No }; | 
					
						
							| 
									
										
										
										
											2024-07-30 14:01:05 -04:00
										 |  |  |     DisableSQLDatabase disable_sql_database { DisableSQLDatabase::No }; | 
					
						
							| 
									
										
										
										
											2024-08-01 07:03:03 -04:00
										 |  |  |     Optional<ProcessType> debug_helper_process {}; | 
					
						
							| 
									
										
										
										
											2024-08-01 07:13:09 -04:00
										 |  |  |     Optional<ProcessType> profile_helper_process {}; | 
					
						
							| 
									
										
										
										
											2024-07-30 14:01:05 -04:00
										 |  |  |     Optional<ByteString> webdriver_content_ipc_path {}; | 
					
						
							| 
									
										
										
										
											2025-04-08 03:56:35 +02:00
										 |  |  |     Optional<DNSSettings> dns_settings {}; | 
					
						
							| 
									
										
										
										
											2025-07-02 12:42:53 -04:00
										 |  |  |     Optional<u16> devtools_port; | 
					
						
							| 
									
										
										
										
											2024-07-30 14:01:05 -04:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2023-08-02 11:52:59 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-10-08 21:17:05 -04:00
										 |  |  | enum class EnableHTTPDiskCache { | 
					
						
							|  |  |  |     No, | 
					
						
							|  |  |  |     Yes, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct RequestServerOptions { | 
					
						
							|  |  |  |     Vector<ByteString> certificates; | 
					
						
							|  |  |  |     EnableHTTPDiskCache enable_http_disk_cache { EnableHTTPDiskCache::No }; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-01 12:18:40 -05:00
										 |  |  | enum class IsLayoutTestMode { | 
					
						
							|  |  |  |     No, | 
					
						
							| 
									
										
										
										
											2024-07-30 14:01:05 -04:00
										 |  |  |     Yes, | 
					
						
							| 
									
										
										
										
											2023-12-01 12:18:40 -05:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-16 08:02:41 +02:00
										 |  |  | enum class LogAllJSExceptions { | 
					
						
							|  |  |  |     No, | 
					
						
							| 
									
										
										
										
											2024-07-30 14:01:05 -04:00
										 |  |  |     Yes, | 
					
						
							| 
									
										
										
										
											2024-04-16 08:02:41 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-16 14:39:57 +02:00
										 |  |  | enum class EnableIDLTracing { | 
					
						
							|  |  |  |     No, | 
					
						
							| 
									
										
										
										
											2024-07-30 14:01:05 -04:00
										 |  |  |     Yes, | 
					
						
							| 
									
										
										
										
											2024-04-16 14:39:57 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-22 18:53:11 +02:00
										 |  |  | enum class EnableHTTPCache { | 
					
						
							|  |  |  |     No, | 
					
						
							| 
									
										
										
										
											2024-07-30 14:01:05 -04:00
										 |  |  |     Yes, | 
					
						
							| 
									
										
										
										
											2024-06-22 18:53:11 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-11 19:25:34 -04:00
										 |  |  | enum class DisableSiteIsolation { | 
					
						
							|  |  |  |     No, | 
					
						
							|  |  |  |     Yes, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-21 08:46:38 +12:00
										 |  |  | enum class ExposeInternalsObject { | 
					
						
							|  |  |  |     No, | 
					
						
							| 
									
										
										
										
											2024-07-30 14:01:05 -04:00
										 |  |  |     Yes, | 
					
						
							| 
									
										
										
										
											2024-04-21 08:46:38 +12:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-01 18:49:24 +01:00
										 |  |  | enum class ForceCPUPainting { | 
					
						
							|  |  |  |     No, | 
					
						
							|  |  |  |     Yes, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-19 20:35:49 +02:00
										 |  |  | enum class ForceFontconfig { | 
					
						
							|  |  |  |     No, | 
					
						
							|  |  |  |     Yes, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-31 11:06:01 -04:00
										 |  |  | enum class CollectGarbageOnEveryAllocation { | 
					
						
							|  |  |  |     No, | 
					
						
							|  |  |  |     Yes, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-16 11:23:10 +00:00
										 |  |  | enum class PaintViewportScrollbars { | 
					
						
							|  |  |  |     Yes, | 
					
						
							|  |  |  |     No, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-01 12:18:40 -05:00
										 |  |  | struct WebContentOptions { | 
					
						
							| 
									
										
										
										
											2024-01-16 18:55:40 +01:00
										 |  |  |     String command_line; | 
					
						
							|  |  |  |     String executable_path; | 
					
						
							| 
									
										
										
										
											2024-07-16 18:52:12 +02:00
										 |  |  |     Optional<ByteString> config_path {}; | 
					
						
							| 
									
										
										
										
											2024-08-28 10:26:11 -04:00
										 |  |  |     Optional<StringView> user_agent_preset {}; | 
					
						
							| 
									
										
										
										
											2023-12-01 12:18:40 -05:00
										 |  |  |     IsLayoutTestMode is_layout_test_mode { IsLayoutTestMode::No }; | 
					
						
							| 
									
										
										
										
											2024-04-16 08:02:41 +02:00
										 |  |  |     LogAllJSExceptions log_all_js_exceptions { LogAllJSExceptions::No }; | 
					
						
							| 
									
										
										
										
											2025-03-11 19:25:34 -04:00
										 |  |  |     DisableSiteIsolation disable_site_isolation { DisableSiteIsolation::No }; | 
					
						
							| 
									
										
										
										
											2024-04-16 14:39:57 +02:00
										 |  |  |     EnableIDLTracing enable_idl_tracing { EnableIDLTracing::No }; | 
					
						
							| 
									
										
										
										
											2024-06-22 18:53:11 +02:00
										 |  |  |     EnableHTTPCache enable_http_cache { EnableHTTPCache::No }; | 
					
						
							| 
									
										
										
										
											2024-04-21 08:46:38 +12:00
										 |  |  |     ExposeInternalsObject expose_internals_object { ExposeInternalsObject::No }; | 
					
						
							| 
									
										
										
										
											2024-08-01 18:49:24 +01:00
										 |  |  |     ForceCPUPainting force_cpu_painting { ForceCPUPainting::No }; | 
					
						
							| 
									
										
										
										
											2024-08-19 20:35:49 +02:00
										 |  |  |     ForceFontconfig force_fontconfig { ForceFontconfig::No }; | 
					
						
							| 
									
										
										
										
											2024-09-22 23:12:36 +01:00
										 |  |  |     EnableAutoplay enable_autoplay { EnableAutoplay::No }; | 
					
						
							| 
									
										
										
										
											2024-10-31 11:06:01 -04:00
										 |  |  |     CollectGarbageOnEveryAllocation collect_garbage_on_every_allocation { CollectGarbageOnEveryAllocation::No }; | 
					
						
							| 
									
										
										
										
											2024-12-02 19:33:26 -06:00
										 |  |  |     Optional<u16> echo_server_port {}; | 
					
						
							| 
									
										
										
										
											2024-12-16 11:23:10 +00:00
										 |  |  |     PaintViewportScrollbars paint_viewport_scrollbars { PaintViewportScrollbars::Yes }; | 
					
						
							| 
									
										
										
										
											2023-12-01 12:18:40 -05:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-02 11:52:59 -06:00
										 |  |  | } |