mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 19:45:12 +00:00
LibWebView+UI: Rename ChromeProcess to BrowserProcess
This commit is contained in:
parent
e00c0c176e
commit
47d6747945
Notes:
github-actions[bot]
2025-03-15 23:58:52 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/47d67479452 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3959 Reviewed-by: https://github.com/awesomekling ✅
5 changed files with 23 additions and 23 deletions
|
@ -10,7 +10,7 @@
|
|||
#include <LibCore/System.h>
|
||||
#include <LibIPC/ConnectionToServer.h>
|
||||
#include <LibWebView/Application.h>
|
||||
#include <LibWebView/ChromeProcess.h>
|
||||
#include <LibWebView/BrowserProcess.h>
|
||||
#include <LibWebView/URL.h>
|
||||
|
||||
namespace WebView {
|
||||
|
@ -25,7 +25,7 @@ private:
|
|||
explicit UIProcessClient(IPC::Transport);
|
||||
};
|
||||
|
||||
ErrorOr<ChromeProcess::ProcessDisposition> ChromeProcess::connect(Vector<ByteString> const& raw_urls, NewWindow new_window)
|
||||
ErrorOr<BrowserProcess::ProcessDisposition> BrowserProcess::connect(Vector<ByteString> const& raw_urls, NewWindow new_window)
|
||||
{
|
||||
static constexpr auto process_name = "Ladybird"sv;
|
||||
|
||||
|
@ -45,7 +45,7 @@ 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, NewWindow new_window)
|
||||
ErrorOr<void> BrowserProcess::connect_as_client(ByteString const& socket_path, Vector<ByteString> const& raw_urls, NewWindow new_window)
|
||||
{
|
||||
auto socket = TRY(Core::LocalSocket::connect(socket_path));
|
||||
static_assert(IsSame<IPC::Transport, IPC::TransportSocket>, "Need to handle other IPC transports here");
|
||||
|
@ -62,7 +62,7 @@ ErrorOr<void> ChromeProcess::connect_as_client(ByteString const& socket_path, Ve
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> ChromeProcess::connect_as_server(ByteString const& socket_path)
|
||||
ErrorOr<void> BrowserProcess::connect_as_server(ByteString const& socket_path)
|
||||
{
|
||||
static_assert(IsSame<IPC::Transport, IPC::TransportSocket>, "Need to handle other IPC transports here");
|
||||
|
||||
|
@ -88,7 +88,7 @@ ErrorOr<void> ChromeProcess::connect_as_server(ByteString const& socket_path)
|
|||
return {};
|
||||
}
|
||||
|
||||
ChromeProcess::~ChromeProcess()
|
||||
BrowserProcess::~BrowserProcess()
|
||||
{
|
||||
if (m_pid_file) {
|
||||
MUST(m_pid_file->truncate(0));
|
|
@ -38,9 +38,9 @@ private:
|
|||
virtual void create_new_window(Vector<ByteString> urls) override;
|
||||
};
|
||||
|
||||
class ChromeProcess {
|
||||
AK_MAKE_NONCOPYABLE(ChromeProcess);
|
||||
AK_MAKE_DEFAULT_MOVABLE(ChromeProcess);
|
||||
class BrowserProcess {
|
||||
AK_MAKE_NONCOPYABLE(BrowserProcess);
|
||||
AK_MAKE_DEFAULT_MOVABLE(BrowserProcess);
|
||||
|
||||
public:
|
||||
enum class ProcessDisposition : u8 {
|
||||
|
@ -48,8 +48,8 @@ public:
|
|||
ExitProcess,
|
||||
};
|
||||
|
||||
ChromeProcess() = default;
|
||||
~ChromeProcess();
|
||||
BrowserProcess() = default;
|
||||
~BrowserProcess();
|
||||
|
||||
ErrorOr<ProcessDisposition> connect(Vector<ByteString> const& raw_urls, NewWindow new_window);
|
||||
|
|
@ -3,7 +3,7 @@ include(fontconfig)
|
|||
set(SOURCES
|
||||
Application.cpp
|
||||
Attribute.cpp
|
||||
ChromeProcess.cpp
|
||||
BrowserProcess.cpp
|
||||
ConsoleOutput.cpp
|
||||
CookieJar.cpp
|
||||
Database.cpp
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <LibMain/Main.h>
|
||||
#include <LibURL/Parser.h>
|
||||
#include <LibWebView/Application.h>
|
||||
#include <LibWebView/ChromeProcess.h>
|
||||
#include <LibWebView/BrowserProcess.h>
|
||||
#include <LibWebView/EventLoop/EventLoopImplementationMacOS.h>
|
||||
#include <LibWebView/MachPortServer.h>
|
||||
#include <LibWebView/URL.h>
|
||||
|
@ -56,22 +56,22 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
WebView::platform_init();
|
||||
|
||||
WebView::ChromeProcess chrome_process;
|
||||
WebView::BrowserProcess browser_process;
|
||||
|
||||
if (auto const& browser_options = WebView::Application::browser_options(); browser_options.force_new_process == WebView::ForceNewProcess::No) {
|
||||
auto disposition = TRY(chrome_process.connect(browser_options.raw_urls, browser_options.new_window));
|
||||
auto disposition = TRY(browser_process.connect(browser_options.raw_urls, browser_options.new_window));
|
||||
|
||||
if (disposition == WebView::ChromeProcess::ProcessDisposition::ExitProcess) {
|
||||
if (disposition == WebView::BrowserProcess::ProcessDisposition::ExitProcess) {
|
||||
outln("Opening in existing process");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
chrome_process.on_new_tab = [&](auto const& raw_urls) {
|
||||
browser_process.on_new_tab = [&](auto const& raw_urls) {
|
||||
open_urls_from_client(raw_urls, WebView::NewWindow::No);
|
||||
};
|
||||
|
||||
chrome_process.on_new_window = [&](auto const& raw_urls) {
|
||||
browser_process.on_new_window = [&](auto const& raw_urls) {
|
||||
open_urls_from_client(raw_urls, WebView::NewWindow::Yes);
|
||||
};
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <LibGfx/Font/FontDatabase.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <LibWebView/Application.h>
|
||||
#include <LibWebView/ChromeProcess.h>
|
||||
#include <LibWebView/BrowserProcess.h>
|
||||
#include <LibWebView/EventLoop/EventLoopImplementationQt.h>
|
||||
#include <LibWebView/HelperProcess.h>
|
||||
#include <LibWebView/ProcessManager.h>
|
||||
|
@ -82,18 +82,18 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
WebView::platform_init();
|
||||
|
||||
WebView::ChromeProcess chrome_process;
|
||||
WebView::BrowserProcess browser_process;
|
||||
|
||||
if (app->browser_options().force_new_process == WebView::ForceNewProcess::No) {
|
||||
auto disposition = TRY(chrome_process.connect(app->browser_options().raw_urls, app->browser_options().new_window));
|
||||
auto disposition = TRY(browser_process.connect(app->browser_options().raw_urls, app->browser_options().new_window));
|
||||
|
||||
if (disposition == WebView::ChromeProcess::ProcessDisposition::ExitProcess) {
|
||||
if (disposition == WebView::BrowserProcess::ProcessDisposition::ExitProcess) {
|
||||
outln("Opening in existing process");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
chrome_process.on_new_tab = [&](auto const& urls) {
|
||||
browser_process.on_new_tab = [&](auto const& urls) {
|
||||
auto& window = app->active_window();
|
||||
for (size_t i = 0; i < urls.size(); ++i) {
|
||||
window.new_tab_from_url(urls[i], (i == 0) ? Web::HTML::ActivateTab::Yes : Web::HTML::ActivateTab::No);
|
||||
|
@ -125,7 +125,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
TRY(app->launch_services());
|
||||
|
||||
chrome_process.on_new_window = [&](auto const& urls) {
|
||||
browser_process.on_new_window = [&](auto const& urls) {
|
||||
app->new_window(urls);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue