From 2559c1c681af6f7d6e609ee144eefb6bc7daa894 Mon Sep 17 00:00:00 2001 From: Fabian Freund Date: Fri, 3 Oct 2025 12:18:02 +0200 Subject: [PATCH] add doh settings --- app/assets/preferences/settings.json | 17 -- app/lib/core/routing/routes.dart | 1 + app/lib/core/routing/routes.g.dart | 25 ++ app/lib/core/routing/routes.settings.dart | 8 + .../services/engine_settings_replication.dart | 3 + .../engine_settings_replication.g.dart | 2 +- .../presentation/screens/doh_settings.dart | 191 +++++++++++++ .../screens/web_engine_settings.dart | 12 + .../user/data/models/engine_settings.dart | 46 ++++ .../user/data/models/engine_settings.g.dart | 76 ++++++ .../domain/repositories/engine_settings.dart | 16 ++ .../repositories/engine_settings.g.dart | 2 +- .../api/GeckoEngineSettingsApiImpl.kt | 25 +- .../components/Core.kt | 2 +- .../pigeons/Gecko.g.kt | 253 ++++++++++------- .../lib/flutter_mozilla_components.dart | 2 + .../services/gecko_engine_settings.dart | 4 + .../lib/src/pigeons/gecko.g.dart | 255 ++++++++++++------ .../pigeons/gecko.dart | 18 ++ 19 files changed, 758 insertions(+), 200 deletions(-) create mode 100644 app/lib/features/settings/presentation/screens/doh_settings.dart diff --git a/app/assets/preferences/settings.json b/app/assets/preferences/settings.json index f5132869..f22eb20d 100644 --- a/app/assets/preferences/settings.json +++ b/app/assets/preferences/settings.json @@ -52,23 +52,6 @@ "DNS": { "description": "Improve DNS and Proxy/SOCKS security", "preferences": { - "network.trr.mode": { - "value": 3, - "title": "Enable DNS over HTTPS", - "requireUserOptIn": true - }, - "network.trr.uri": { - "value": "https://dns.quad9.net/dns-query", - "title": "Use quad9 for Trusted Recursive Resolver (TRR)", - "description": "Quad9 is a privacy-focused DNS resolver that provides malware blocking and security features.", - "requireUserOptIn": true - }, - "network.trr.custom.uri": { - "value": "https://dns.quad9.net/dns-query", - "title": "Use quad9 for custom Trusted Recursive Resolver (TRR)", - "description": "Quad9 is a privacy-focused DNS resolver that provides malware blocking and security features.", - "requireUserOptIn": true - }, "network.dns.native_https_query": { "value": true, "title": "Enable native DNS HTTPS Query", diff --git a/app/lib/core/routing/routes.dart b/app/lib/core/routing/routes.dart index fd04d5e9..b0d9e60e 100644 --- a/app/lib/core/routing/routes.dart +++ b/app/lib/core/routing/routes.dart @@ -42,6 +42,7 @@ import 'package:weblibre/features/onboarding/presentation/onboarding.dart'; import 'package:weblibre/features/settings/presentation/screens/addon_collection.dart'; import 'package:weblibre/features/settings/presentation/screens/bang_settings.dart'; import 'package:weblibre/features/settings/presentation/screens/developer_settings.dart'; +import 'package:weblibre/features/settings/presentation/screens/doh_settings.dart'; import 'package:weblibre/features/settings/presentation/screens/general_settings.dart'; import 'package:weblibre/features/settings/presentation/screens/settings.dart'; import 'package:weblibre/features/settings/presentation/screens/web_engine_hardening.dart'; diff --git a/app/lib/core/routing/routes.g.dart b/app/lib/core/routing/routes.g.dart index bb8352ce..46240340 100644 --- a/app/lib/core/routing/routes.g.dart +++ b/app/lib/core/routing/routes.g.dart @@ -106,6 +106,11 @@ RouteBase get $settingsRoute => GoRouteData.$route( ), ], ), + GoRouteData.$route( + path: 'doh', + name: 'DohSettingsRoute', + factory: $DohSettingsRoute._fromState, + ), ], ), GoRouteData.$route( @@ -254,6 +259,26 @@ mixin $WebEngineHardeningGroupRoute on GoRouteData { void replace(BuildContext context) => context.replace(location); } +mixin $DohSettingsRoute on GoRouteData { + static DohSettingsRoute _fromState(GoRouterState state) => DohSettingsRoute(); + + @override + String get location => GoRouteData.$location('/settings/web_engine/doh'); + + @override + void go(BuildContext context) => context.go(location); + + @override + Future push(BuildContext context) => context.push(location); + + @override + void pushReplacement(BuildContext context) => + context.pushReplacement(location); + + @override + void replace(BuildContext context) => context.replace(location); +} + mixin $DeveloperSettingsRoute on GoRouteData { static DeveloperSettingsRoute _fromState(GoRouterState state) => DeveloperSettingsRoute(); diff --git a/app/lib/core/routing/routes.settings.dart b/app/lib/core/routing/routes.settings.dart index 8f379283..544b15dc 100644 --- a/app/lib/core/routing/routes.settings.dart +++ b/app/lib/core/routing/routes.settings.dart @@ -42,6 +42,7 @@ part of 'routes.dart'; ), ], ), + TypedGoRoute(name: 'DohSettingsRoute', path: 'doh'), ], ), TypedGoRoute( @@ -77,6 +78,13 @@ class BangSettingsRoute extends GoRouteData with $BangSettingsRoute { } } +class DohSettingsRoute extends GoRouteData with $DohSettingsRoute { + @override + Widget build(BuildContext context, GoRouterState state) { + return const DohSettingsScreen(); + } +} + class WebEngineSettingsRoute extends GoRouteData with $WebEngineSettingsRoute { @override Widget build(BuildContext context, GoRouterState state) { diff --git a/app/lib/features/geckoview/features/browser/domain/services/engine_settings_replication.dart b/app/lib/features/geckoview/features/browser/domain/services/engine_settings_replication.dart index 74b31c2c..d7fed9ac 100644 --- a/app/lib/features/geckoview/features/browser/domain/services/engine_settings_replication.dart +++ b/app/lib/features/geckoview/features/browser/domain/services/engine_settings_replication.dart @@ -125,6 +125,9 @@ class EngineSettingsReplicationService if (previous.value?.contentBlocking != settings.contentBlocking) { await _service.contentBlocking(settings.contentBlocking); } + if (previous.value?.dohSettings != settings.dohSettings) { + await _service.dohSettings(settings.dohSettings); + } } else { await _service.setDefaultSettings(settings); initialSettingsSent = true; diff --git a/app/lib/features/geckoview/features/browser/domain/services/engine_settings_replication.g.dart b/app/lib/features/geckoview/features/browser/domain/services/engine_settings_replication.g.dart index 5cf610ef..db69c951 100644 --- a/app/lib/features/geckoview/features/browser/domain/services/engine_settings_replication.g.dart +++ b/app/lib/features/geckoview/features/browser/domain/services/engine_settings_replication.g.dart @@ -44,7 +44,7 @@ final class EngineSettingsReplicationServiceProvider } String _$engineSettingsReplicationServiceHash() => - r'015bd9c923de0c09109d0fd489967f52a35ee944'; + r'0bbc80fe0cff79f9e419ffa8c486d232f9eac2ee'; abstract class _$EngineSettingsReplicationService extends $Notifier { void build(); diff --git a/app/lib/features/settings/presentation/screens/doh_settings.dart b/app/lib/features/settings/presentation/screens/doh_settings.dart new file mode 100644 index 00000000..b32c6f24 --- /dev/null +++ b/app/lib/features/settings/presentation/screens/doh_settings.dart @@ -0,0 +1,191 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_hooks/flutter_hooks.dart'; +import 'package:flutter_material_design_icons/flutter_material_design_icons.dart'; +import 'package:flutter_mozilla_components/flutter_mozilla_components.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:weblibre/features/settings/presentation/controllers/save_settings.dart'; +import 'package:weblibre/features/user/data/models/engine_settings.dart'; +import 'package:weblibre/features/user/domain/repositories/engine_settings.dart'; +import 'package:weblibre/utils/form_validators.dart'; + +class DohSettingsScreen extends HookConsumerWidget { + const DohSettingsScreen(); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final formKey = useMemoized(() => GlobalKey()); + + final dohSettings = ref.watch( + engineSettingsWithDefaultsProvider.select((value) => value.dohSettings), + ); + + final customProviderController = useTextEditingController( + text: BuiltInDohProviders.isBuiltin(dohSettings.dohProviderUrl) + ? null + : dohSettings.dohProviderUrl, + ); + + return Scaffold( + appBar: AppBar(title: const Text('DNS over HTTPS')), + body: SafeArea( + child: ListView( + children: [ + const ListTile( + leading: Icon(MdiIcons.dns), + title: Text('Protection Level'), + subtitle: Text( + 'Domain Name System (DNS) over HTTPS sends your request for a domain name through an encrypted connection, providing a secure DNS and making it harder for others to see which web site you’re about to access.', + ), + ), + RadioGroup( + groupValue: dohSettings.dohSettingsMode, + onChanged: (value) async { + if (value != null) { + await ref + .read(saveEngineSettingsControllerProvider.notifier) + .save( + (currentSettings) => + currentSettings.copyWith.dohSettingsMode(value), + ); + } + }, + child: const RadioListTile.adaptive( + value: DohSettingsMode.geckoDefault, + title: Text('Default Protection'), + subtitle: Text('DoH used only when default DNS fails'), + ), + ), + RadioGroup( + groupValue: dohSettings.dohSettingsMode, + onChanged: (value) async { + if (value != null) { + await ref + .read(saveEngineSettingsControllerProvider.notifier) + .save( + (currentSettings) => + currentSettings.copyWith.dohSettingsMode(value), + ); + } + }, + child: const RadioListTile.adaptive( + value: DohSettingsMode.increased, + title: Text('Increased Protection'), + subtitle: Text('DoH preferred, default DNS as fallback'), + ), + ), + RadioGroup( + groupValue: dohSettings.dohSettingsMode, + onChanged: (value) async { + if (value != null) { + await ref + .read(saveEngineSettingsControllerProvider.notifier) + .save( + (currentSettings) => + currentSettings.copyWith.dohSettingsMode(value), + ); + } + }, + child: const RadioListTile.adaptive( + value: DohSettingsMode.max, + title: Text('Max Protection'), + subtitle: Text('DoH only, no fallback'), + ), + ), + RadioGroup( + groupValue: dohSettings.dohSettingsMode, + onChanged: (value) async { + if (value != null) { + await ref + .read(saveEngineSettingsControllerProvider.notifier) + .save( + (currentSettings) => + currentSettings.copyWith.dohSettingsMode(value), + ); + } + }, + child: const RadioListTile.adaptive( + value: DohSettingsMode.off, + title: Text('Off'), + subtitle: Text('Use your default DNS resolver'), + ), + ), + const ListTile( + leading: Icon(MdiIcons.routerNetwork), + title: Text('DoH Provider'), + ), + RadioGroup( + groupValue: dohSettings.dohProviderUrl, + onChanged: (value) async { + if (value != null) { + await ref + .read(saveEngineSettingsControllerProvider.notifier) + .save( + (currentSettings) => + currentSettings.copyWith.dohProviderUrl(value), + ); + } + }, + child: Column( + children: BuiltInDohProviders.values + .map( + (provider) => RadioListTile.adaptive( + value: provider.url, + title: Text(provider.name), + subtitle: Text(provider.url), + ), + ) + .toList(), + ), + ), + RadioGroup( + groupValue: !BuiltInDohProviders.isBuiltin( + dohSettings.dohProviderUrl, + ), + onChanged: (value) {}, + child: RadioListTile( + value: true, + enabled: false, + title: Column( + children: [ + const Text('Custom'), + Form( + key: formKey, + child: TextFormField( + controller: customProviderController, + keyboardType: TextInputType.url, + validator: (value) { + return validateUrl( + value, + onlyHttpProtocol: true, + eagerParsing: false, + ); + }, + onSaved: (newProvider) async { + if (newProvider != null) { + await ref + .read( + saveEngineSettingsControllerProvider.notifier, + ) + .save( + (currentSettings) => currentSettings.copyWith + .dohProviderUrl(newProvider), + ); + } + }, + onFieldSubmitted: (_) { + if (formKey.currentState?.validate() == true) { + formKey.currentState?.save(); + } + }, + ), + ), + ], + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/app/lib/features/settings/presentation/screens/web_engine_settings.dart b/app/lib/features/settings/presentation/screens/web_engine_settings.dart index e3ae63ac..30d98696 100644 --- a/app/lib/features/settings/presentation/screens/web_engine_settings.dart +++ b/app/lib/features/settings/presentation/screens/web_engine_settings.dart @@ -262,6 +262,18 @@ class WebEngineSettingsScreen extends HookConsumerWidget { ], ), ), + ListTile( + title: const Text('DNS over HTTPS'), + contentPadding: const EdgeInsets.symmetric( + vertical: 8.0, + horizontal: 16.0, + ), + leading: const Icon(MdiIcons.dns), + trailing: const Icon(Icons.chevron_right), + onTap: () async { + await DohSettingsRoute().push(context); + }, + ), Padding( padding: const EdgeInsets.symmetric( horizontal: 16.0, diff --git a/app/lib/features/user/data/models/engine_settings.dart b/app/lib/features/user/data/models/engine_settings.dart index 7af8dbfd..410242de 100644 --- a/app/lib/features/user/data/models/engine_settings.dart +++ b/app/lib/features/user/data/models/engine_settings.dart @@ -27,6 +27,21 @@ import 'package:nullability/nullability.dart'; part 'engine_settings.g.dart'; +enum BuiltInDohProviders { + quad9('Quad9', 'https://dns.quad9.net/dns-query'), + mullvad('Mullvad', 'https://dns.mullvad.net/dns-query'), + adguard('AdGuard', 'https://dns.adguard-dns.com/dns-query'), + ffmuc('Freifunk München', 'https://doh.ffmuc.net/dns-query'); + + final String name; + final String url; + + static bool isBuiltin(String url) => + BuiltInDohProviders.values.any((provider) => provider.url == url); + + const BuiltInDohProviders(this.name, this.url); +} + @CopyWith() @JsonSerializable(includeIfNull: true, constructor: 'withDefaults') class EngineSettings extends GeckoEngineSettings with FastEquatable { @@ -66,6 +81,20 @@ class EngineSettings extends GeckoEngineSettings with FastEquatable { @JsonKey(fromJson: _addonCollectionFromJson, toJson: _addonCollectionToJson) final AddonCollection? addonCollection; + final DohSettingsMode dohSettingsMode; + final String dohProviderUrl; + final String dohDefaultProviderUrl; + final List dohExceptionsList; + + @override + @JsonKey(includeFromJson: false, includeToJson: false) + DohSettings get dohSettings => DohSettings( + dohSettingsMode: dohSettingsMode, + dohProviderUrl: dohProviderUrl, + dohDefaultProviderUrl: dohDefaultProviderUrl, + dohExceptionsList: dohExceptionsList, + ); + @override @JsonKey(includeFromJson: false, includeToJson: false) ContentBlocking get contentBlocking => ContentBlocking( @@ -92,6 +121,10 @@ class EngineSettings extends GeckoEngineSettings with FastEquatable { required this.queryParameterStripping, required this.bounceTrackingProtectionMode, required this.addonCollection, + required this.dohSettingsMode, + required this.dohProviderUrl, + required this.dohDefaultProviderUrl, + required this.dohExceptionsList, }); EngineSettings.withDefaults({ @@ -110,11 +143,20 @@ class EngineSettings extends GeckoEngineSettings with FastEquatable { super.userAgent, bool? enterpriseRootsEnabled, this.addonCollection, + DohSettingsMode? dohSettingsMode, + String? dohProviderUrl, + String? dohDefaultProviderUrl, + List? dohExceptionsList, }) : queryParameterStripping = queryParameterStripping ?? QueryParameterStripping.disabled, bounceTrackingProtectionMode = bounceTrackingProtectionMode ?? BounceTrackingProtectionMode.disabled, + dohSettingsMode = dohSettingsMode ?? DohSettingsMode.increased, + dohProviderUrl = dohProviderUrl ?? BuiltInDohProviders.quad9.url, + dohDefaultProviderUrl = + dohDefaultProviderUrl ?? BuiltInDohProviders.quad9.url, + dohExceptionsList = dohExceptionsList ?? [], super( javascriptEnabled: javascriptEnabled ?? true, trackingProtectionPolicy: @@ -155,5 +197,9 @@ class EngineSettings extends GeckoEngineSettings with FastEquatable { queryParameterStripping, bounceTrackingProtectionMode, addonCollection, + dohSettingsMode, + dohProviderUrl, + dohDefaultProviderUrl, + dohExceptionsList, ]; } diff --git a/app/lib/features/user/data/models/engine_settings.g.dart b/app/lib/features/user/data/models/engine_settings.g.dart index cbb0e7e0..c867a3f1 100644 --- a/app/lib/features/user/data/models/engine_settings.g.dart +++ b/app/lib/features/user/data/models/engine_settings.g.dart @@ -53,6 +53,14 @@ abstract class _$EngineSettingsCWProxy { EngineSettings addonCollection(AddonCollection? addonCollection); + EngineSettings dohSettingsMode(DohSettingsMode dohSettingsMode); + + EngineSettings dohProviderUrl(String dohProviderUrl); + + EngineSettings dohDefaultProviderUrl(String dohDefaultProviderUrl); + + EngineSettings dohExceptionsList(List dohExceptionsList); + /// Creates a new instance with the provided field values. /// Passing `null` to a nullable field nullifies it, while `null` for a non-nullable field is ignored. To update a single field use `EngineSettings(...).copyWith.fieldName(value)`. /// @@ -76,6 +84,10 @@ abstract class _$EngineSettingsCWProxy { QueryParameterStripping queryParameterStripping, BounceTrackingProtectionMode bounceTrackingProtectionMode, AddonCollection? addonCollection, + DohSettingsMode dohSettingsMode, + String dohProviderUrl, + String dohDefaultProviderUrl, + List dohExceptionsList, }); } @@ -160,6 +172,22 @@ class _$EngineSettingsCWProxyImpl implements _$EngineSettingsCWProxy { EngineSettings addonCollection(AddonCollection? addonCollection) => call(addonCollection: addonCollection); + @override + EngineSettings dohSettingsMode(DohSettingsMode dohSettingsMode) => + call(dohSettingsMode: dohSettingsMode); + + @override + EngineSettings dohProviderUrl(String dohProviderUrl) => + call(dohProviderUrl: dohProviderUrl); + + @override + EngineSettings dohDefaultProviderUrl(String dohDefaultProviderUrl) => + call(dohDefaultProviderUrl: dohDefaultProviderUrl); + + @override + EngineSettings dohExceptionsList(List dohExceptionsList) => + call(dohExceptionsList: dohExceptionsList); + @override /// Creates a new instance with the provided field values. /// Passing `null` to a nullable field nullifies it, while `null` for a non-nullable field is ignored. To update a single field use `EngineSettings(...).copyWith.fieldName(value)`. @@ -186,6 +214,10 @@ class _$EngineSettingsCWProxyImpl implements _$EngineSettingsCWProxy { Object? queryParameterStripping = const $CopyWithPlaceholder(), Object? bounceTrackingProtectionMode = const $CopyWithPlaceholder(), Object? addonCollection = const $CopyWithPlaceholder(), + Object? dohSettingsMode = const $CopyWithPlaceholder(), + Object? dohProviderUrl = const $CopyWithPlaceholder(), + Object? dohDefaultProviderUrl = const $CopyWithPlaceholder(), + Object? dohExceptionsList = const $CopyWithPlaceholder(), }) { return EngineSettings( javascriptEnabled: javascriptEnabled == const $CopyWithPlaceholder() @@ -263,6 +295,30 @@ class _$EngineSettingsCWProxyImpl implements _$EngineSettingsCWProxy { ? _value.addonCollection // ignore: cast_nullable_to_non_nullable : addonCollection as AddonCollection?, + dohSettingsMode: + dohSettingsMode == const $CopyWithPlaceholder() || + dohSettingsMode == null + ? _value.dohSettingsMode + // ignore: cast_nullable_to_non_nullable + : dohSettingsMode as DohSettingsMode, + dohProviderUrl: + dohProviderUrl == const $CopyWithPlaceholder() || + dohProviderUrl == null + ? _value.dohProviderUrl + // ignore: cast_nullable_to_non_nullable + : dohProviderUrl as String, + dohDefaultProviderUrl: + dohDefaultProviderUrl == const $CopyWithPlaceholder() || + dohDefaultProviderUrl == null + ? _value.dohDefaultProviderUrl + // ignore: cast_nullable_to_non_nullable + : dohDefaultProviderUrl as String, + dohExceptionsList: + dohExceptionsList == const $CopyWithPlaceholder() || + dohExceptionsList == null + ? _value.dohExceptionsList + // ignore: cast_nullable_to_non_nullable + : dohExceptionsList as List, ); } } @@ -323,6 +379,15 @@ EngineSettings _$EngineSettingsFromJson(Map json) => addonCollection: EngineSettings._addonCollectionFromJson( json['addonCollection'] as String?, ), + dohSettingsMode: $enumDecodeNullable( + _$DohSettingsModeEnumMap, + json['dohSettingsMode'], + ), + dohProviderUrl: json['dohProviderUrl'] as String?, + dohDefaultProviderUrl: json['dohDefaultProviderUrl'] as String?, + dohExceptionsList: (json['dohExceptionsList'] as List?) + ?.map((e) => e as String) + .toList(), ); Map _$EngineSettingsToJson( @@ -355,6 +420,10 @@ Map _$EngineSettingsToJson( 'addonCollection': EngineSettings._addonCollectionToJson( instance.addonCollection, ), + 'dohSettingsMode': _$DohSettingsModeEnumMap[instance.dohSettingsMode]!, + 'dohProviderUrl': instance.dohProviderUrl, + 'dohDefaultProviderUrl': instance.dohDefaultProviderUrl, + 'dohExceptionsList': instance.dohExceptionsList, }; const _$TrackingProtectionPolicyEnumMap = { @@ -400,3 +469,10 @@ const _$BounceTrackingProtectionModeEnumMap = { BounceTrackingProtectionMode.enabledStandby: 'enabledStandby', BounceTrackingProtectionMode.enabledDryRun: 'enabledDryRun', }; + +const _$DohSettingsModeEnumMap = { + DohSettingsMode.geckoDefault: 'geckoDefault', + DohSettingsMode.increased: 'increased', + DohSettingsMode.max: 'max', + DohSettingsMode.off: 'off', +}; diff --git a/app/lib/features/user/domain/repositories/engine_settings.dart b/app/lib/features/user/domain/repositories/engine_settings.dart index 4d5611fa..8a316470 100644 --- a/app/lib/features/user/domain/repositories/engine_settings.dart +++ b/app/lib/features/user/domain/repositories/engine_settings.dart @@ -98,6 +98,22 @@ class EngineSettingsRepository extends _$EngineSettingsRepository { DriftSqlType.string, db.typeMapping, ), + 'dohSettingsMode': settings['dohSettingsMode']?.readAs( + DriftSqlType.string, + db.typeMapping, + ), + 'dohProviderUrl': settings['dohProviderUrl']?.readAs( + DriftSqlType.string, + db.typeMapping, + ), + 'dohDefaultProviderUrl': settings['dohDefaultProviderUrl']?.readAs( + DriftSqlType.string, + db.typeMapping, + ), + 'dohExceptionsList': settings['dohExceptionsList']?.readAs( + DriftSqlType.string, + db.typeMapping, + ), }); } diff --git a/app/lib/features/user/domain/repositories/engine_settings.g.dart b/app/lib/features/user/domain/repositories/engine_settings.g.dart index da3b7998..9cb90ae0 100644 --- a/app/lib/features/user/domain/repositories/engine_settings.g.dart +++ b/app/lib/features/user/domain/repositories/engine_settings.g.dart @@ -34,7 +34,7 @@ final class EngineSettingsRepositoryProvider } String _$engineSettingsRepositoryHash() => - r'f5e50bbfc707cdae698ac201d42e165bffc7615f'; + r'5e403757036edb4ef964b01cdcf96cbcbdc4d809'; abstract class _$EngineSettingsRepository extends $StreamNotifier { diff --git a/packages/flutter_mozilla_components/android/src/main/kotlin/eu/weblibre/flutter_mozilla_components/api/GeckoEngineSettingsApiImpl.kt b/packages/flutter_mozilla_components/android/src/main/kotlin/eu/weblibre/flutter_mozilla_components/api/GeckoEngineSettingsApiImpl.kt index bf71bc36..492a3183 100644 --- a/packages/flutter_mozilla_components/android/src/main/kotlin/eu/weblibre/flutter_mozilla_components/api/GeckoEngineSettingsApiImpl.kt +++ b/packages/flutter_mozilla_components/android/src/main/kotlin/eu/weblibre/flutter_mozilla_components/api/GeckoEngineSettingsApiImpl.kt @@ -9,6 +9,7 @@ package eu.weblibre.flutter_mozilla_components.api import eu.weblibre.flutter_mozilla_components.GlobalComponents import eu.weblibre.flutter_mozilla_components.pigeons.ColorScheme import eu.weblibre.flutter_mozilla_components.pigeons.CookieBannerHandlingMode +import eu.weblibre.flutter_mozilla_components.pigeons.DohSettingsMode import eu.weblibre.flutter_mozilla_components.pigeons.GeckoEngineSettings import eu.weblibre.flutter_mozilla_components.pigeons.GeckoEngineSettingsApi import eu.weblibre.flutter_mozilla_components.pigeons.HttpsOnlyMode @@ -132,6 +133,17 @@ class GeckoEngineSettingsApiImpl : GeckoEngineSettingsApi { if(settings.enterpriseRootsEnabled != null) { components.core.engineSettings.enterpriseRootsEnabled = settings.enterpriseRootsEnabled; } + if(settings.dohSettings != null) { + components.core.engineSettings.dohSettingsMode = when(settings.dohSettings.dohSettingsMode) { + DohSettingsMode.GECKO_DEFAULT -> Engine.DohSettingsMode.DEFAULT + DohSettingsMode.INCREASED -> Engine.DohSettingsMode.INCREASED + DohSettingsMode.MAX -> Engine.DohSettingsMode.MAX + DohSettingsMode.OFF -> Engine.DohSettingsMode.OFF + } + components.core.engineSettings.dohProviderUrl = settings.dohSettings.dohProviderUrl + components.core.engineSettings.dohDefaultProviderUrl = settings.dohSettings.dohDefaultProviderUrl + components.core.engineSettings.dohExceptionsList = settings.dohSettings.dohExceptionsList + } } override fun updateRuntimeSettings(settings: GeckoEngineSettings) { @@ -196,7 +208,7 @@ class GeckoEngineSettingsApiImpl : GeckoEngineSettingsApi { components.core.engine.settings.queryParameterStrippingAllowList = settings.contentBlocking.queryParameterStrippingAllowList components.core.engine.settings.queryParameterStrippingStripList = settings.contentBlocking.queryParameterStrippingStripList - //TODO: Add bounce tracking protection when available + components.core.engine.settings reloadSession = true } @@ -204,6 +216,17 @@ class GeckoEngineSettingsApiImpl : GeckoEngineSettingsApi { components.core.engine.settings.enterpriseRootsEnabled = components.core.engineSettings.enterpriseRootsEnabled reloadSession = true } + if(settings.dohSettings != null) { + components.core.engine.settings.dohSettingsMode = when(settings.dohSettings.dohSettingsMode) { + DohSettingsMode.GECKO_DEFAULT -> Engine.DohSettingsMode.DEFAULT + DohSettingsMode.INCREASED -> Engine.DohSettingsMode.INCREASED + DohSettingsMode.MAX -> Engine.DohSettingsMode.MAX + DohSettingsMode.OFF -> Engine.DohSettingsMode.OFF + } + components.core.engine.settings.dohProviderUrl = settings.dohSettings.dohProviderUrl + components.core.engine.settings.dohDefaultProviderUrl = settings.dohSettings.dohDefaultProviderUrl + components.core.engine.settings.dohExceptionsList = settings.dohSettings.dohExceptionsList + } if(reloadSession) { components.useCases.sessionUseCases.reload() diff --git a/packages/flutter_mozilla_components/android/src/main/kotlin/eu/weblibre/flutter_mozilla_components/components/Core.kt b/packages/flutter_mozilla_components/android/src/main/kotlin/eu/weblibre/flutter_mozilla_components/components/Core.kt index 1d5488d3..8a4d0358 100644 --- a/packages/flutter_mozilla_components/android/src/main/kotlin/eu/weblibre/flutter_mozilla_components/components/Core.kt +++ b/packages/flutter_mozilla_components/android/src/main/kotlin/eu/weblibre/flutter_mozilla_components/components/Core.kt @@ -103,7 +103,7 @@ class Core( cookieBannerHandlingModePrivateBrowsing = EngineSession.CookieBannerHandlingMode.REJECT_ALL, cookieBannerHandlingGlobalRules = true, cookieBannerHandlingGlobalRulesSubFrames = true, - webContentIsolationStrategy = WebContentIsolationStrategy.ISOLATE_HIGH_VALUE + webContentIsolationStrategy = WebContentIsolationStrategy.ISOLATE_HIGH_VALUE, ) } diff --git a/packages/flutter_mozilla_components/android/src/main/kotlin/eu/weblibre/flutter_mozilla_components/pigeons/Gecko.g.kt b/packages/flutter_mozilla_components/android/src/main/kotlin/eu/weblibre/flutter_mozilla_components/pigeons/Gecko.g.kt index 1c5a1de2..4568f15a 100644 --- a/packages/flutter_mozilla_components/android/src/main/kotlin/eu/weblibre/flutter_mozilla_components/pigeons/Gecko.g.kt +++ b/packages/flutter_mozilla_components/android/src/main/kotlin/eu/weblibre/flutter_mozilla_components/pigeons/Gecko.g.kt @@ -334,6 +334,19 @@ enum class WebContentIsolationStrategy(val raw: Int) { } } +enum class DohSettingsMode(val raw: Int) { + GECKO_DEFAULT(0), + INCREASED(1), + MAX(2), + OFF(3); + + companion object { + fun ofRaw(raw: Int): DohSettingsMode? { + return values().firstOrNull { it.raw == raw } + } + } +} + /** Status that represents every state that a download can be in. */ enum class DownloadStatus(val raw: Int) { /** Indicates that the download is in the first state after creation but not yet [DOWNLOADING]. */ @@ -1612,6 +1625,43 @@ data class ContentBlocking ( override fun hashCode(): Int = toList().hashCode() } +/** Generated class from Pigeon that represents data sent in messages. */ +data class DohSettings ( + val dohSettingsMode: DohSettingsMode, + val dohProviderUrl: String, + val dohDefaultProviderUrl: String, + val dohExceptionsList: List +) + { + companion object { + fun fromList(pigeonVar_list: List): DohSettings { + val dohSettingsMode = pigeonVar_list[0] as DohSettingsMode + val dohProviderUrl = pigeonVar_list[1] as String + val dohDefaultProviderUrl = pigeonVar_list[2] as String + val dohExceptionsList = pigeonVar_list[3] as List + return DohSettings(dohSettingsMode, dohProviderUrl, dohDefaultProviderUrl, dohExceptionsList) + } + } + fun toList(): List { + return listOf( + dohSettingsMode, + dohProviderUrl, + dohDefaultProviderUrl, + dohExceptionsList, + ) + } + override fun equals(other: Any?): Boolean { + if (other !is DohSettings) { + return false + } + if (this === other) { + return true + } + return GeckoPigeonUtils.deepEquals(toList(), other.toList()) } + + override fun hashCode(): Int = toList().hashCode() +} + /** Generated class from Pigeon that represents data sent in messages. */ data class GeckoEngineSettings ( val javascriptEnabled: Boolean? = null, @@ -1626,7 +1676,8 @@ data class GeckoEngineSettings ( val webContentIsolationStrategy: WebContentIsolationStrategy? = null, val userAgent: String? = null, val contentBlocking: ContentBlocking? = null, - val enterpriseRootsEnabled: Boolean? = null + val enterpriseRootsEnabled: Boolean? = null, + val dohSettings: DohSettings? = null ) { companion object { @@ -1644,7 +1695,8 @@ data class GeckoEngineSettings ( val userAgent = pigeonVar_list[10] as String? val contentBlocking = pigeonVar_list[11] as ContentBlocking? val enterpriseRootsEnabled = pigeonVar_list[12] as Boolean? - return GeckoEngineSettings(javascriptEnabled, trackingProtectionPolicy, httpsOnlyMode, globalPrivacyControlEnabled, preferredColorScheme, cookieBannerHandlingMode, cookieBannerHandlingModePrivateBrowsing, cookieBannerHandlingGlobalRules, cookieBannerHandlingGlobalRulesSubFrames, webContentIsolationStrategy, userAgent, contentBlocking, enterpriseRootsEnabled) + val dohSettings = pigeonVar_list[13] as DohSettings? + return GeckoEngineSettings(javascriptEnabled, trackingProtectionPolicy, httpsOnlyMode, globalPrivacyControlEnabled, preferredColorScheme, cookieBannerHandlingMode, cookieBannerHandlingModePrivateBrowsing, cookieBannerHandlingGlobalRules, cookieBannerHandlingGlobalRulesSubFrames, webContentIsolationStrategy, userAgent, contentBlocking, enterpriseRootsEnabled, dohSettings) } } fun toList(): List { @@ -1662,6 +1714,7 @@ data class GeckoEngineSettings ( userAgent, contentBlocking, enterpriseRootsEnabled, + dohSettings, ) } override fun equals(other: Any?): Boolean { @@ -2223,220 +2276,230 @@ private open class GeckoPigeonCodec : StandardMessageCodec() { } 145.toByte() -> { return (readValue(buffer) as Long?)?.let { - DownloadStatus.ofRaw(it.toInt()) + DohSettingsMode.ofRaw(it.toInt()) } } 146.toByte() -> { return (readValue(buffer) as Long?)?.let { - LogLevel.ofRaw(it.toInt()) + DownloadStatus.ofRaw(it.toInt()) } } 147.toByte() -> { - return (readValue(buffer) as? List)?.let { - TranslationOptions.fromList(it) + return (readValue(buffer) as Long?)?.let { + LogLevel.ofRaw(it.toInt()) } } 148.toByte() -> { return (readValue(buffer) as? List)?.let { - ReaderState.fromList(it) + TranslationOptions.fromList(it) } } 149.toByte() -> { return (readValue(buffer) as? List)?.let { - LastMediaAccessState.fromList(it) + ReaderState.fromList(it) } } 150.toByte() -> { return (readValue(buffer) as? List)?.let { - HistoryMetadataKey.fromList(it) + LastMediaAccessState.fromList(it) } } 151.toByte() -> { return (readValue(buffer) as? List)?.let { - PackageCategoryValue.fromList(it) + HistoryMetadataKey.fromList(it) } } 152.toByte() -> { return (readValue(buffer) as? List)?.let { - ExternalPackage.fromList(it) + PackageCategoryValue.fromList(it) } } 153.toByte() -> { return (readValue(buffer) as? List)?.let { - LoadUrlFlagsValue.fromList(it) + ExternalPackage.fromList(it) } } 154.toByte() -> { return (readValue(buffer) as? List)?.let { - SourceValue.fromList(it) + LoadUrlFlagsValue.fromList(it) } } 155.toByte() -> { return (readValue(buffer) as? List)?.let { - TabState.fromList(it) + SourceValue.fromList(it) } } 156.toByte() -> { return (readValue(buffer) as? List)?.let { - RecoverableTab.fromList(it) + TabState.fromList(it) } } 157.toByte() -> { return (readValue(buffer) as? List)?.let { - RecoverableBrowserState.fromList(it) + RecoverableTab.fromList(it) } } 158.toByte() -> { return (readValue(buffer) as? List)?.let { - IconRequest.fromList(it) + RecoverableBrowserState.fromList(it) } } 159.toByte() -> { return (readValue(buffer) as? List)?.let { - ResourceSize.fromList(it) + IconRequest.fromList(it) } } 160.toByte() -> { return (readValue(buffer) as? List)?.let { - Resource.fromList(it) + ResourceSize.fromList(it) } } 161.toByte() -> { return (readValue(buffer) as? List)?.let { - IconResult.fromList(it) + Resource.fromList(it) } } 162.toByte() -> { return (readValue(buffer) as? List)?.let { - CookiePartitionKey.fromList(it) + IconResult.fromList(it) } } 163.toByte() -> { return (readValue(buffer) as? List)?.let { - Cookie.fromList(it) + CookiePartitionKey.fromList(it) } } 164.toByte() -> { return (readValue(buffer) as? List)?.let { - VisitInfo.fromList(it) + Cookie.fromList(it) } } 165.toByte() -> { return (readValue(buffer) as? List)?.let { - HistoryItem.fromList(it) + VisitInfo.fromList(it) } } 166.toByte() -> { return (readValue(buffer) as? List)?.let { - HistoryState.fromList(it) + HistoryItem.fromList(it) } } 167.toByte() -> { return (readValue(buffer) as? List)?.let { - ReaderableState.fromList(it) + HistoryState.fromList(it) } } 168.toByte() -> { return (readValue(buffer) as? List)?.let { - SecurityInfoState.fromList(it) + ReaderableState.fromList(it) } } 169.toByte() -> { return (readValue(buffer) as? List)?.let { - TabContentState.fromList(it) + SecurityInfoState.fromList(it) } } 170.toByte() -> { return (readValue(buffer) as? List)?.let { - FindResultState.fromList(it) + TabContentState.fromList(it) } } 171.toByte() -> { return (readValue(buffer) as? List)?.let { - CustomSelectionAction.fromList(it) + FindResultState.fromList(it) } } 172.toByte() -> { return (readValue(buffer) as? List)?.let { - WebExtensionData.fromList(it) + CustomSelectionAction.fromList(it) } } 173.toByte() -> { return (readValue(buffer) as? List)?.let { - GeckoSuggestion.fromList(it) + WebExtensionData.fromList(it) } } 174.toByte() -> { return (readValue(buffer) as? List)?.let { - TabContent.fromList(it) + GeckoSuggestion.fromList(it) } } 175.toByte() -> { return (readValue(buffer) as? List)?.let { - ContentBlocking.fromList(it) + TabContent.fromList(it) } } 176.toByte() -> { return (readValue(buffer) as? List)?.let { - GeckoEngineSettings.fromList(it) + ContentBlocking.fromList(it) } } 177.toByte() -> { return (readValue(buffer) as? List)?.let { - AutocompleteResult.fromList(it) + DohSettings.fromList(it) } } 178.toByte() -> { return (readValue(buffer) as? List)?.let { - UnknownHitResult.fromList(it) + GeckoEngineSettings.fromList(it) } } 179.toByte() -> { return (readValue(buffer) as? List)?.let { - ImageHitResult.fromList(it) + AutocompleteResult.fromList(it) } } 180.toByte() -> { return (readValue(buffer) as? List)?.let { - VideoHitResult.fromList(it) + UnknownHitResult.fromList(it) } } 181.toByte() -> { return (readValue(buffer) as? List)?.let { - AudioHitResult.fromList(it) + ImageHitResult.fromList(it) } } 182.toByte() -> { return (readValue(buffer) as? List)?.let { - ImageSrcHitResult.fromList(it) + VideoHitResult.fromList(it) } } 183.toByte() -> { return (readValue(buffer) as? List)?.let { - PhoneHitResult.fromList(it) + AudioHitResult.fromList(it) } } 184.toByte() -> { return (readValue(buffer) as? List)?.let { - EmailHitResult.fromList(it) + ImageSrcHitResult.fromList(it) } } 185.toByte() -> { return (readValue(buffer) as? List)?.let { - GeoHitResult.fromList(it) + PhoneHitResult.fromList(it) } } 186.toByte() -> { return (readValue(buffer) as? List)?.let { - DownloadState.fromList(it) + EmailHitResult.fromList(it) } } 187.toByte() -> { return (readValue(buffer) as? List)?.let { - ShareInternetResourceState.fromList(it) + GeoHitResult.fromList(it) } } 188.toByte() -> { + return (readValue(buffer) as? List)?.let { + DownloadState.fromList(it) + } + } + 189.toByte() -> { + return (readValue(buffer) as? List)?.let { + ShareInternetResourceState.fromList(it) + } + } + 190.toByte() -> { return (readValue(buffer) as? List)?.let { AddonCollection.fromList(it) } @@ -2510,182 +2573,190 @@ private open class GeckoPigeonCodec : StandardMessageCodec() { stream.write(144) writeValue(stream, value.raw) } - is DownloadStatus -> { + is DohSettingsMode -> { stream.write(145) writeValue(stream, value.raw) } - is LogLevel -> { + is DownloadStatus -> { stream.write(146) writeValue(stream, value.raw) } - is TranslationOptions -> { + is LogLevel -> { stream.write(147) - writeValue(stream, value.toList()) + writeValue(stream, value.raw) } - is ReaderState -> { + is TranslationOptions -> { stream.write(148) writeValue(stream, value.toList()) } - is LastMediaAccessState -> { + is ReaderState -> { stream.write(149) writeValue(stream, value.toList()) } - is HistoryMetadataKey -> { + is LastMediaAccessState -> { stream.write(150) writeValue(stream, value.toList()) } - is PackageCategoryValue -> { + is HistoryMetadataKey -> { stream.write(151) writeValue(stream, value.toList()) } - is ExternalPackage -> { + is PackageCategoryValue -> { stream.write(152) writeValue(stream, value.toList()) } - is LoadUrlFlagsValue -> { + is ExternalPackage -> { stream.write(153) writeValue(stream, value.toList()) } - is SourceValue -> { + is LoadUrlFlagsValue -> { stream.write(154) writeValue(stream, value.toList()) } - is TabState -> { + is SourceValue -> { stream.write(155) writeValue(stream, value.toList()) } - is RecoverableTab -> { + is TabState -> { stream.write(156) writeValue(stream, value.toList()) } - is RecoverableBrowserState -> { + is RecoverableTab -> { stream.write(157) writeValue(stream, value.toList()) } - is IconRequest -> { + is RecoverableBrowserState -> { stream.write(158) writeValue(stream, value.toList()) } - is ResourceSize -> { + is IconRequest -> { stream.write(159) writeValue(stream, value.toList()) } - is Resource -> { + is ResourceSize -> { stream.write(160) writeValue(stream, value.toList()) } - is IconResult -> { + is Resource -> { stream.write(161) writeValue(stream, value.toList()) } - is CookiePartitionKey -> { + is IconResult -> { stream.write(162) writeValue(stream, value.toList()) } - is Cookie -> { + is CookiePartitionKey -> { stream.write(163) writeValue(stream, value.toList()) } - is VisitInfo -> { + is Cookie -> { stream.write(164) writeValue(stream, value.toList()) } - is HistoryItem -> { + is VisitInfo -> { stream.write(165) writeValue(stream, value.toList()) } - is HistoryState -> { + is HistoryItem -> { stream.write(166) writeValue(stream, value.toList()) } - is ReaderableState -> { + is HistoryState -> { stream.write(167) writeValue(stream, value.toList()) } - is SecurityInfoState -> { + is ReaderableState -> { stream.write(168) writeValue(stream, value.toList()) } - is TabContentState -> { + is SecurityInfoState -> { stream.write(169) writeValue(stream, value.toList()) } - is FindResultState -> { + is TabContentState -> { stream.write(170) writeValue(stream, value.toList()) } - is CustomSelectionAction -> { + is FindResultState -> { stream.write(171) writeValue(stream, value.toList()) } - is WebExtensionData -> { + is CustomSelectionAction -> { stream.write(172) writeValue(stream, value.toList()) } - is GeckoSuggestion -> { + is WebExtensionData -> { stream.write(173) writeValue(stream, value.toList()) } - is TabContent -> { + is GeckoSuggestion -> { stream.write(174) writeValue(stream, value.toList()) } - is ContentBlocking -> { + is TabContent -> { stream.write(175) writeValue(stream, value.toList()) } - is GeckoEngineSettings -> { + is ContentBlocking -> { stream.write(176) writeValue(stream, value.toList()) } - is AutocompleteResult -> { + is DohSettings -> { stream.write(177) writeValue(stream, value.toList()) } - is UnknownHitResult -> { + is GeckoEngineSettings -> { stream.write(178) writeValue(stream, value.toList()) } - is ImageHitResult -> { + is AutocompleteResult -> { stream.write(179) writeValue(stream, value.toList()) } - is VideoHitResult -> { + is UnknownHitResult -> { stream.write(180) writeValue(stream, value.toList()) } - is AudioHitResult -> { + is ImageHitResult -> { stream.write(181) writeValue(stream, value.toList()) } - is ImageSrcHitResult -> { + is VideoHitResult -> { stream.write(182) writeValue(stream, value.toList()) } - is PhoneHitResult -> { + is AudioHitResult -> { stream.write(183) writeValue(stream, value.toList()) } - is EmailHitResult -> { + is ImageSrcHitResult -> { stream.write(184) writeValue(stream, value.toList()) } - is GeoHitResult -> { + is PhoneHitResult -> { stream.write(185) writeValue(stream, value.toList()) } - is DownloadState -> { + is EmailHitResult -> { stream.write(186) writeValue(stream, value.toList()) } - is ShareInternetResourceState -> { + is GeoHitResult -> { stream.write(187) writeValue(stream, value.toList()) } - is AddonCollection -> { + is DownloadState -> { stream.write(188) writeValue(stream, value.toList()) } + is ShareInternetResourceState -> { + stream.write(189) + writeValue(stream, value.toList()) + } + is AddonCollection -> { + stream.write(190) + writeValue(stream, value.toList()) + } else -> super.writeValue(stream, value) } } diff --git a/packages/flutter_mozilla_components/lib/flutter_mozilla_components.dart b/packages/flutter_mozilla_components/lib/flutter_mozilla_components.dart index 5dc6725d..73924e14 100644 --- a/packages/flutter_mozilla_components/lib/flutter_mozilla_components.dart +++ b/packages/flutter_mozilla_components/lib/flutter_mozilla_components.dart @@ -38,6 +38,8 @@ export 'src/pigeons/gecko.g.dart' ContentBlocking, CookieBannerHandlingMode, CookieSameSiteStatus, + DohSettings, + DohSettingsMode, EmailHitResult, GeckoEngineSettings, GeckoSuggestion, diff --git a/packages/flutter_mozilla_components/lib/src/domain/services/gecko_engine_settings.dart b/packages/flutter_mozilla_components/lib/src/domain/services/gecko_engine_settings.dart index 30f7ad92..6e2cc91a 100644 --- a/packages/flutter_mozilla_components/lib/src/domain/services/gecko_engine_settings.dart +++ b/packages/flutter_mozilla_components/lib/src/domain/services/gecko_engine_settings.dart @@ -90,4 +90,8 @@ class GeckoEngineSettingsService { GeckoEngineSettings(contentBlocking: state), ); } + + Future dohSettings(DohSettings state) { + return _api.updateRuntimeSettings(GeckoEngineSettings(dohSettings: state)); + } } diff --git a/packages/flutter_mozilla_components/lib/src/pigeons/gecko.g.dart b/packages/flutter_mozilla_components/lib/src/pigeons/gecko.g.dart index c67001b3..5da76ec2 100644 --- a/packages/flutter_mozilla_components/lib/src/pigeons/gecko.g.dart +++ b/packages/flutter_mozilla_components/lib/src/pigeons/gecko.g.dart @@ -186,6 +186,13 @@ enum WebContentIsolationStrategy { isolateHighValue, } +enum DohSettingsMode { + geckoDefault, + increased, + max, + off, +} + /// Status that represents every state that a download can be in. enum DownloadStatus { /// Indicates that the download is in the first state after creation but not yet [DOWNLOADING]. @@ -1964,6 +1971,62 @@ class ContentBlocking { ; } +class DohSettings { + DohSettings({ + required this.dohSettingsMode, + required this.dohProviderUrl, + required this.dohDefaultProviderUrl, + required this.dohExceptionsList, + }); + + DohSettingsMode dohSettingsMode; + + String dohProviderUrl; + + String dohDefaultProviderUrl; + + List dohExceptionsList; + + List _toList() { + return [ + dohSettingsMode, + dohProviderUrl, + dohDefaultProviderUrl, + dohExceptionsList, + ]; + } + + Object encode() { + return _toList(); } + + static DohSettings decode(Object result) { + result as List; + return DohSettings( + dohSettingsMode: result[0]! as DohSettingsMode, + dohProviderUrl: result[1]! as String, + dohDefaultProviderUrl: result[2]! as String, + dohExceptionsList: (result[3] as List?)!.cast(), + ); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! DohSettings || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(encode(), other.encode()); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()) +; +} + class GeckoEngineSettings { GeckoEngineSettings({ this.javascriptEnabled, @@ -1979,6 +2042,7 @@ class GeckoEngineSettings { this.userAgent, this.contentBlocking, this.enterpriseRootsEnabled, + this.dohSettings, }); bool? javascriptEnabled; @@ -2007,6 +2071,8 @@ class GeckoEngineSettings { bool? enterpriseRootsEnabled; + DohSettings? dohSettings; + List _toList() { return [ javascriptEnabled, @@ -2022,6 +2088,7 @@ class GeckoEngineSettings { userAgent, contentBlocking, enterpriseRootsEnabled, + dohSettings, ]; } @@ -2044,6 +2111,7 @@ class GeckoEngineSettings { userAgent: result[10] as String?, contentBlocking: result[11] as ContentBlocking?, enterpriseRootsEnabled: result[12] as bool?, + dohSettings: result[13] as DohSettings?, ); } @@ -2771,138 +2839,144 @@ class _PigeonCodec extends StandardMessageCodec { } else if (value is WebContentIsolationStrategy) { buffer.putUint8(144); writeValue(buffer, value.index); - } else if (value is DownloadStatus) { + } else if (value is DohSettingsMode) { buffer.putUint8(145); writeValue(buffer, value.index); - } else if (value is LogLevel) { + } else if (value is DownloadStatus) { buffer.putUint8(146); writeValue(buffer, value.index); - } else if (value is TranslationOptions) { + } else if (value is LogLevel) { buffer.putUint8(147); - writeValue(buffer, value.encode()); - } else if (value is ReaderState) { + writeValue(buffer, value.index); + } else if (value is TranslationOptions) { buffer.putUint8(148); writeValue(buffer, value.encode()); - } else if (value is LastMediaAccessState) { + } else if (value is ReaderState) { buffer.putUint8(149); writeValue(buffer, value.encode()); - } else if (value is HistoryMetadataKey) { + } else if (value is LastMediaAccessState) { buffer.putUint8(150); writeValue(buffer, value.encode()); - } else if (value is PackageCategoryValue) { + } else if (value is HistoryMetadataKey) { buffer.putUint8(151); writeValue(buffer, value.encode()); - } else if (value is ExternalPackage) { + } else if (value is PackageCategoryValue) { buffer.putUint8(152); writeValue(buffer, value.encode()); - } else if (value is LoadUrlFlagsValue) { + } else if (value is ExternalPackage) { buffer.putUint8(153); writeValue(buffer, value.encode()); - } else if (value is SourceValue) { + } else if (value is LoadUrlFlagsValue) { buffer.putUint8(154); writeValue(buffer, value.encode()); - } else if (value is TabState) { + } else if (value is SourceValue) { buffer.putUint8(155); writeValue(buffer, value.encode()); - } else if (value is RecoverableTab) { + } else if (value is TabState) { buffer.putUint8(156); writeValue(buffer, value.encode()); - } else if (value is RecoverableBrowserState) { + } else if (value is RecoverableTab) { buffer.putUint8(157); writeValue(buffer, value.encode()); - } else if (value is IconRequest) { + } else if (value is RecoverableBrowserState) { buffer.putUint8(158); writeValue(buffer, value.encode()); - } else if (value is ResourceSize) { + } else if (value is IconRequest) { buffer.putUint8(159); writeValue(buffer, value.encode()); - } else if (value is Resource) { + } else if (value is ResourceSize) { buffer.putUint8(160); writeValue(buffer, value.encode()); - } else if (value is IconResult) { + } else if (value is Resource) { buffer.putUint8(161); writeValue(buffer, value.encode()); - } else if (value is CookiePartitionKey) { + } else if (value is IconResult) { buffer.putUint8(162); writeValue(buffer, value.encode()); - } else if (value is Cookie) { + } else if (value is CookiePartitionKey) { buffer.putUint8(163); writeValue(buffer, value.encode()); - } else if (value is VisitInfo) { + } else if (value is Cookie) { buffer.putUint8(164); writeValue(buffer, value.encode()); - } else if (value is HistoryItem) { + } else if (value is VisitInfo) { buffer.putUint8(165); writeValue(buffer, value.encode()); - } else if (value is HistoryState) { + } else if (value is HistoryItem) { buffer.putUint8(166); writeValue(buffer, value.encode()); - } else if (value is ReaderableState) { + } else if (value is HistoryState) { buffer.putUint8(167); writeValue(buffer, value.encode()); - } else if (value is SecurityInfoState) { + } else if (value is ReaderableState) { buffer.putUint8(168); writeValue(buffer, value.encode()); - } else if (value is TabContentState) { + } else if (value is SecurityInfoState) { buffer.putUint8(169); writeValue(buffer, value.encode()); - } else if (value is FindResultState) { + } else if (value is TabContentState) { buffer.putUint8(170); writeValue(buffer, value.encode()); - } else if (value is CustomSelectionAction) { + } else if (value is FindResultState) { buffer.putUint8(171); writeValue(buffer, value.encode()); - } else if (value is WebExtensionData) { + } else if (value is CustomSelectionAction) { buffer.putUint8(172); writeValue(buffer, value.encode()); - } else if (value is GeckoSuggestion) { + } else if (value is WebExtensionData) { buffer.putUint8(173); writeValue(buffer, value.encode()); - } else if (value is TabContent) { + } else if (value is GeckoSuggestion) { buffer.putUint8(174); writeValue(buffer, value.encode()); - } else if (value is ContentBlocking) { + } else if (value is TabContent) { buffer.putUint8(175); writeValue(buffer, value.encode()); - } else if (value is GeckoEngineSettings) { + } else if (value is ContentBlocking) { buffer.putUint8(176); writeValue(buffer, value.encode()); - } else if (value is AutocompleteResult) { + } else if (value is DohSettings) { buffer.putUint8(177); writeValue(buffer, value.encode()); - } else if (value is UnknownHitResult) { + } else if (value is GeckoEngineSettings) { buffer.putUint8(178); writeValue(buffer, value.encode()); - } else if (value is ImageHitResult) { + } else if (value is AutocompleteResult) { buffer.putUint8(179); writeValue(buffer, value.encode()); - } else if (value is VideoHitResult) { + } else if (value is UnknownHitResult) { buffer.putUint8(180); writeValue(buffer, value.encode()); - } else if (value is AudioHitResult) { + } else if (value is ImageHitResult) { buffer.putUint8(181); writeValue(buffer, value.encode()); - } else if (value is ImageSrcHitResult) { + } else if (value is VideoHitResult) { buffer.putUint8(182); writeValue(buffer, value.encode()); - } else if (value is PhoneHitResult) { + } else if (value is AudioHitResult) { buffer.putUint8(183); writeValue(buffer, value.encode()); - } else if (value is EmailHitResult) { + } else if (value is ImageSrcHitResult) { buffer.putUint8(184); writeValue(buffer, value.encode()); - } else if (value is GeoHitResult) { + } else if (value is PhoneHitResult) { buffer.putUint8(185); writeValue(buffer, value.encode()); - } else if (value is DownloadState) { + } else if (value is EmailHitResult) { buffer.putUint8(186); writeValue(buffer, value.encode()); - } else if (value is ShareInternetResourceState) { + } else if (value is GeoHitResult) { buffer.putUint8(187); writeValue(buffer, value.encode()); - } else if (value is AddonCollection) { + } else if (value is DownloadState) { buffer.putUint8(188); writeValue(buffer, value.encode()); + } else if (value is ShareInternetResourceState) { + buffer.putUint8(189); + writeValue(buffer, value.encode()); + } else if (value is AddonCollection) { + buffer.putUint8(190); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -2961,93 +3035,98 @@ class _PigeonCodec extends StandardMessageCodec { return value == null ? null : WebContentIsolationStrategy.values[value]; case 145: final int? value = readValue(buffer) as int?; - return value == null ? null : DownloadStatus.values[value]; + return value == null ? null : DohSettingsMode.values[value]; case 146: final int? value = readValue(buffer) as int?; - return value == null ? null : LogLevel.values[value]; + return value == null ? null : DownloadStatus.values[value]; case 147: - return TranslationOptions.decode(readValue(buffer)!); + final int? value = readValue(buffer) as int?; + return value == null ? null : LogLevel.values[value]; case 148: - return ReaderState.decode(readValue(buffer)!); + return TranslationOptions.decode(readValue(buffer)!); case 149: - return LastMediaAccessState.decode(readValue(buffer)!); + return ReaderState.decode(readValue(buffer)!); case 150: - return HistoryMetadataKey.decode(readValue(buffer)!); + return LastMediaAccessState.decode(readValue(buffer)!); case 151: - return PackageCategoryValue.decode(readValue(buffer)!); + return HistoryMetadataKey.decode(readValue(buffer)!); case 152: - return ExternalPackage.decode(readValue(buffer)!); + return PackageCategoryValue.decode(readValue(buffer)!); case 153: - return LoadUrlFlagsValue.decode(readValue(buffer)!); + return ExternalPackage.decode(readValue(buffer)!); case 154: - return SourceValue.decode(readValue(buffer)!); + return LoadUrlFlagsValue.decode(readValue(buffer)!); case 155: - return TabState.decode(readValue(buffer)!); + return SourceValue.decode(readValue(buffer)!); case 156: - return RecoverableTab.decode(readValue(buffer)!); + return TabState.decode(readValue(buffer)!); case 157: - return RecoverableBrowserState.decode(readValue(buffer)!); + return RecoverableTab.decode(readValue(buffer)!); case 158: - return IconRequest.decode(readValue(buffer)!); + return RecoverableBrowserState.decode(readValue(buffer)!); case 159: - return ResourceSize.decode(readValue(buffer)!); + return IconRequest.decode(readValue(buffer)!); case 160: - return Resource.decode(readValue(buffer)!); + return ResourceSize.decode(readValue(buffer)!); case 161: - return IconResult.decode(readValue(buffer)!); + return Resource.decode(readValue(buffer)!); case 162: - return CookiePartitionKey.decode(readValue(buffer)!); + return IconResult.decode(readValue(buffer)!); case 163: - return Cookie.decode(readValue(buffer)!); + return CookiePartitionKey.decode(readValue(buffer)!); case 164: - return VisitInfo.decode(readValue(buffer)!); + return Cookie.decode(readValue(buffer)!); case 165: - return HistoryItem.decode(readValue(buffer)!); + return VisitInfo.decode(readValue(buffer)!); case 166: - return HistoryState.decode(readValue(buffer)!); + return HistoryItem.decode(readValue(buffer)!); case 167: - return ReaderableState.decode(readValue(buffer)!); + return HistoryState.decode(readValue(buffer)!); case 168: - return SecurityInfoState.decode(readValue(buffer)!); + return ReaderableState.decode(readValue(buffer)!); case 169: - return TabContentState.decode(readValue(buffer)!); + return SecurityInfoState.decode(readValue(buffer)!); case 170: - return FindResultState.decode(readValue(buffer)!); + return TabContentState.decode(readValue(buffer)!); case 171: - return CustomSelectionAction.decode(readValue(buffer)!); + return FindResultState.decode(readValue(buffer)!); case 172: - return WebExtensionData.decode(readValue(buffer)!); + return CustomSelectionAction.decode(readValue(buffer)!); case 173: - return GeckoSuggestion.decode(readValue(buffer)!); + return WebExtensionData.decode(readValue(buffer)!); case 174: - return TabContent.decode(readValue(buffer)!); + return GeckoSuggestion.decode(readValue(buffer)!); case 175: - return ContentBlocking.decode(readValue(buffer)!); + return TabContent.decode(readValue(buffer)!); case 176: - return GeckoEngineSettings.decode(readValue(buffer)!); + return ContentBlocking.decode(readValue(buffer)!); case 177: - return AutocompleteResult.decode(readValue(buffer)!); + return DohSettings.decode(readValue(buffer)!); case 178: - return UnknownHitResult.decode(readValue(buffer)!); + return GeckoEngineSettings.decode(readValue(buffer)!); case 179: - return ImageHitResult.decode(readValue(buffer)!); + return AutocompleteResult.decode(readValue(buffer)!); case 180: - return VideoHitResult.decode(readValue(buffer)!); + return UnknownHitResult.decode(readValue(buffer)!); case 181: - return AudioHitResult.decode(readValue(buffer)!); + return ImageHitResult.decode(readValue(buffer)!); case 182: - return ImageSrcHitResult.decode(readValue(buffer)!); + return VideoHitResult.decode(readValue(buffer)!); case 183: - return PhoneHitResult.decode(readValue(buffer)!); + return AudioHitResult.decode(readValue(buffer)!); case 184: - return EmailHitResult.decode(readValue(buffer)!); + return ImageSrcHitResult.decode(readValue(buffer)!); case 185: - return GeoHitResult.decode(readValue(buffer)!); + return PhoneHitResult.decode(readValue(buffer)!); case 186: - return DownloadState.decode(readValue(buffer)!); + return EmailHitResult.decode(readValue(buffer)!); case 187: - return ShareInternetResourceState.decode(readValue(buffer)!); + return GeoHitResult.decode(readValue(buffer)!); case 188: + return DownloadState.decode(readValue(buffer)!); + case 189: + return ShareInternetResourceState.decode(readValue(buffer)!); + case 190: return AddonCollection.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); diff --git a/packages/flutter_mozilla_components/pigeons/gecko.dart b/packages/flutter_mozilla_components/pigeons/gecko.dart index 0e5d878b..50e6b865 100644 --- a/packages/flutter_mozilla_components/pigeons/gecko.dart +++ b/packages/flutter_mozilla_components/pigeons/gecko.dart @@ -635,6 +635,22 @@ class ContentBlocking { ); } +enum DohSettingsMode { geckoDefault, increased, max, off } + +class DohSettings { + final DohSettingsMode dohSettingsMode; + final String dohProviderUrl; + final String dohDefaultProviderUrl; + final List dohExceptionsList; + + DohSettings( + this.dohSettingsMode, + this.dohProviderUrl, + this.dohDefaultProviderUrl, + this.dohExceptionsList, + ); +} + class GeckoEngineSettings { final bool? javascriptEnabled; final TrackingProtectionPolicy? trackingProtectionPolicy; @@ -649,6 +665,7 @@ class GeckoEngineSettings { final String? userAgent; final ContentBlocking? contentBlocking; final bool? enterpriseRootsEnabled; + final DohSettings? dohSettings; GeckoEngineSettings( this.javascriptEnabled, @@ -664,6 +681,7 @@ class GeckoEngineSettings { this.userAgent, this.contentBlocking, this.enterpriseRootsEnabled, + this.dohSettings, ); }