LibWebView: Create a dedicated settings observer for the Application

We had a bit of an awkward setup where we want the Application to be a
SettingsObserver, but neither the Settings object nor the Application
itself was fully initialized by the time the observer was created. So
we invented a deferred observer initializer specifically for the
Application.

Instead, let's just create a dedicated observer subclass that is owned
by the Application. We can then create it once we have the singleton
Application appropriately set up.
This commit is contained in:
Timothy Flynn 2025-04-23 12:37:05 -04:00 committed by Tim Flynn
commit 6a6c56aabe
Notes: github-actions[bot] 2025-04-24 00:00:00 +00:00
4 changed files with 65 additions and 90 deletions

View file

@ -26,8 +26,9 @@
namespace WebView {
class Application : public DevTools::DevToolsDelegate
, public SettingsObserver {
struct ApplicationSettingsObserver;
class Application : public DevTools::DevToolsDelegate {
AK_MAKE_NONCOPYABLE(Application);
public:
@ -129,12 +130,10 @@ private:
virtual void stop_listening_for_console_messages(DevTools::TabDescription const&) const override;
virtual void request_console_messages(DevTools::TabDescription const&, i32) const override;
// ^SettingsObserver
virtual void dns_settings_changed() override;
static Application* s_the;
Settings m_settings;
OwnPtr<ApplicationSettingsObserver> m_settings_observer;
BrowserOptions m_browser_options;
WebContentOptions m_web_content_options;
@ -156,6 +155,7 @@ private:
OwnPtr<DevTools::DevToolsServer> m_devtools;
} SWIFT_IMMORTAL_REFERENCE;
}
#define WEB_VIEW_APPLICATION(ApplicationType) \