1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:37:46 +00:00

LibWeb: Abstract the LibProtocol ResourceLoader connection

This is the final component that required LibProtocol as a dependency
of LibWeb. With this, we can now remove the dependency, and LibWeb no
longer requires IPC to work :^)
This commit is contained in:
DexesTTP 2022-04-30 12:06:30 +02:00 committed by Andreas Kling
parent 2a359695c6
commit c00ae53b66
10 changed files with 245 additions and 37 deletions

View file

@ -23,7 +23,6 @@
#include <LibWeb/Loader/ResourceLoader.h>
#include <LibConfig/Client.h>
#include <LibProtocol/RequestClient.h>
namespace Browser {
@ -41,7 +40,7 @@ DownloadWidget::DownloadWidget(const URL& url)
auto close_on_finish = Config::read_bool("Browser", "Preferences", "CloseDownloadWidgetOnFinish", false);
m_elapsed_timer.start();
m_download = Web::ResourceLoader::the().protocol_client().start_request("GET", url);
m_download = Web::ResourceLoader::the().connector().start_request("GET", url);
VERIFY(m_download);
m_download->on_progress = [this](Optional<u32> total_size, u32 downloaded_size) {
did_progress(total_size.value(), downloaded_size);

View file

@ -13,7 +13,7 @@
#include <LibGUI/ImageWidget.h>
#include <LibGUI/Progressbar.h>
#include <LibGUI/Widget.h>
#include <LibProtocol/Request.h>
#include <LibWeb/Loader/ResourceLoader.h>
namespace Browser {
@ -31,7 +31,7 @@ private:
URL m_url;
String m_destination_path;
RefPtr<Protocol::Request> m_download;
RefPtr<Web::ResourceLoaderConnectorRequest> m_download;
RefPtr<GUI::Progressbar> m_progressbar;
RefPtr<GUI::Label> m_progress_label;
RefPtr<GUI::Button> m_cancel_button;

View file

@ -23,6 +23,8 @@
#include <LibGUI/Icon.h>
#include <LibGUI/TabWidget.h>
#include <LibMain/Main.h>
#include <LibWeb/Loader/ResourceLoader.h>
#include <LibWebView/RequestServerAdapter.h>
#include <unistd.h>
namespace Browser {
@ -87,6 +89,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::unveil("/bin/BrowserSettings", "x"));
TRY(Core::System::unveil(nullptr, nullptr));
Web::ResourceLoader::initialize(TRY(WebView::RequestServerAdapter::try_create()));
auto app_icon = GUI::Icon::default_icon("app-browser");
Browser::g_home_url = Config::read_string("Browser", "Preferences", "Home", "file:///res/html/misc/welcome.html");