refactor setting providers; include content blocking settings;
This commit is contained in:
+2
@@ -15,6 +15,7 @@ import eu.weblibre.flutter_mozilla_components.components.Search
|
||||
import eu.weblibre.flutter_mozilla_components.components.Services
|
||||
import eu.weblibre.flutter_mozilla_components.components.UseCases
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.BrowserExtensionEvents
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.ContentBlocking
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.GeckoAddonEvents
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.GeckoStateEvents
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.GeckoSuggestionEvents
|
||||
@@ -35,6 +36,7 @@ class Components(private val context: Context,
|
||||
val readerViewController: ReaderViewController,
|
||||
val selectionAction: SelectionActionDelegate,
|
||||
val logLevel: Log.Priority,
|
||||
val contentBlocking: ContentBlocking,
|
||||
private val addonEvents: GeckoAddonEvents,
|
||||
private val tabContentEvents: GeckoTabContentEvents,
|
||||
private val extensionEvents: BrowserExtensionEvents
|
||||
|
||||
+28
@@ -10,15 +10,19 @@ import eu.weblibre.flutter_mozilla_components.feature.CookieManagerFeature
|
||||
import eu.weblibre.flutter_mozilla_components.feature.PrefManagerFeature
|
||||
import eu.weblibre.flutter_mozilla_components.feature.BrowserExtensionFeature
|
||||
import eu.weblibre.flutter_mozilla_components.feature.MLEngineFeature
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.BounceTrackingProtectionMode
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.BrowserExtensionEvents
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.QueryParameterStripping
|
||||
import mozilla.components.browser.engine.gecko.GeckoEngine
|
||||
import mozilla.components.browser.engine.gecko.fetch.GeckoViewFetchClient
|
||||
import mozilla.components.concept.engine.DefaultSettings
|
||||
import mozilla.components.concept.engine.Engine
|
||||
import mozilla.components.concept.engine.EngineSession
|
||||
import mozilla.components.concept.fetch.Client
|
||||
import mozilla.components.feature.webcompat.WebCompatFeature
|
||||
import mozilla.components.support.base.log.Log
|
||||
import mozilla.components.support.base.log.logger.Logger
|
||||
import org.mozilla.geckoview.ContentBlocking
|
||||
import org.mozilla.geckoview.GeckoRuntime
|
||||
import org.mozilla.geckoview.GeckoRuntimeSettings
|
||||
|
||||
@@ -34,6 +38,29 @@ object EngineProvider {
|
||||
if (runtime == null) {
|
||||
Logger.debug("Creating Runtime")
|
||||
val builder = GeckoRuntimeSettings.Builder()
|
||||
val contentBlocking = ContentBlocking.Settings.Builder();
|
||||
|
||||
contentBlocking.bounceTrackingProtectionMode(when(components.contentBlocking.bounceTrackingProtectionMode) {
|
||||
BounceTrackingProtectionMode.ENABLED -> EngineSession.BounceTrackingProtectionMode.ENABLED.mode
|
||||
BounceTrackingProtectionMode.DISABLED -> EngineSession.BounceTrackingProtectionMode.DISABLED.mode
|
||||
BounceTrackingProtectionMode.ENABLED_STANDBY -> EngineSession.BounceTrackingProtectionMode.ENABLED_STANDBY.mode
|
||||
BounceTrackingProtectionMode.ENABLED_DRY_RUN -> EngineSession.BounceTrackingProtectionMode.ENABLED_DRY_RUN.mode
|
||||
})
|
||||
|
||||
contentBlocking.queryParameterStrippingEnabled(when(components.contentBlocking.queryParameterStripping) {
|
||||
QueryParameterStripping.ENABLED -> true
|
||||
QueryParameterStripping.DISABLED -> false
|
||||
QueryParameterStripping.PRIVATE_ONLY -> false
|
||||
})
|
||||
|
||||
contentBlocking.queryParameterStrippingPrivateBrowsingEnabled(when(components.contentBlocking.queryParameterStripping) {
|
||||
QueryParameterStripping.ENABLED -> true
|
||||
QueryParameterStripping.DISABLED -> false
|
||||
QueryParameterStripping.PRIVATE_ONLY -> true
|
||||
})
|
||||
|
||||
contentBlocking.queryParameterStrippingAllowList(components.contentBlocking.queryParameterStrippingAllowList)
|
||||
contentBlocking.queryParameterStrippingStripList(components.contentBlocking.queryParameterStrippingStripList)
|
||||
|
||||
// if (isCrashReportActive) {
|
||||
// builder.crashHandler(CrashHandlerService::class.java)
|
||||
@@ -45,6 +72,7 @@ object EngineProvider {
|
||||
builder.extensionsWebAPIEnabled(true)
|
||||
builder.debugLogging(components.logLevel == Log.Priority.DEBUG)
|
||||
builder.consoleOutput(components.logLevel == Log.Priority.DEBUG)
|
||||
builder.contentBlocking(contentBlocking.build())
|
||||
|
||||
runtime = GeckoRuntime.create(context, builder.build())
|
||||
}
|
||||
|
||||
+6
-2
@@ -8,6 +8,7 @@ package eu.weblibre.flutter_mozilla_components
|
||||
|
||||
import android.content.Context
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.BrowserExtensionEvents
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.ContentBlocking
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.GeckoAddonEvents
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.GeckoStateEvents
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.GeckoSuggestionEvents
|
||||
@@ -53,7 +54,8 @@ object GlobalComponents {
|
||||
addonEvents: GeckoAddonEvents,
|
||||
tabContentEvents: GeckoTabContentEvents,
|
||||
extensionEvents: BrowserExtensionEvents,
|
||||
logLevel: Log.Priority
|
||||
logLevel: Log.Priority,
|
||||
contentBlocking: ContentBlocking
|
||||
) {
|
||||
Logger.debug("Creating new components")
|
||||
|
||||
@@ -63,9 +65,11 @@ object GlobalComponents {
|
||||
readerViewController,
|
||||
selectionAction,
|
||||
logLevel,
|
||||
contentBlocking,
|
||||
addonEvents,
|
||||
tabContentEvents,
|
||||
extensionEvents
|
||||
extensionEvents,
|
||||
|
||||
)
|
||||
_components = newComponents
|
||||
|
||||
|
||||
+6
-4
@@ -16,6 +16,7 @@ import eu.weblibre.flutter_mozilla_components.GlobalComponents
|
||||
import eu.weblibre.flutter_mozilla_components.activities.NotificationActivity
|
||||
import eu.weblibre.flutter_mozilla_components.feature.DefaultSelectionActionDelegate
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.BrowserExtensionEvents
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.ContentBlocking
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.GeckoAddonEvents
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.GeckoAddonsApi
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.GeckoBrowserApi
|
||||
@@ -133,7 +134,7 @@ class GeckoBrowserApiImpl : GeckoBrowserApi {
|
||||
isPlatformViewRegistered = false
|
||||
}
|
||||
|
||||
override fun initialize(logLevel: LogLevel) {
|
||||
override fun initialize(logLevel: LogLevel, contentBlocking: ContentBlocking) {
|
||||
synchronized(this) {
|
||||
if(!isGeckoInitialized) {
|
||||
val geckoLogging = GeckoLogging(_flutterPluginBinding.binaryMessenger)
|
||||
@@ -147,7 +148,7 @@ class GeckoBrowserApiImpl : GeckoBrowserApi {
|
||||
|
||||
Log.addSink(PriorityAwareLogSink(level, geckoLogging))
|
||||
|
||||
setupGeckoEngine(level)
|
||||
setupGeckoEngine(level, contentBlocking)
|
||||
isGeckoInitialized = true
|
||||
}
|
||||
}
|
||||
@@ -163,7 +164,7 @@ class GeckoBrowserApiImpl : GeckoBrowserApi {
|
||||
return false
|
||||
}
|
||||
|
||||
private fun setupGeckoEngine(logLevel: Log.Priority) {
|
||||
private fun setupGeckoEngine(logLevel: Log.Priority, contentBlocking: ContentBlocking) {
|
||||
val selectionActionEvents = GeckoSelectionActionEvents(_flutterPluginBinding.binaryMessenger)
|
||||
|
||||
val selectionActionDelegate = DefaultSelectionActionDelegate(selectionActionEvents) { actions ->
|
||||
@@ -193,7 +194,8 @@ class GeckoBrowserApiImpl : GeckoBrowserApi {
|
||||
addonEvents,
|
||||
tabContentEvents,
|
||||
extensionEvents,
|
||||
logLevel
|
||||
logLevel,
|
||||
contentBlocking
|
||||
)
|
||||
|
||||
GeckoEngineSettingsApi.setUp(_flutterPluginBinding.binaryMessenger, GeckoEngineSettingsApiImpl())
|
||||
|
||||
+35
@@ -12,6 +12,7 @@ import eu.weblibre.flutter_mozilla_components.pigeons.CookieBannerHandlingMode
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.GeckoEngineSettings
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.GeckoEngineSettingsApi
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.HttpsOnlyMode
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.QueryParameterStripping
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.WebContentIsolationStrategy
|
||||
import mozilla.components.concept.engine.Engine
|
||||
import mozilla.components.concept.engine.EngineSession
|
||||
@@ -112,6 +113,22 @@ class GeckoEngineSettingsApiImpl : GeckoEngineSettingsApi {
|
||||
if(settings.userAgent != null) {
|
||||
components.core.engineSettings.userAgentString = settings.userAgent;
|
||||
}
|
||||
if(settings.contentBlocking != null) {
|
||||
components.core.engineSettings.queryParameterStripping = when(settings.contentBlocking.queryParameterStripping) {
|
||||
QueryParameterStripping.ENABLED -> true
|
||||
QueryParameterStripping.DISABLED -> false
|
||||
QueryParameterStripping.PRIVATE_ONLY -> false
|
||||
}
|
||||
components.core.engineSettings.queryParameterStrippingPrivateBrowsing = when(settings.contentBlocking.queryParameterStripping) {
|
||||
QueryParameterStripping.ENABLED -> true
|
||||
QueryParameterStripping.DISABLED -> false
|
||||
QueryParameterStripping.PRIVATE_ONLY -> true
|
||||
}
|
||||
components.core.engineSettings.queryParameterStrippingAllowList = settings.contentBlocking.queryParameterStrippingAllowList
|
||||
components.core.engineSettings.queryParameterStrippingStripList = settings.contentBlocking.queryParameterStrippingStripList
|
||||
|
||||
//TODO: Add bounce tracking protection when available
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateRuntimeSettings(settings: GeckoEngineSettings) {
|
||||
@@ -162,6 +179,24 @@ class GeckoEngineSettingsApiImpl : GeckoEngineSettingsApi {
|
||||
components.core.engine.settings.userAgentString = components.core.engineSettings.userAgentString
|
||||
reloadSession = true
|
||||
}
|
||||
if(settings.contentBlocking != null) {
|
||||
components.core.engine.settings.queryParameterStripping = when(settings.contentBlocking.queryParameterStripping) {
|
||||
QueryParameterStripping.ENABLED -> true
|
||||
QueryParameterStripping.DISABLED -> false
|
||||
QueryParameterStripping.PRIVATE_ONLY -> false
|
||||
}
|
||||
components.core.engine.settings.queryParameterStrippingPrivateBrowsing = when(settings.contentBlocking.queryParameterStripping) {
|
||||
QueryParameterStripping.ENABLED -> true
|
||||
QueryParameterStripping.DISABLED -> false
|
||||
QueryParameterStripping.PRIVATE_ONLY -> true
|
||||
}
|
||||
components.core.engine.settings.queryParameterStrippingAllowList = settings.contentBlocking.queryParameterStrippingAllowList
|
||||
components.core.engine.settings.queryParameterStrippingStripList = settings.contentBlocking.queryParameterStrippingStripList
|
||||
|
||||
//TODO: Add bounce tracking protection when available
|
||||
|
||||
reloadSession = true
|
||||
}
|
||||
|
||||
if(reloadSession) {
|
||||
components.useCases.sessionUseCases.reload()
|
||||
|
||||
+199
-95
@@ -225,6 +225,42 @@ enum class HttpsOnlyMode(val raw: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
enum class QueryParameterStripping(val raw: Int) {
|
||||
DISABLED(0),
|
||||
PRIVATE_ONLY(1),
|
||||
ENABLED(2);
|
||||
|
||||
companion object {
|
||||
fun ofRaw(raw: Int): QueryParameterStripping? {
|
||||
return values().firstOrNull { it.raw == raw }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum class BounceTrackingProtectionMode(val raw: Int) {
|
||||
/** Fully disabled. */
|
||||
DISABLED(0),
|
||||
/** Fully enabled. */
|
||||
ENABLED(1),
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
ENABLED_STANDBY(2),
|
||||
/**
|
||||
* Feature enabled, but tracker purging is only simulated. Used for
|
||||
* testing and telemetry collection.
|
||||
*/
|
||||
ENABLED_DRY_RUN(3);
|
||||
|
||||
companion object {
|
||||
fun ofRaw(raw: Int): BounceTrackingProtectionMode? {
|
||||
return values().firstOrNull { it.raw == raw }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum class ColorScheme(val raw: Int) {
|
||||
SYSTEM(0),
|
||||
LIGHT(1),
|
||||
@@ -1456,6 +1492,43 @@ data class TabContent (
|
||||
override fun hashCode(): Int = toList().hashCode()
|
||||
}
|
||||
|
||||
/** Generated class from Pigeon that represents data sent in messages. */
|
||||
data class ContentBlocking (
|
||||
val queryParameterStripping: QueryParameterStripping,
|
||||
val queryParameterStrippingAllowList: String,
|
||||
val queryParameterStrippingStripList: String,
|
||||
val bounceTrackingProtectionMode: BounceTrackingProtectionMode
|
||||
)
|
||||
{
|
||||
companion object {
|
||||
fun fromList(pigeonVar_list: List<Any?>): ContentBlocking {
|
||||
val queryParameterStripping = pigeonVar_list[0] as QueryParameterStripping
|
||||
val queryParameterStrippingAllowList = pigeonVar_list[1] as String
|
||||
val queryParameterStrippingStripList = pigeonVar_list[2] as String
|
||||
val bounceTrackingProtectionMode = pigeonVar_list[3] as BounceTrackingProtectionMode
|
||||
return ContentBlocking(queryParameterStripping, queryParameterStrippingAllowList, queryParameterStrippingStripList, bounceTrackingProtectionMode)
|
||||
}
|
||||
}
|
||||
fun toList(): List<Any?> {
|
||||
return listOf(
|
||||
queryParameterStripping,
|
||||
queryParameterStrippingAllowList,
|
||||
queryParameterStrippingStripList,
|
||||
bounceTrackingProtectionMode,
|
||||
)
|
||||
}
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other !is ContentBlocking) {
|
||||
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,
|
||||
@@ -1468,7 +1541,8 @@ data class GeckoEngineSettings (
|
||||
val cookieBannerHandlingGlobalRules: Boolean? = null,
|
||||
val cookieBannerHandlingGlobalRulesSubFrames: Boolean? = null,
|
||||
val webContentIsolationStrategy: WebContentIsolationStrategy? = null,
|
||||
val userAgent: String? = null
|
||||
val userAgent: String? = null,
|
||||
val contentBlocking: ContentBlocking? = null
|
||||
)
|
||||
{
|
||||
companion object {
|
||||
@@ -1484,7 +1558,8 @@ data class GeckoEngineSettings (
|
||||
val cookieBannerHandlingGlobalRulesSubFrames = pigeonVar_list[8] as Boolean?
|
||||
val webContentIsolationStrategy = pigeonVar_list[9] as WebContentIsolationStrategy?
|
||||
val userAgent = pigeonVar_list[10] as String?
|
||||
return GeckoEngineSettings(javascriptEnabled, trackingProtectionPolicy, httpsOnlyMode, globalPrivacyControlEnabled, preferredColorScheme, cookieBannerHandlingMode, cookieBannerHandlingModePrivateBrowsing, cookieBannerHandlingGlobalRules, cookieBannerHandlingGlobalRulesSubFrames, webContentIsolationStrategy, userAgent)
|
||||
val contentBlocking = pigeonVar_list[11] as ContentBlocking?
|
||||
return GeckoEngineSettings(javascriptEnabled, trackingProtectionPolicy, httpsOnlyMode, globalPrivacyControlEnabled, preferredColorScheme, cookieBannerHandlingMode, cookieBannerHandlingModePrivateBrowsing, cookieBannerHandlingGlobalRules, cookieBannerHandlingGlobalRulesSubFrames, webContentIsolationStrategy, userAgent, contentBlocking)
|
||||
}
|
||||
}
|
||||
fun toList(): List<Any?> {
|
||||
@@ -1500,6 +1575,7 @@ data class GeckoEngineSettings (
|
||||
cookieBannerHandlingGlobalRulesSubFrames,
|
||||
webContentIsolationStrategy,
|
||||
userAgent,
|
||||
contentBlocking,
|
||||
)
|
||||
}
|
||||
override fun equals(other: Any?): Boolean {
|
||||
@@ -1997,220 +2073,235 @@ private open class GeckoPigeonCodec : StandardMessageCodec() {
|
||||
}
|
||||
139.toByte() -> {
|
||||
return (readValue(buffer) as Long?)?.let {
|
||||
ColorScheme.ofRaw(it.toInt())
|
||||
QueryParameterStripping.ofRaw(it.toInt())
|
||||
}
|
||||
}
|
||||
140.toByte() -> {
|
||||
return (readValue(buffer) as Long?)?.let {
|
||||
CookieBannerHandlingMode.ofRaw(it.toInt())
|
||||
BounceTrackingProtectionMode.ofRaw(it.toInt())
|
||||
}
|
||||
}
|
||||
141.toByte() -> {
|
||||
return (readValue(buffer) as Long?)?.let {
|
||||
WebContentIsolationStrategy.ofRaw(it.toInt())
|
||||
ColorScheme.ofRaw(it.toInt())
|
||||
}
|
||||
}
|
||||
142.toByte() -> {
|
||||
return (readValue(buffer) as Long?)?.let {
|
||||
DownloadStatus.ofRaw(it.toInt())
|
||||
CookieBannerHandlingMode.ofRaw(it.toInt())
|
||||
}
|
||||
}
|
||||
143.toByte() -> {
|
||||
return (readValue(buffer) as Long?)?.let {
|
||||
LogLevel.ofRaw(it.toInt())
|
||||
WebContentIsolationStrategy.ofRaw(it.toInt())
|
||||
}
|
||||
}
|
||||
144.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
TranslationOptions.fromList(it)
|
||||
return (readValue(buffer) as Long?)?.let {
|
||||
DownloadStatus.ofRaw(it.toInt())
|
||||
}
|
||||
}
|
||||
145.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
ReaderState.fromList(it)
|
||||
return (readValue(buffer) as Long?)?.let {
|
||||
LogLevel.ofRaw(it.toInt())
|
||||
}
|
||||
}
|
||||
146.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
LastMediaAccessState.fromList(it)
|
||||
TranslationOptions.fromList(it)
|
||||
}
|
||||
}
|
||||
147.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
HistoryMetadataKey.fromList(it)
|
||||
ReaderState.fromList(it)
|
||||
}
|
||||
}
|
||||
148.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
PackageCategoryValue.fromList(it)
|
||||
LastMediaAccessState.fromList(it)
|
||||
}
|
||||
}
|
||||
149.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
ExternalPackage.fromList(it)
|
||||
HistoryMetadataKey.fromList(it)
|
||||
}
|
||||
}
|
||||
150.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
LoadUrlFlagsValue.fromList(it)
|
||||
PackageCategoryValue.fromList(it)
|
||||
}
|
||||
}
|
||||
151.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
SourceValue.fromList(it)
|
||||
ExternalPackage.fromList(it)
|
||||
}
|
||||
}
|
||||
152.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
TabState.fromList(it)
|
||||
LoadUrlFlagsValue.fromList(it)
|
||||
}
|
||||
}
|
||||
153.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
RecoverableTab.fromList(it)
|
||||
SourceValue.fromList(it)
|
||||
}
|
||||
}
|
||||
154.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
RecoverableBrowserState.fromList(it)
|
||||
TabState.fromList(it)
|
||||
}
|
||||
}
|
||||
155.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
IconRequest.fromList(it)
|
||||
RecoverableTab.fromList(it)
|
||||
}
|
||||
}
|
||||
156.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
ResourceSize.fromList(it)
|
||||
RecoverableBrowserState.fromList(it)
|
||||
}
|
||||
}
|
||||
157.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
Resource.fromList(it)
|
||||
IconRequest.fromList(it)
|
||||
}
|
||||
}
|
||||
158.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
IconResult.fromList(it)
|
||||
ResourceSize.fromList(it)
|
||||
}
|
||||
}
|
||||
159.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
CookiePartitionKey.fromList(it)
|
||||
Resource.fromList(it)
|
||||
}
|
||||
}
|
||||
160.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
Cookie.fromList(it)
|
||||
IconResult.fromList(it)
|
||||
}
|
||||
}
|
||||
161.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
HistoryItem.fromList(it)
|
||||
CookiePartitionKey.fromList(it)
|
||||
}
|
||||
}
|
||||
162.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
HistoryState.fromList(it)
|
||||
Cookie.fromList(it)
|
||||
}
|
||||
}
|
||||
163.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
ReaderableState.fromList(it)
|
||||
HistoryItem.fromList(it)
|
||||
}
|
||||
}
|
||||
164.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
SecurityInfoState.fromList(it)
|
||||
HistoryState.fromList(it)
|
||||
}
|
||||
}
|
||||
165.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
TabContentState.fromList(it)
|
||||
ReaderableState.fromList(it)
|
||||
}
|
||||
}
|
||||
166.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
FindResultState.fromList(it)
|
||||
SecurityInfoState.fromList(it)
|
||||
}
|
||||
}
|
||||
167.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
CustomSelectionAction.fromList(it)
|
||||
TabContentState.fromList(it)
|
||||
}
|
||||
}
|
||||
168.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
WebExtensionData.fromList(it)
|
||||
FindResultState.fromList(it)
|
||||
}
|
||||
}
|
||||
169.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
GeckoSuggestion.fromList(it)
|
||||
CustomSelectionAction.fromList(it)
|
||||
}
|
||||
}
|
||||
170.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
TabContent.fromList(it)
|
||||
WebExtensionData.fromList(it)
|
||||
}
|
||||
}
|
||||
171.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
GeckoEngineSettings.fromList(it)
|
||||
GeckoSuggestion.fromList(it)
|
||||
}
|
||||
}
|
||||
172.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
AutocompleteResult.fromList(it)
|
||||
TabContent.fromList(it)
|
||||
}
|
||||
}
|
||||
173.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
UnknownHitResult.fromList(it)
|
||||
ContentBlocking.fromList(it)
|
||||
}
|
||||
}
|
||||
174.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
ImageHitResult.fromList(it)
|
||||
GeckoEngineSettings.fromList(it)
|
||||
}
|
||||
}
|
||||
175.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
VideoHitResult.fromList(it)
|
||||
AutocompleteResult.fromList(it)
|
||||
}
|
||||
}
|
||||
176.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
AudioHitResult.fromList(it)
|
||||
UnknownHitResult.fromList(it)
|
||||
}
|
||||
}
|
||||
177.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
ImageSrcHitResult.fromList(it)
|
||||
ImageHitResult.fromList(it)
|
||||
}
|
||||
}
|
||||
178.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
PhoneHitResult.fromList(it)
|
||||
VideoHitResult.fromList(it)
|
||||
}
|
||||
}
|
||||
179.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
EmailHitResult.fromList(it)
|
||||
AudioHitResult.fromList(it)
|
||||
}
|
||||
}
|
||||
180.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
GeoHitResult.fromList(it)
|
||||
ImageSrcHitResult.fromList(it)
|
||||
}
|
||||
}
|
||||
181.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
DownloadState.fromList(it)
|
||||
PhoneHitResult.fromList(it)
|
||||
}
|
||||
}
|
||||
182.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
EmailHitResult.fromList(it)
|
||||
}
|
||||
}
|
||||
183.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
GeoHitResult.fromList(it)
|
||||
}
|
||||
}
|
||||
184.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
DownloadState.fromList(it)
|
||||
}
|
||||
}
|
||||
185.toByte() -> {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
ShareInternetResourceState.fromList(it)
|
||||
}
|
||||
@@ -2260,182 +2351,194 @@ private open class GeckoPigeonCodec : StandardMessageCodec() {
|
||||
stream.write(138)
|
||||
writeValue(stream, value.raw)
|
||||
}
|
||||
is ColorScheme -> {
|
||||
is QueryParameterStripping -> {
|
||||
stream.write(139)
|
||||
writeValue(stream, value.raw)
|
||||
}
|
||||
is CookieBannerHandlingMode -> {
|
||||
is BounceTrackingProtectionMode -> {
|
||||
stream.write(140)
|
||||
writeValue(stream, value.raw)
|
||||
}
|
||||
is WebContentIsolationStrategy -> {
|
||||
is ColorScheme -> {
|
||||
stream.write(141)
|
||||
writeValue(stream, value.raw)
|
||||
}
|
||||
is DownloadStatus -> {
|
||||
is CookieBannerHandlingMode -> {
|
||||
stream.write(142)
|
||||
writeValue(stream, value.raw)
|
||||
}
|
||||
is LogLevel -> {
|
||||
is WebContentIsolationStrategy -> {
|
||||
stream.write(143)
|
||||
writeValue(stream, value.raw)
|
||||
}
|
||||
is TranslationOptions -> {
|
||||
is DownloadStatus -> {
|
||||
stream.write(144)
|
||||
writeValue(stream, value.toList())
|
||||
writeValue(stream, value.raw)
|
||||
}
|
||||
is ReaderState -> {
|
||||
is LogLevel -> {
|
||||
stream.write(145)
|
||||
writeValue(stream, value.toList())
|
||||
writeValue(stream, value.raw)
|
||||
}
|
||||
is LastMediaAccessState -> {
|
||||
is TranslationOptions -> {
|
||||
stream.write(146)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is HistoryMetadataKey -> {
|
||||
is ReaderState -> {
|
||||
stream.write(147)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is PackageCategoryValue -> {
|
||||
is LastMediaAccessState -> {
|
||||
stream.write(148)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is ExternalPackage -> {
|
||||
is HistoryMetadataKey -> {
|
||||
stream.write(149)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is LoadUrlFlagsValue -> {
|
||||
is PackageCategoryValue -> {
|
||||
stream.write(150)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is SourceValue -> {
|
||||
is ExternalPackage -> {
|
||||
stream.write(151)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is TabState -> {
|
||||
is LoadUrlFlagsValue -> {
|
||||
stream.write(152)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is RecoverableTab -> {
|
||||
is SourceValue -> {
|
||||
stream.write(153)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is RecoverableBrowserState -> {
|
||||
is TabState -> {
|
||||
stream.write(154)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is IconRequest -> {
|
||||
is RecoverableTab -> {
|
||||
stream.write(155)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is ResourceSize -> {
|
||||
is RecoverableBrowserState -> {
|
||||
stream.write(156)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is Resource -> {
|
||||
is IconRequest -> {
|
||||
stream.write(157)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is IconResult -> {
|
||||
is ResourceSize -> {
|
||||
stream.write(158)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is CookiePartitionKey -> {
|
||||
is Resource -> {
|
||||
stream.write(159)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is Cookie -> {
|
||||
is IconResult -> {
|
||||
stream.write(160)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is HistoryItem -> {
|
||||
is CookiePartitionKey -> {
|
||||
stream.write(161)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is HistoryState -> {
|
||||
is Cookie -> {
|
||||
stream.write(162)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is ReaderableState -> {
|
||||
is HistoryItem -> {
|
||||
stream.write(163)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is SecurityInfoState -> {
|
||||
is HistoryState -> {
|
||||
stream.write(164)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is TabContentState -> {
|
||||
is ReaderableState -> {
|
||||
stream.write(165)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is FindResultState -> {
|
||||
is SecurityInfoState -> {
|
||||
stream.write(166)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is CustomSelectionAction -> {
|
||||
is TabContentState -> {
|
||||
stream.write(167)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is WebExtensionData -> {
|
||||
is FindResultState -> {
|
||||
stream.write(168)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is GeckoSuggestion -> {
|
||||
is CustomSelectionAction -> {
|
||||
stream.write(169)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is TabContent -> {
|
||||
is WebExtensionData -> {
|
||||
stream.write(170)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is GeckoEngineSettings -> {
|
||||
is GeckoSuggestion -> {
|
||||
stream.write(171)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is AutocompleteResult -> {
|
||||
is TabContent -> {
|
||||
stream.write(172)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is UnknownHitResult -> {
|
||||
is ContentBlocking -> {
|
||||
stream.write(173)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is ImageHitResult -> {
|
||||
is GeckoEngineSettings -> {
|
||||
stream.write(174)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is VideoHitResult -> {
|
||||
is AutocompleteResult -> {
|
||||
stream.write(175)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is AudioHitResult -> {
|
||||
is UnknownHitResult -> {
|
||||
stream.write(176)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is ImageSrcHitResult -> {
|
||||
is ImageHitResult -> {
|
||||
stream.write(177)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is PhoneHitResult -> {
|
||||
is VideoHitResult -> {
|
||||
stream.write(178)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is EmailHitResult -> {
|
||||
is AudioHitResult -> {
|
||||
stream.write(179)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is GeoHitResult -> {
|
||||
is ImageSrcHitResult -> {
|
||||
stream.write(180)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is DownloadState -> {
|
||||
is PhoneHitResult -> {
|
||||
stream.write(181)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is ShareInternetResourceState -> {
|
||||
is EmailHitResult -> {
|
||||
stream.write(182)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is GeoHitResult -> {
|
||||
stream.write(183)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is DownloadState -> {
|
||||
stream.write(184)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
is ShareInternetResourceState -> {
|
||||
stream.write(185)
|
||||
writeValue(stream, value.toList())
|
||||
}
|
||||
else -> super.writeValue(stream, value)
|
||||
}
|
||||
}
|
||||
@@ -2444,7 +2547,7 @@ private open class GeckoPigeonCodec : StandardMessageCodec() {
|
||||
|
||||
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
|
||||
interface GeckoBrowserApi {
|
||||
fun initialize(logLevel: LogLevel)
|
||||
fun initialize(logLevel: LogLevel, contentBlocking: ContentBlocking)
|
||||
fun showNativeFragment(): Boolean
|
||||
fun onTrimMemory(level: Long)
|
||||
|
||||
@@ -2463,8 +2566,9 @@ interface GeckoBrowserApi {
|
||||
channel.setMessageHandler { message, reply ->
|
||||
val args = message as List<Any?>
|
||||
val logLevelArg = args[0] as LogLevel
|
||||
val contentBlockingArg = args[1] as ContentBlocking
|
||||
val wrapped: List<Any?> = try {
|
||||
api.initialize(logLevelArg)
|
||||
api.initialize(logLevelArg, contentBlockingArg)
|
||||
listOf(null)
|
||||
} catch (exception: Throwable) {
|
||||
GeckoPigeonUtils.wrapError(exception)
|
||||
|
||||
@@ -31,7 +31,9 @@ export 'src/geckoview_widget.dart';
|
||||
export 'src/pigeons/gecko.g.dart'
|
||||
show
|
||||
AudioHitResult,
|
||||
BounceTrackingProtectionMode,
|
||||
ColorScheme,
|
||||
ContentBlocking,
|
||||
CookieBannerHandlingMode,
|
||||
CookieSameSiteStatus,
|
||||
EmailHitResult,
|
||||
@@ -48,6 +50,7 @@ export 'src/pigeons/gecko.g.dart'
|
||||
ImageSrcHitResult,
|
||||
LogLevel,
|
||||
PhoneHitResult,
|
||||
QueryParameterStripping,
|
||||
Resource,
|
||||
ResourceSize,
|
||||
SecurityInfoState,
|
||||
|
||||
@@ -13,8 +13,8 @@ class GeckoBrowserService {
|
||||
|
||||
GeckoBrowserService({GeckoBrowserApi? api}) : _api = api ?? _apiInstance;
|
||||
|
||||
Future<void> initialize(LogLevel logLevel) {
|
||||
return _api.initialize(logLevel);
|
||||
Future<void> initialize(LogLevel logLevel, ContentBlocking contentBlocking) {
|
||||
return _api.initialize(logLevel, contentBlocking);
|
||||
}
|
||||
|
||||
Future<bool> showNativeFragment() {
|
||||
|
||||
@@ -84,4 +84,10 @@ class GeckoEngineSettingsService {
|
||||
GeckoEngineSettings(webContentIsolationStrategy: state),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> contentBlocking(ContentBlocking state) {
|
||||
return _api.updateRuntimeSettings(
|
||||
GeckoEngineSettings(contentBlocking: state),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,6 +121,26 @@ enum HttpsOnlyMode {
|
||||
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,
|
||||
@@ -1790,6 +1810,62 @@ class TabContent {
|
||||
;
|
||||
}
|
||||
|
||||
class ContentBlocking {
|
||||
ContentBlocking({
|
||||
required this.queryParameterStripping,
|
||||
required this.queryParameterStrippingAllowList,
|
||||
required this.queryParameterStrippingStripList,
|
||||
required this.bounceTrackingProtectionMode,
|
||||
});
|
||||
|
||||
QueryParameterStripping queryParameterStripping;
|
||||
|
||||
String queryParameterStrippingAllowList;
|
||||
|
||||
String queryParameterStrippingStripList;
|
||||
|
||||
BounceTrackingProtectionMode bounceTrackingProtectionMode;
|
||||
|
||||
List<Object?> _toList() {
|
||||
return <Object?>[
|
||||
queryParameterStripping,
|
||||
queryParameterStrippingAllowList,
|
||||
queryParameterStrippingStripList,
|
||||
bounceTrackingProtectionMode,
|
||||
];
|
||||
}
|
||||
|
||||
Object encode() {
|
||||
return _toList(); }
|
||||
|
||||
static ContentBlocking decode(Object result) {
|
||||
result as List<Object?>;
|
||||
return ContentBlocking(
|
||||
queryParameterStripping: result[0]! as QueryParameterStripping,
|
||||
queryParameterStrippingAllowList: result[1]! as String,
|
||||
queryParameterStrippingStripList: result[2]! as String,
|
||||
bounceTrackingProtectionMode: result[3]! as BounceTrackingProtectionMode,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
// ignore: avoid_equals_and_hash_code_on_mutable_classes
|
||||
bool operator ==(Object other) {
|
||||
if (other is! ContentBlocking || 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,
|
||||
@@ -1803,6 +1879,7 @@ class GeckoEngineSettings {
|
||||
this.cookieBannerHandlingGlobalRulesSubFrames,
|
||||
this.webContentIsolationStrategy,
|
||||
this.userAgent,
|
||||
this.contentBlocking,
|
||||
});
|
||||
|
||||
bool? javascriptEnabled;
|
||||
@@ -1827,6 +1904,8 @@ class GeckoEngineSettings {
|
||||
|
||||
String? userAgent;
|
||||
|
||||
ContentBlocking? contentBlocking;
|
||||
|
||||
List<Object?> _toList() {
|
||||
return <Object?>[
|
||||
javascriptEnabled,
|
||||
@@ -1840,6 +1919,7 @@ class GeckoEngineSettings {
|
||||
cookieBannerHandlingGlobalRulesSubFrames,
|
||||
webContentIsolationStrategy,
|
||||
userAgent,
|
||||
contentBlocking,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1860,6 +1940,7 @@ class GeckoEngineSettings {
|
||||
cookieBannerHandlingGlobalRulesSubFrames: result[8] as bool?,
|
||||
webContentIsolationStrategy: result[9] as WebContentIsolationStrategy?,
|
||||
userAgent: result[10] as String?,
|
||||
contentBlocking: result[11] as ContentBlocking?,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2518,138 +2599,147 @@ class _PigeonCodec extends StandardMessageCodec {
|
||||
} else if (value is HttpsOnlyMode) {
|
||||
buffer.putUint8(138);
|
||||
writeValue(buffer, value.index);
|
||||
} else if (value is ColorScheme) {
|
||||
} else if (value is QueryParameterStripping) {
|
||||
buffer.putUint8(139);
|
||||
writeValue(buffer, value.index);
|
||||
} else if (value is CookieBannerHandlingMode) {
|
||||
} else if (value is BounceTrackingProtectionMode) {
|
||||
buffer.putUint8(140);
|
||||
writeValue(buffer, value.index);
|
||||
} else if (value is WebContentIsolationStrategy) {
|
||||
} else if (value is ColorScheme) {
|
||||
buffer.putUint8(141);
|
||||
writeValue(buffer, value.index);
|
||||
} else if (value is DownloadStatus) {
|
||||
} else if (value is CookieBannerHandlingMode) {
|
||||
buffer.putUint8(142);
|
||||
writeValue(buffer, value.index);
|
||||
} else if (value is LogLevel) {
|
||||
} else if (value is WebContentIsolationStrategy) {
|
||||
buffer.putUint8(143);
|
||||
writeValue(buffer, value.index);
|
||||
} else if (value is TranslationOptions) {
|
||||
} else if (value is DownloadStatus) {
|
||||
buffer.putUint8(144);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is ReaderState) {
|
||||
writeValue(buffer, value.index);
|
||||
} else if (value is LogLevel) {
|
||||
buffer.putUint8(145);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is LastMediaAccessState) {
|
||||
writeValue(buffer, value.index);
|
||||
} else if (value is TranslationOptions) {
|
||||
buffer.putUint8(146);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is HistoryMetadataKey) {
|
||||
} else if (value is ReaderState) {
|
||||
buffer.putUint8(147);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is PackageCategoryValue) {
|
||||
} else if (value is LastMediaAccessState) {
|
||||
buffer.putUint8(148);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is ExternalPackage) {
|
||||
} else if (value is HistoryMetadataKey) {
|
||||
buffer.putUint8(149);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is LoadUrlFlagsValue) {
|
||||
} else if (value is PackageCategoryValue) {
|
||||
buffer.putUint8(150);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is SourceValue) {
|
||||
} else if (value is ExternalPackage) {
|
||||
buffer.putUint8(151);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is TabState) {
|
||||
} else if (value is LoadUrlFlagsValue) {
|
||||
buffer.putUint8(152);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is RecoverableTab) {
|
||||
} else if (value is SourceValue) {
|
||||
buffer.putUint8(153);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is RecoverableBrowserState) {
|
||||
} else if (value is TabState) {
|
||||
buffer.putUint8(154);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is IconRequest) {
|
||||
} else if (value is RecoverableTab) {
|
||||
buffer.putUint8(155);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is ResourceSize) {
|
||||
} else if (value is RecoverableBrowserState) {
|
||||
buffer.putUint8(156);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is Resource) {
|
||||
} else if (value is IconRequest) {
|
||||
buffer.putUint8(157);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is IconResult) {
|
||||
} else if (value is ResourceSize) {
|
||||
buffer.putUint8(158);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is CookiePartitionKey) {
|
||||
} else if (value is Resource) {
|
||||
buffer.putUint8(159);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is Cookie) {
|
||||
} else if (value is IconResult) {
|
||||
buffer.putUint8(160);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is HistoryItem) {
|
||||
} else if (value is CookiePartitionKey) {
|
||||
buffer.putUint8(161);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is HistoryState) {
|
||||
} else if (value is Cookie) {
|
||||
buffer.putUint8(162);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is ReaderableState) {
|
||||
} else if (value is HistoryItem) {
|
||||
buffer.putUint8(163);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is SecurityInfoState) {
|
||||
} else if (value is HistoryState) {
|
||||
buffer.putUint8(164);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is TabContentState) {
|
||||
} else if (value is ReaderableState) {
|
||||
buffer.putUint8(165);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is FindResultState) {
|
||||
} else if (value is SecurityInfoState) {
|
||||
buffer.putUint8(166);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is CustomSelectionAction) {
|
||||
} else if (value is TabContentState) {
|
||||
buffer.putUint8(167);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is WebExtensionData) {
|
||||
} else if (value is FindResultState) {
|
||||
buffer.putUint8(168);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is GeckoSuggestion) {
|
||||
} else if (value is CustomSelectionAction) {
|
||||
buffer.putUint8(169);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is TabContent) {
|
||||
} else if (value is WebExtensionData) {
|
||||
buffer.putUint8(170);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is GeckoEngineSettings) {
|
||||
} else if (value is GeckoSuggestion) {
|
||||
buffer.putUint8(171);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is AutocompleteResult) {
|
||||
} else if (value is TabContent) {
|
||||
buffer.putUint8(172);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is UnknownHitResult) {
|
||||
} else if (value is ContentBlocking) {
|
||||
buffer.putUint8(173);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is ImageHitResult) {
|
||||
} else if (value is GeckoEngineSettings) {
|
||||
buffer.putUint8(174);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is VideoHitResult) {
|
||||
} else if (value is AutocompleteResult) {
|
||||
buffer.putUint8(175);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is AudioHitResult) {
|
||||
} else if (value is UnknownHitResult) {
|
||||
buffer.putUint8(176);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is ImageSrcHitResult) {
|
||||
} else if (value is ImageHitResult) {
|
||||
buffer.putUint8(177);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is PhoneHitResult) {
|
||||
} else if (value is VideoHitResult) {
|
||||
buffer.putUint8(178);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is EmailHitResult) {
|
||||
} else if (value is AudioHitResult) {
|
||||
buffer.putUint8(179);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is GeoHitResult) {
|
||||
} else if (value is ImageSrcHitResult) {
|
||||
buffer.putUint8(180);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is DownloadState) {
|
||||
} else if (value is PhoneHitResult) {
|
||||
buffer.putUint8(181);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is ShareInternetResourceState) {
|
||||
} else if (value is EmailHitResult) {
|
||||
buffer.putUint8(182);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is GeoHitResult) {
|
||||
buffer.putUint8(183);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is DownloadState) {
|
||||
buffer.putUint8(184);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is ShareInternetResourceState) {
|
||||
buffer.putUint8(185);
|
||||
writeValue(buffer, value.encode());
|
||||
} else {
|
||||
super.writeValue(buffer, value);
|
||||
}
|
||||
@@ -2690,96 +2780,104 @@ class _PigeonCodec extends StandardMessageCodec {
|
||||
return value == null ? null : HttpsOnlyMode.values[value];
|
||||
case 139:
|
||||
final int? value = readValue(buffer) as int?;
|
||||
return value == null ? null : ColorScheme.values[value];
|
||||
return value == null ? null : QueryParameterStripping.values[value];
|
||||
case 140:
|
||||
final int? value = readValue(buffer) as int?;
|
||||
return value == null ? null : CookieBannerHandlingMode.values[value];
|
||||
return value == null ? null : BounceTrackingProtectionMode.values[value];
|
||||
case 141:
|
||||
final int? value = readValue(buffer) as int?;
|
||||
return value == null ? null : WebContentIsolationStrategy.values[value];
|
||||
return value == null ? null : ColorScheme.values[value];
|
||||
case 142:
|
||||
final int? value = readValue(buffer) as int?;
|
||||
return value == null ? null : DownloadStatus.values[value];
|
||||
return value == null ? null : CookieBannerHandlingMode.values[value];
|
||||
case 143:
|
||||
final int? value = readValue(buffer) as int?;
|
||||
return value == null ? null : LogLevel.values[value];
|
||||
return value == null ? null : WebContentIsolationStrategy.values[value];
|
||||
case 144:
|
||||
return TranslationOptions.decode(readValue(buffer)!);
|
||||
final int? value = readValue(buffer) as int?;
|
||||
return value == null ? null : DownloadStatus.values[value];
|
||||
case 145:
|
||||
return ReaderState.decode(readValue(buffer)!);
|
||||
final int? value = readValue(buffer) as int?;
|
||||
return value == null ? null : LogLevel.values[value];
|
||||
case 146:
|
||||
return LastMediaAccessState.decode(readValue(buffer)!);
|
||||
return TranslationOptions.decode(readValue(buffer)!);
|
||||
case 147:
|
||||
return HistoryMetadataKey.decode(readValue(buffer)!);
|
||||
return ReaderState.decode(readValue(buffer)!);
|
||||
case 148:
|
||||
return PackageCategoryValue.decode(readValue(buffer)!);
|
||||
return LastMediaAccessState.decode(readValue(buffer)!);
|
||||
case 149:
|
||||
return ExternalPackage.decode(readValue(buffer)!);
|
||||
return HistoryMetadataKey.decode(readValue(buffer)!);
|
||||
case 150:
|
||||
return LoadUrlFlagsValue.decode(readValue(buffer)!);
|
||||
return PackageCategoryValue.decode(readValue(buffer)!);
|
||||
case 151:
|
||||
return SourceValue.decode(readValue(buffer)!);
|
||||
return ExternalPackage.decode(readValue(buffer)!);
|
||||
case 152:
|
||||
return TabState.decode(readValue(buffer)!);
|
||||
return LoadUrlFlagsValue.decode(readValue(buffer)!);
|
||||
case 153:
|
||||
return RecoverableTab.decode(readValue(buffer)!);
|
||||
return SourceValue.decode(readValue(buffer)!);
|
||||
case 154:
|
||||
return RecoverableBrowserState.decode(readValue(buffer)!);
|
||||
return TabState.decode(readValue(buffer)!);
|
||||
case 155:
|
||||
return IconRequest.decode(readValue(buffer)!);
|
||||
return RecoverableTab.decode(readValue(buffer)!);
|
||||
case 156:
|
||||
return ResourceSize.decode(readValue(buffer)!);
|
||||
return RecoverableBrowserState.decode(readValue(buffer)!);
|
||||
case 157:
|
||||
return Resource.decode(readValue(buffer)!);
|
||||
return IconRequest.decode(readValue(buffer)!);
|
||||
case 158:
|
||||
return IconResult.decode(readValue(buffer)!);
|
||||
return ResourceSize.decode(readValue(buffer)!);
|
||||
case 159:
|
||||
return CookiePartitionKey.decode(readValue(buffer)!);
|
||||
return Resource.decode(readValue(buffer)!);
|
||||
case 160:
|
||||
return Cookie.decode(readValue(buffer)!);
|
||||
return IconResult.decode(readValue(buffer)!);
|
||||
case 161:
|
||||
return HistoryItem.decode(readValue(buffer)!);
|
||||
return CookiePartitionKey.decode(readValue(buffer)!);
|
||||
case 162:
|
||||
return HistoryState.decode(readValue(buffer)!);
|
||||
return Cookie.decode(readValue(buffer)!);
|
||||
case 163:
|
||||
return ReaderableState.decode(readValue(buffer)!);
|
||||
return HistoryItem.decode(readValue(buffer)!);
|
||||
case 164:
|
||||
return SecurityInfoState.decode(readValue(buffer)!);
|
||||
return HistoryState.decode(readValue(buffer)!);
|
||||
case 165:
|
||||
return TabContentState.decode(readValue(buffer)!);
|
||||
return ReaderableState.decode(readValue(buffer)!);
|
||||
case 166:
|
||||
return FindResultState.decode(readValue(buffer)!);
|
||||
return SecurityInfoState.decode(readValue(buffer)!);
|
||||
case 167:
|
||||
return CustomSelectionAction.decode(readValue(buffer)!);
|
||||
return TabContentState.decode(readValue(buffer)!);
|
||||
case 168:
|
||||
return WebExtensionData.decode(readValue(buffer)!);
|
||||
return FindResultState.decode(readValue(buffer)!);
|
||||
case 169:
|
||||
return GeckoSuggestion.decode(readValue(buffer)!);
|
||||
return CustomSelectionAction.decode(readValue(buffer)!);
|
||||
case 170:
|
||||
return TabContent.decode(readValue(buffer)!);
|
||||
return WebExtensionData.decode(readValue(buffer)!);
|
||||
case 171:
|
||||
return GeckoEngineSettings.decode(readValue(buffer)!);
|
||||
return GeckoSuggestion.decode(readValue(buffer)!);
|
||||
case 172:
|
||||
return AutocompleteResult.decode(readValue(buffer)!);
|
||||
return TabContent.decode(readValue(buffer)!);
|
||||
case 173:
|
||||
return UnknownHitResult.decode(readValue(buffer)!);
|
||||
return ContentBlocking.decode(readValue(buffer)!);
|
||||
case 174:
|
||||
return ImageHitResult.decode(readValue(buffer)!);
|
||||
return GeckoEngineSettings.decode(readValue(buffer)!);
|
||||
case 175:
|
||||
return VideoHitResult.decode(readValue(buffer)!);
|
||||
return AutocompleteResult.decode(readValue(buffer)!);
|
||||
case 176:
|
||||
return AudioHitResult.decode(readValue(buffer)!);
|
||||
return UnknownHitResult.decode(readValue(buffer)!);
|
||||
case 177:
|
||||
return ImageSrcHitResult.decode(readValue(buffer)!);
|
||||
return ImageHitResult.decode(readValue(buffer)!);
|
||||
case 178:
|
||||
return PhoneHitResult.decode(readValue(buffer)!);
|
||||
return VideoHitResult.decode(readValue(buffer)!);
|
||||
case 179:
|
||||
return EmailHitResult.decode(readValue(buffer)!);
|
||||
return AudioHitResult.decode(readValue(buffer)!);
|
||||
case 180:
|
||||
return GeoHitResult.decode(readValue(buffer)!);
|
||||
return ImageSrcHitResult.decode(readValue(buffer)!);
|
||||
case 181:
|
||||
return DownloadState.decode(readValue(buffer)!);
|
||||
return PhoneHitResult.decode(readValue(buffer)!);
|
||||
case 182:
|
||||
return EmailHitResult.decode(readValue(buffer)!);
|
||||
case 183:
|
||||
return GeoHitResult.decode(readValue(buffer)!);
|
||||
case 184:
|
||||
return DownloadState.decode(readValue(buffer)!);
|
||||
case 185:
|
||||
return ShareInternetResourceState.decode(readValue(buffer)!);
|
||||
default:
|
||||
return super.readValueOfType(type, buffer);
|
||||
@@ -2800,14 +2898,14 @@ class GeckoBrowserApi {
|
||||
|
||||
final String pigeonVar_messageChannelSuffix;
|
||||
|
||||
Future<void> initialize(LogLevel logLevel) async {
|
||||
Future<void> initialize(LogLevel logLevel, ContentBlocking contentBlocking) async {
|
||||
final String pigeonVar_channelName = 'dev.flutter.pigeon.flutter_mozilla_components.GeckoBrowserApi.initialize$pigeonVar_messageChannelSuffix';
|
||||
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
|
||||
pigeonVar_channelName,
|
||||
pigeonChannelCodec,
|
||||
binaryMessenger: pigeonVar_binaryMessenger,
|
||||
);
|
||||
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[logLevel]);
|
||||
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[logLevel, contentBlocking]);
|
||||
final List<Object?>? pigeonVar_replyList =
|
||||
await pigeonVar_sendFuture as List<Object?>?;
|
||||
if (pigeonVar_replyList == null) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user