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
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

@ -0,0 +1,34 @@
/*
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Internals/InternalsBase.h>
namespace Web::Internals {
class Settings final : public InternalsBase {
WEB_PLATFORM_OBJECT(Settings, InternalsBase);
GC_DECLARE_ALLOCATOR(Settings);
public:
virtual ~Settings() override;
void load_current_settings();
void restore_default_settings();
void set_new_tab_page_url(String const& new_tab_page_url);
void load_available_search_engines();
void set_search_engine(Optional<String> const& search_engine);
private:
explicit Settings(JS::Realm&);
virtual void initialize(JS::Realm&) override;
};
}