LibWeb+LibWebView+WebContent: Introduce a basic about:settings page

This adds a basic settings page to manage persistent Ladybird settings.
As a first pass, this exposes settings for the new tab page URL and the
default search engine.

The way the search engine option works is that once search is enabled,
the user must choose their default search engine; we do not apply any
default automatically. Search remains disabled until this is done.

There are a couple of improvements that we should make here:

* Settings changes are not broadcasted to all open about:settings pages.
  So if two instances are open, and the user changes the search engine
  in one instance, the other instance will have a stale UI.

* Adding an IPC per setting is going to get annoying. It would be nice
  if we can come up with a smaller set of IPCs to send only the relevant
  changed settings.
This commit is contained in:
Timothy Flynn 2025-03-21 09:18:02 -04:00 committed by Alexander Kalenik
parent e084a86861
commit b169a98495
Notes: github-actions[bot] 2025-03-22 16:28:49 +00:00
16 changed files with 475 additions and 2 deletions

View file

@ -61,6 +61,7 @@
#include <LibWeb/Infra/CharacterTypes.h>
#include <LibWeb/Internals/Internals.h>
#include <LibWeb/Internals/Processes.h>
#include <LibWeb/Internals/Settings.h>
#include <LibWeb/Layout/Viewport.h>
#include <LibWeb/Page/Page.h>
#include <LibWeb/Painting/PaintableBox.h>
@ -738,9 +739,10 @@ WebIDL::ExceptionOr<void> Window::initialize_web_interfaces(Badge<WindowEnvironm
if (url.scheme() == "about"sv && url.paths().size() == 1) {
auto const& path = url.paths().first();
if (path == "processes"sv) {
if (path == "processes"sv)
define_direct_property("processes", realm.create<Internals::Processes>(realm), JS::default_attributes);
}
else if (path == "settings"sv)
define_direct_property("settings", realm.create<Internals::Settings>(realm), JS::default_attributes);
}
return {};