mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-25 09:30:01 +00:00
This adds a WebView::Settings class to own persistent browser settings.
In this first pass, it now owns the new tab page URL and search engine
settings.
For simplicitly, we currently use a JSON format for these settings. They
are stored alongside the cookie database. As of this commit, the saved
JSON will have the form:
{
"newTabPageURL": "about:blank",
"searchEngine": {
"name": "Google"
}
}
(The search engine is an object to allow room for a future patch to
implement custom search engine URLs.)
For Qt, this replaces the management of these particular settings in the
Qt settings UI. We will have an internal browser page to control these
settings instead. In the future, we will want to port all settings to
this new class. We will also want to allow UI-specific settings (such as
whether the hamburger menu is displayed in Qt).
49 lines
1.5 KiB
Objective-C
49 lines
1.5 KiB
Objective-C
/*
|
|
* Copyright (c) 2023-2025, Tim Flynn <trflynn89@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Optional.h>
|
|
#include <AK/StringView.h>
|
|
#include <LibURL/URL.h>
|
|
#include <LibWeb/CSS/PreferredColorScheme.h>
|
|
#include <LibWeb/CSS/PreferredContrast.h>
|
|
#include <LibWeb/CSS/PreferredMotion.h>
|
|
#include <LibWeb/HTML/ActivateTab.h>
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
@class Tab;
|
|
@class TabController;
|
|
|
|
@interface ApplicationDelegate : NSObject <NSApplicationDelegate>
|
|
|
|
- (nullable instancetype)init;
|
|
|
|
- (nonnull TabController*)createNewTab:(Optional<URL::URL> const&)url
|
|
fromTab:(nullable Tab*)tab
|
|
activateTab:(Web::HTML::ActivateTab)activate_tab;
|
|
|
|
- (nonnull TabController*)createNewTab:(StringView)html
|
|
url:(URL::URL const&)url
|
|
fromTab:(nullable Tab*)tab
|
|
activateTab:(Web::HTML::ActivateTab)activate_tab;
|
|
|
|
- (nonnull TabController*)createChildTab:(Optional<URL::URL> const&)url
|
|
fromTab:(nonnull Tab*)tab
|
|
activateTab:(Web::HTML::ActivateTab)activate_tab
|
|
pageIndex:(u64)page_index;
|
|
|
|
- (void)setActiveTab:(nonnull Tab*)tab;
|
|
- (nullable Tab*)activeTab;
|
|
|
|
- (void)removeTab:(nonnull TabController*)controller;
|
|
|
|
- (Web::CSS::PreferredColorScheme)preferredColorScheme;
|
|
- (Web::CSS::PreferredContrast)preferredContrast;
|
|
- (Web::CSS::PreferredMotion)preferredMotion;
|
|
|
|
@end
|