mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibWebView+UI: Migrate Ladybird's command line flags to LibWebView
Currently, if we want to add a new e.g. WebContent command line option, we have to add it to all of Qt, AppKit, and headless-browser. (Or worse, we only add it to one of these, and we have feature disparity). To prevent this, this moves command line flags to WebView::Application. The flags are assigned to ChromeOptions and WebContentOptions structs. Each chrome can still add its platform-specific options; for example, the Qt chrome has a flag to enable Qt networking. There should be no behavior change here, other than that AppKit will now support command line flags that were previously only supported by Qt.
This commit is contained in:
committed by
Andreas Kling
parent
0e640f6f70
commit
5f8d852dae
103
Userland/Libraries/LibWebView/Options.h
Normal file
103
Userland/Libraries/LibWebView/Options.h
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibURL/URL.h>
|
||||
|
||||
namespace WebView {
|
||||
|
||||
enum class NewWindow {
|
||||
No,
|
||||
Yes,
|
||||
};
|
||||
|
||||
enum class ForceNewProcess {
|
||||
No,
|
||||
Yes,
|
||||
};
|
||||
|
||||
enum class AllowPopups {
|
||||
No,
|
||||
Yes,
|
||||
};
|
||||
|
||||
enum class DisableSQLDatabase {
|
||||
No,
|
||||
Yes,
|
||||
};
|
||||
|
||||
struct ChromeOptions {
|
||||
Vector<URL::URL> urls;
|
||||
Vector<ByteString> raw_urls;
|
||||
URL::URL new_tab_page_url;
|
||||
Vector<ByteString> certificates {};
|
||||
NewWindow new_window { NewWindow::No };
|
||||
ForceNewProcess force_new_process { ForceNewProcess::No };
|
||||
AllowPopups allow_popups { AllowPopups::No };
|
||||
DisableSQLDatabase disable_sql_database { DisableSQLDatabase::No };
|
||||
Optional<ByteString> webdriver_content_ipc_path {};
|
||||
};
|
||||
|
||||
enum class EnableCallgrindProfiling {
|
||||
No,
|
||||
Yes,
|
||||
};
|
||||
|
||||
enum class IsLayoutTestMode {
|
||||
No,
|
||||
Yes,
|
||||
};
|
||||
|
||||
enum class UseLagomNetworking {
|
||||
No,
|
||||
Yes,
|
||||
};
|
||||
|
||||
enum class WaitForDebugger {
|
||||
No,
|
||||
Yes,
|
||||
};
|
||||
|
||||
enum class LogAllJSExceptions {
|
||||
No,
|
||||
Yes,
|
||||
};
|
||||
|
||||
enum class EnableIDLTracing {
|
||||
No,
|
||||
Yes,
|
||||
};
|
||||
|
||||
enum class EnableHTTPCache {
|
||||
No,
|
||||
Yes,
|
||||
};
|
||||
|
||||
enum class ExposeInternalsObject {
|
||||
No,
|
||||
Yes,
|
||||
};
|
||||
|
||||
struct WebContentOptions {
|
||||
String command_line;
|
||||
String executable_path;
|
||||
Optional<ByteString> config_path {};
|
||||
EnableCallgrindProfiling enable_callgrind_profiling { EnableCallgrindProfiling::No };
|
||||
IsLayoutTestMode is_layout_test_mode { IsLayoutTestMode::No };
|
||||
UseLagomNetworking use_lagom_networking { UseLagomNetworking::Yes };
|
||||
WaitForDebugger wait_for_debugger { WaitForDebugger::No };
|
||||
LogAllJSExceptions log_all_js_exceptions { LogAllJSExceptions::No };
|
||||
EnableIDLTracing enable_idl_tracing { EnableIDLTracing::No };
|
||||
EnableHTTPCache enable_http_cache { EnableHTTPCache::No };
|
||||
ExposeInternalsObject expose_internals_object { ExposeInternalsObject::No };
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user