mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 15:49:11 +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:
parent
0e640f6f70
commit
5f8d852dae
Notes:
github-actions[bot]
2024-08-01 09:39:41 +00:00
Author: https://github.com/trflynn89
Commit: 5f8d852dae
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/910
Reviewed-by: https://github.com/ADKaster
35 changed files with 427 additions and 440 deletions
|
@ -9,7 +9,9 @@
|
|||
#include <LibCore/StandardPaths.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibIPC/ConnectionToServer.h>
|
||||
#include <LibWebView/Application.h>
|
||||
#include <LibWebView/ChromeProcess.h>
|
||||
#include <LibWebView/URL.h>
|
||||
|
||||
namespace WebView {
|
||||
|
||||
|
@ -32,7 +34,7 @@ ErrorOr<ChromeProcess> ChromeProcess::create()
|
|||
return ChromeProcess {};
|
||||
}
|
||||
|
||||
ErrorOr<ChromeProcess::ProcessDisposition> ChromeProcess::connect(Vector<ByteString> const& raw_urls, bool new_window)
|
||||
ErrorOr<ChromeProcess::ProcessDisposition> ChromeProcess::connect(Vector<ByteString> const& raw_urls, NewWindow new_window)
|
||||
{
|
||||
static constexpr auto process_name = "Ladybird"sv;
|
||||
|
||||
|
@ -52,12 +54,12 @@ ErrorOr<ChromeProcess::ProcessDisposition> ChromeProcess::connect(Vector<ByteStr
|
|||
return ProcessDisposition::ContinueMainProcess;
|
||||
}
|
||||
|
||||
ErrorOr<void> ChromeProcess::connect_as_client(ByteString const& socket_path, Vector<ByteString> const& raw_urls, bool new_window)
|
||||
ErrorOr<void> ChromeProcess::connect_as_client(ByteString const& socket_path, Vector<ByteString> const& raw_urls, NewWindow new_window)
|
||||
{
|
||||
auto socket = TRY(Core::LocalSocket::connect(socket_path));
|
||||
auto client = UIProcessClient::construct(move(socket));
|
||||
|
||||
if (new_window) {
|
||||
if (new_window == NewWindow::Yes) {
|
||||
if (!client->send_sync_but_allow_failure<Messages::UIProcessServer::CreateNewWindow>(raw_urls))
|
||||
dbgln("Failed to send CreateNewWindow message to UIProcess");
|
||||
} else {
|
||||
|
@ -121,13 +123,13 @@ void UIProcessConnectionFromClient::die()
|
|||
void UIProcessConnectionFromClient::create_new_tab(Vector<ByteString> const& urls)
|
||||
{
|
||||
if (on_new_tab)
|
||||
on_new_tab(urls);
|
||||
on_new_tab(sanitize_urls(urls, Application::chrome_options().new_tab_page_url));
|
||||
}
|
||||
|
||||
void UIProcessConnectionFromClient::create_new_window(Vector<ByteString> const& urls)
|
||||
{
|
||||
if (on_new_window)
|
||||
on_new_window(urls);
|
||||
on_new_window(sanitize_urls(urls, Application::chrome_options().new_tab_page_url));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue