LibWebView+UI: Rename ChromeOptions to BrowserOptions

This commit is contained in:
Timothy Flynn 2025-03-15 16:56:52 -04:00 committed by Tim Flynn
commit e00c0c176e
Notes: github-actions[bot] 2025-03-15 23:58:57 +00:00
16 changed files with 42 additions and 42 deletions

View file

@ -149,7 +149,7 @@ void Application::initialize(Main::Arguments const& arguments, URL::URL new_tab_
if (debug_process_type == ProcessType::WebContent)
disable_site_isolation = true;
m_chrome_options = {
m_browser_options = {
.urls = sanitize_urls(raw_urls, new_tab_page_url),
.raw_urls = move(raw_urls),
.new_tab_page_url = move(new_tab_page_url),
@ -170,7 +170,7 @@ void Application::initialize(Main::Arguments const& arguments, URL::URL new_tab_
};
if (webdriver_content_ipc_path.has_value())
m_chrome_options.webdriver_content_ipc_path = *webdriver_content_ipc_path;
m_browser_options.webdriver_content_ipc_path = *webdriver_content_ipc_path;
m_web_content_options = {
.command_line = MUST(String::join(' ', arguments.strings)),
@ -188,9 +188,9 @@ void Application::initialize(Main::Arguments const& arguments, URL::URL new_tab_
.paint_viewport_scrollbars = disable_scrollbar_painting ? PaintViewportScrollbars::No : PaintViewportScrollbars::Yes,
};
create_platform_options(m_chrome_options, m_web_content_options);
create_platform_options(m_browser_options, m_web_content_options);
if (m_chrome_options.disable_sql_database == DisableSQLDatabase::No) {
if (m_browser_options.disable_sql_database == DisableSQLDatabase::No) {
m_database = Database::create().release_value_but_fixme_should_propagate_errors();
m_cookie_jar = CookieJar::create(*m_database).release_value_but_fixme_should_propagate_errors();
} else {
@ -225,7 +225,7 @@ ErrorOr<NonnullRefPtr<WebContentClient>> Application::launch_web_content_process
void Application::launch_spare_web_content_process()
{
// Disable spare processes when debugging WebContent. Otherwise, it breaks running `gdb attach -p $(pidof WebContent)`.
if (chrome_options().debug_helper_process == ProcessType::WebContent)
if (browser_options().debug_helper_process == ProcessType::WebContent)
return;
if (m_has_queued_task_to_launch_spare_web_content_process)
@ -293,7 +293,7 @@ ErrorOr<void> Application::launch_image_decoder_server()
ErrorOr<void> Application::launch_devtools_server()
{
VERIFY(!m_devtools);
m_devtools = TRY(DevTools::DevToolsServer::create(*this, m_chrome_options.devtools_port));
m_devtools = TRY(DevTools::DevToolsServer::create(*this, m_browser_options.devtools_port));
return {};
}

View file

@ -35,7 +35,7 @@ public:
static Application& the() { return *s_the; }
static ChromeOptions const& chrome_options() { return the().m_chrome_options; }
static BrowserOptions const& browser_options() { return the().m_browser_options; }
static WebContentOptions& web_content_options() { return the().m_web_content_options; }
static Requests::RequestClient& request_server_client() { return *the().m_request_server_client; }
@ -84,7 +84,7 @@ protected:
virtual void process_did_exit(Process&&);
virtual void create_platform_arguments(Core::ArgsParser&) { }
virtual void create_platform_options(ChromeOptions&, WebContentOptions&) { }
virtual void create_platform_options(BrowserOptions&, WebContentOptions&) { }
virtual Optional<ByteString> ask_user_for_download_folder() const { return {}; }
@ -127,7 +127,7 @@ private:
static Application* s_the;
ChromeOptions m_chrome_options;
BrowserOptions m_browser_options;
WebContentOptions m_web_content_options;
RefPtr<Requests::RequestClient> m_request_server_client;

View file

@ -118,13 +118,13 @@ void UIProcessConnectionFromClient::die()
void UIProcessConnectionFromClient::create_new_tab(Vector<ByteString> urls)
{
if (on_new_tab)
on_new_tab(sanitize_urls(urls, Application::chrome_options().new_tab_page_url));
on_new_tab(sanitize_urls(urls, Application::browser_options().new_tab_page_url));
}
void UIProcessConnectionFromClient::create_new_window(Vector<ByteString> urls)
{
if (on_new_window)
on_new_window(sanitize_urls(urls, Application::chrome_options().new_tab_page_url));
on_new_window(sanitize_urls(urls, Application::browser_options().new_tab_page_url));
}
}

View file

@ -19,11 +19,11 @@ static ErrorOr<NonnullRefPtr<ClientType>> launch_server_process(
ClientArguments&&... client_arguments)
{
auto process_type = WebView::process_type_from_name(server_name);
auto const& chrome_options = WebView::Application::chrome_options();
auto const& browser_options = WebView::Application::browser_options();
auto candidate_server_paths = TRY(get_paths_for_helper_process(server_name));
if (chrome_options.profile_helper_process == process_type) {
if (browser_options.profile_helper_process == process_type) {
arguments.prepend({
"--tool=callgrind"sv,
"--instr-atstart=no"sv,
@ -31,13 +31,13 @@ static ErrorOr<NonnullRefPtr<ClientType>> launch_server_process(
});
}
if (chrome_options.debug_helper_process == process_type)
if (browser_options.debug_helper_process == process_type)
arguments.append("--wait-for-debugger"sv);
for (auto [i, path] : enumerate(candidate_server_paths)) {
Core::ProcessSpawnOptions options { .name = server_name, .arguments = arguments };
if (chrome_options.profile_helper_process == process_type) {
if (browser_options.profile_helper_process == process_type) {
options.executable = "valgrind"sv;
options.search_for_executable_in_path = true;
arguments[2] = path;
@ -60,7 +60,7 @@ static ErrorOr<NonnullRefPtr<ClientType>> launch_server_process(
WebView::Application::the().add_child_process(move(process));
if (chrome_options.profile_helper_process == process_type) {
if (browser_options.profile_helper_process == process_type) {
dbgln();
dbgln("\033[1;45mLaunched {} process under callgrind!\033[0m", server_name);
dbgln("\033[100mRun `\033[4mcallgrind_control -i on\033[24m` to start instrumentation and `\033[4mcallgrind_control -i off\033[24m` stop it again.\033[0m");
@ -187,7 +187,7 @@ ErrorOr<NonnullRefPtr<Requests::RequestClient>> launch_request_server_process()
arguments.append(s_ladybird_resource_root);
}
for (auto const& certificate : WebView::Application::chrome_options().certificates)
for (auto const& certificate : WebView::Application::browser_options().certificates)
arguments.append(ByteString::formatted("--certificate={}", certificate));
if (auto server = mach_server_name(); server.has_value()) {
@ -196,7 +196,7 @@ ErrorOr<NonnullRefPtr<Requests::RequestClient>> launch_request_server_process()
}
auto client = TRY(launch_server_process<Requests::RequestClient>("RequestServer"sv, move(arguments)));
WebView::Application::chrome_options().dns_settings.visit(
WebView::Application::browser_options().dns_settings.visit(
[](WebView::SystemDNS) {},
[&](WebView::DNSOverTLS const& dns_over_tls) {
dbgln("Setting DNS server to {}:{} with TLS", dns_over_tls.server_address, dns_over_tls.port);

View file

@ -59,7 +59,7 @@ using DNSSettings = Variant<SystemDNS, DNSOverTLS, DNSOverUDP>;
constexpr inline u16 default_devtools_port = 6000;
struct ChromeOptions {
struct BrowserOptions {
Vector<URL::URL> urls;
Vector<ByteString> raw_urls;
URL::URL new_tab_page_url;

View file

@ -604,10 +604,10 @@ void ViewImplementation::initialize_client(CreateNewClient create_new_client)
client().async_set_device_pixels_per_css_pixel(m_client_state.page_index, m_device_pixel_ratio);
client().async_set_system_visibility_state(m_client_state.page_index, m_system_visibility_state);
if (auto webdriver_content_ipc_path = Application::chrome_options().webdriver_content_ipc_path; webdriver_content_ipc_path.has_value())
if (auto webdriver_content_ipc_path = Application::browser_options().webdriver_content_ipc_path; webdriver_content_ipc_path.has_value())
client().async_connect_to_webdriver(m_client_state.page_index, *webdriver_content_ipc_path);
if (Application::chrome_options().allow_popups == AllowPopups::Yes)
if (Application::browser_options().allow_popups == AllowPopups::Yes)
client().async_debug_request(m_client_state.page_index, "block-pop-ups"sv, "off"sv);
if (auto const& user_agent_preset = Application::web_content_options().user_agent_preset; user_agent_preset.has_value())