Options.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. * Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/ByteString.h>
  8. #include <AK/Optional.h>
  9. #include <AK/String.h>
  10. #include <AK/Vector.h>
  11. #include <LibURL/URL.h>
  12. #include <LibWebView/ProcessType.h>
  13. namespace WebView {
  14. enum class NewWindow {
  15. No,
  16. Yes,
  17. };
  18. enum class ForceNewProcess {
  19. No,
  20. Yes,
  21. };
  22. enum class AllowPopups {
  23. No,
  24. Yes,
  25. };
  26. enum class DisableScripting {
  27. No,
  28. Yes,
  29. };
  30. enum class DisableSQLDatabase {
  31. No,
  32. Yes,
  33. };
  34. enum class EnableAutoplay {
  35. No,
  36. Yes,
  37. };
  38. struct SystemDNS { };
  39. struct DNSOverTLS {
  40. ByteString server_address;
  41. u16 port;
  42. };
  43. struct DNSOverUDP {
  44. ByteString server_address;
  45. u16 port;
  46. };
  47. using DNSSettings = Variant<SystemDNS, DNSOverTLS, DNSOverUDP>;
  48. struct ChromeOptions {
  49. Vector<URL::URL> urls;
  50. Vector<ByteString> raw_urls;
  51. URL::URL new_tab_page_url;
  52. Vector<ByteString> certificates {};
  53. NewWindow new_window { NewWindow::No };
  54. ForceNewProcess force_new_process { ForceNewProcess::No };
  55. AllowPopups allow_popups { AllowPopups::No };
  56. DisableScripting disable_scripting { DisableScripting::No };
  57. DisableSQLDatabase disable_sql_database { DisableSQLDatabase::No };
  58. Optional<ProcessType> debug_helper_process {};
  59. Optional<ProcessType> profile_helper_process {};
  60. Optional<ByteString> webdriver_content_ipc_path {};
  61. DNSSettings dns_settings { SystemDNS {} };
  62. };
  63. enum class IsLayoutTestMode {
  64. No,
  65. Yes,
  66. };
  67. enum class LogAllJSExceptions {
  68. No,
  69. Yes,
  70. };
  71. enum class EnableIDLTracing {
  72. No,
  73. Yes,
  74. };
  75. enum class EnableHTTPCache {
  76. No,
  77. Yes,
  78. };
  79. enum class ExposeInternalsObject {
  80. No,
  81. Yes,
  82. };
  83. enum class ForceCPUPainting {
  84. No,
  85. Yes,
  86. };
  87. enum class ForceFontconfig {
  88. No,
  89. Yes,
  90. };
  91. enum class CollectGarbageOnEveryAllocation {
  92. No,
  93. Yes,
  94. };
  95. struct WebContentOptions {
  96. String command_line;
  97. String executable_path;
  98. Optional<ByteString> config_path {};
  99. Optional<StringView> user_agent_preset {};
  100. IsLayoutTestMode is_layout_test_mode { IsLayoutTestMode::No };
  101. LogAllJSExceptions log_all_js_exceptions { LogAllJSExceptions::No };
  102. EnableIDLTracing enable_idl_tracing { EnableIDLTracing::No };
  103. EnableHTTPCache enable_http_cache { EnableHTTPCache::No };
  104. ExposeInternalsObject expose_internals_object { ExposeInternalsObject::No };
  105. ForceCPUPainting force_cpu_painting { ForceCPUPainting::No };
  106. ForceFontconfig force_fontconfig { ForceFontconfig::No };
  107. EnableAutoplay enable_autoplay { EnableAutoplay::No };
  108. CollectGarbageOnEveryAllocation collect_garbage_on_every_allocation { CollectGarbageOnEveryAllocation::No };
  109. Optional<u16> echo_server_port {};
  110. };
  111. }