refactor setting providers; include content blocking settings;

This commit is contained in:
Fabian Freund
2025-08-23 06:30:25 +02:00
parent 7a89c622dc
commit ce657dd26a
53 changed files with 958 additions and 404 deletions
@@ -536,6 +536,25 @@ enum TrackingProtectionPolicy { none, recommended, strict, custom }
enum HttpsOnlyMode { disabled, privateOnly, enabled }
enum QueryParameterStripping { disabled, privateOnly, enabled }
enum BounceTrackingProtectionMode {
/// Fully disabled.
disabled,
/// Fully enabled.
enabled,
/// Disabled, but collects user interaction data. Use this mode as the
/// "disabled" state when the feature can be toggled on and off, e.g. via
/// preferences.
enabledStandby,
/// Feature enabled, but tracker purging is only simulated. Used for
/// testing and telemetry collection.
enabledDryRun,
}
enum ColorScheme { system, light, dark }
enum CookieBannerHandlingMode { disabled, rejectAll, rejectOrAcceptAll }
@@ -546,6 +565,20 @@ enum WebContentIsolationStrategy {
isolateHighValue,
}
class ContentBlocking {
QueryParameterStripping queryParameterStripping;
String queryParameterStrippingAllowList;
String queryParameterStrippingStripList;
BounceTrackingProtectionMode bounceTrackingProtectionMode;
ContentBlocking(
this.queryParameterStripping,
this.queryParameterStrippingAllowList,
this.queryParameterStrippingStripList,
this.bounceTrackingProtectionMode,
);
}
class GeckoEngineSettings {
final bool? javascriptEnabled;
final TrackingProtectionPolicy? trackingProtectionPolicy;
@@ -558,6 +591,7 @@ class GeckoEngineSettings {
final bool? cookieBannerHandlingGlobalRulesSubFrames;
final WebContentIsolationStrategy? webContentIsolationStrategy;
final String? userAgent;
final ContentBlocking? contentBlocking;
GeckoEngineSettings(
this.javascriptEnabled,
@@ -571,6 +605,7 @@ class GeckoEngineSettings {
this.cookieBannerHandlingGlobalRulesSubFrames,
this.webContentIsolationStrategy,
this.userAgent,
this.contentBlocking,
);
}
@@ -748,7 +783,7 @@ enum LogLevel { debug, info, warn, error }
)
@HostApi()
abstract class GeckoBrowserApi {
void initialize(LogLevel logLevel);
void initialize(LogLevel logLevel, ContentBlocking contentBlocking);
bool showNativeFragment();
void onTrimMemory(int level);
}