1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 13:47:35 +00:00

BrowserSettings+Ladybird: Convert home / new tab page to resource URIs

This commit is contained in:
Timothy Flynn 2023-11-05 09:35:20 -05:00 committed by Andreas Kling
parent 1b30b510b9
commit 818471b7a7
6 changed files with 33 additions and 45 deletions

View file

@ -6,16 +6,38 @@
#pragma once
#include <AK/String.h>
#include <AK/StringView.h>
#include <LibCore/Resource.h>
namespace Browser {
static constexpr StringView default_homepage_url = "file:///res/html/misc/welcome.html"sv;
static constexpr StringView default_new_tab_url = "file:///res/html/misc/new-tab.html"sv;
static constexpr StringView default_color_scheme = "auto"sv;
static constexpr bool default_enable_content_filters = true;
static constexpr bool default_show_bookmarks_bar = true;
static constexpr bool default_close_download_widget_on_finish = false;
static constexpr bool default_allow_autoplay_on_all_websites = false;
inline String const& default_homepage_url()
{
// FIXME: Teach LibWeb how to load resource:// URLs, rather than converting to a file:// URL here.
static auto default_homepage_url = []() {
static constexpr auto url = "resource://html/misc/welcome.html"sv;
return MUST(Core::Resource::load_from_uri(url))->file_url();
}();
return default_homepage_url;
}
inline String const& default_new_tab_url()
{
// FIXME: Teach LibWeb how to load resource:// URLs, rather than converting to a file:// URL here.
static auto default_new_tab_url = []() {
static constexpr auto url = "resource://html/misc/new-tab.html"sv;
return MUST(Core::Resource::load_from_uri(url))->file_url();
}();
return default_new_tab_url;
}
}