Package org.mozilla.geckoview
Class ContentBlocking.Settings
Object
org.mozilla.geckoview.RuntimeSettings
org.mozilla.geckoview.ContentBlocking.Settings
- All Implemented Interfaces:
Parcelable
- Enclosing class:
- ContentBlocking
Content blocking settings for configuring various blocking features.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for constructing ContentBlocking Settings instances.Nested classes/interfaces inherited from interface android.os.Parcelable
Parcelable.ClassLoaderCreator<T extends Object>, Parcelable.Creator<T extends Object> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Parcelable.Creator<ContentBlocking.Settings>Parcelable creator for ContentBlocking Settings instances.Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets the tracking protection baseline allow list status.booleanGets the tracking protection convenience allow list status.intGet the set anti-tracking categories.intGet the current mode of the bounce tracking protection.booleanIndicates if cookie banner handling detect only mode is enabled.booleanIndicates if global CookieBannerRules is enabled or not.booleanIndicates if global CookieBannerRules is enabled or not in sub-frames.intGets the current cookie banner handling mode.intGets the current cookie banner handling mode for private browsing.intGet the assigned cookie storage behavior.intGet the assigned private mode cookie storage behavior.booleanGet whether or not cookie purging is enabled.Indicates if email tracker blocking is enabled in private mode.intGet the set ETP behavior category.intGet the set ETP behavior level.String[]Get the allowed list for the query parameter stripping feature.booleanIndicates if query parameter stripping is enabled in normal mode.booleanIndicates if query parameter stripping is enabled in private mode.String[]Get the strip list for the query parameter stripping featureintGet the set safe browsing categories.String[]Get the table for SafeBrowsing Malware.String[]Get the table for SafeBrowsing Phishing.Get the collection ofContentBlocking.SafeBrowsingProviderfor this runtime.Get whether Safe Browsing V5 is enabled.booleanGet whether or not strict social tracking protection is enabled.setAllowListBaselineTrackingProtection(boolean enabled) Sets the tracking protection allow list baseline status.setAllowListConvenienceTrackingProtection(boolean enabled) Sets the tracking protection allow list convenience status.setAntiTracking(int cat) Set anti-tracking categories.setBounceTrackingProtectionMode(int mode) Sets the bounce tracking protection mode.setCookieBannerDetectOnlyMode(boolean enabled) When set to true, cookie banners are detected and detection events are dispatched, but they will not be handled.setCookieBannerGlobalRulesEnabled(boolean enabled) Enables/disables the use of global CookieBannerRules, which apply to all sites.setCookieBannerGlobalRulesSubFramesEnabled(boolean enabled) Whether global rules are allowed to run in sub-frames.setCookieBannerMode(int mode) Set the Cookie Banner Handling Mode to the new providedContentBlocking.CBCookieBannerModevalue.setCookieBannerModePrivateBrowsing(int mode) Set the Cookie Banner Handling Mode for private browsing to the new providedContentBlocking.CBCookieBannerModevalue.setCookieBehavior(int behavior) Set cookie storage behavior.setCookieBehaviorPrivateMode(int behavior) Set cookie storage behavior for private browsing mode.setCookiePurging(boolean enabled) Enable or disable cookie purging.setEmailTrackerBlockingPrivateBrowsing(boolean enabled) Sets whether email tracker blocking is enabled in private mode.setEnhancedTrackingProtectionCategory(int category) Set the ETP behavior category.setEnhancedTrackingProtectionLevel(int level) Set the ETP behavior level.Sets the allowed list for the query parameter stripping feature.setQueryParameterStrippingEnabled(boolean enabled) Sets whether query parameter stripping is enabled in normal mode.setQueryParameterStrippingPrivateBrowsingEnabled(boolean enabled) Sets Whether query parameter stripping is enabled in private mode.Sets the strip list for the query parameter stripping feature.setSafeBrowsing(int cat) Set safe browsing categories.setSafeBrowsingMalwareTable(String... table) Sets the table for SafeBrowsing Malware.setSafeBrowsingPhishingTable(String... table) Sets the table for SafeBrowsing Phishing.setSafeBrowsingProviders(ContentBlocking.SafeBrowsingProvider... providers) Sets the collection ofContentBlocking.SafeBrowsingProviderfor this runtime.setSafeBrowsingV5Enabled(boolean enabled) Set the value to control whether Safe Browsing V5 is enabled.setStrictSocialTrackingProtection(boolean enabled) Set whether or not strict social tracking protection is enabled (ie, whether to block content or just cookies).protected voidupdatePrefs(RuntimeSettings settings) Update the prefs based on the provided settings.Methods inherited from class org.mozilla.geckoview.RuntimeSettings
describeContents, readFromParcel, writeToParcel
-
Field Details
-
CREATOR
Parcelable creator for ContentBlocking Settings instances.
-
-
Method Details
-
updatePrefs
Description copied from class:RuntimeSettingsUpdate the prefs based on the provided settings.- Overrides:
updatePrefsin classRuntimeSettings- Parameters:
settings- Copy from this settings.
-
getSafeBrowsingProviders
Get the collection ofContentBlocking.SafeBrowsingProviderfor this runtime.- Returns:
- an unmodifiable collection of
ContentBlocking.SafeBrowsingProvider - See Also:
-
setSafeBrowsingProviders
@NonNull public ContentBlocking.Settings setSafeBrowsingProviders(@NonNull ContentBlocking.SafeBrowsingProvider... providers) Sets the collection ofContentBlocking.SafeBrowsingProviderfor this runtime.By default the collection is composed of
ContentBlocking.GOOGLE_LEGACY_SAFE_BROWSING_PROVIDER,ContentBlocking.GOOGLE_SAFE_BROWSING_PROVIDERandContentBlocking.GOOGLE_SAFE_BROWSING_V5_PROVIDER.- Parameters:
providers-ContentBlocking.SafeBrowsingProviderinstances for this runtime.- Returns:
- the
ContentBlocking.Settingsinstance. - See Also:
-
getSafeBrowsingV5Enabled
Get whether Safe Browsing V5 is enabled.- Returns:
- Whether Safe Browsing V5 is enabled.
-
setSafeBrowsingV5Enabled
Set the value to control whether Safe Browsing V5 is enabled.- Parameters:
enabled- Whether we set the Safe Browsing V5 to enabled or disabled- Returns:
- the
ContentBlocking.Settingsinstance.
-
getSafeBrowsingPhishingTable
Get the table for SafeBrowsing Phishing. The identifiers present in this table must match one of the identifiers present inContentBlocking.SafeBrowsingProvider.getLists().- Returns:
- an array of identifiers for SafeBrowsing's Phishing feature
- See Also:
-
setSafeBrowsingPhishingTable
Sets the table for SafeBrowsing Phishing.- Parameters:
table- an array of identifiers for SafeBrowsing's Phishing feature.- Returns:
- this
ContentBlocking.Settingsinstance. - See Also:
-
getSafeBrowsingMalwareTable
Get the table for SafeBrowsing Malware. The identifiers present in this table must match one of the identifiers present inContentBlocking.SafeBrowsingProvider.getLists().- Returns:
- an array of identifiers for SafeBrowsing's Malware feature
- See Also:
-
setQueryParameterStrippingAllowList
@NonNull public ContentBlocking.Settings setQueryParameterStrippingAllowList(@NonNull String... list) Sets the allowed list for the query parameter stripping feature.- Parameters:
list- an array of identifiers for the allowed list of the query parameter's stripping feature.- Returns:
- this
ContentBlocking.Settingsinstance.
-
getQueryParameterStrippingAllowList
Get the allowed list for the query parameter stripping feature.- Returns:
- an array of identifiers for the allowed list for the query parameter stripping feature.
-
setQueryParameterStrippingStripList
@NonNull public ContentBlocking.Settings setQueryParameterStrippingStripList(@NonNull String... list) Sets the strip list for the query parameter stripping feature.- Parameters:
list- an array of identifiers for the strip list of the query parameter's stripping feature.- Returns:
- this
ContentBlocking.Settingsinstance.
-
getQueryParameterStrippingStripList
Get the strip list for the query parameter stripping feature- Returns:
- an array of identifiers for the allowed list for the query parameter stripping feature.
-
setSafeBrowsingMalwareTable
Sets the table for SafeBrowsing Malware.- Parameters:
table- an array of identifiers for SafeBrowsing's Malware feature.- Returns:
- this
ContentBlocking.Settingsinstance. - See Also:
-
setAntiTracking
Set anti-tracking categories.- Parameters:
cat- The categories of resources that should be blocked. Use one or more of theContentBlocking.AntiTrackingflags.- Returns:
- This Settings instance.
-
setEnhancedTrackingProtectionLevel
Set the ETP behavior level.Note that there is a difference between ETP "level" and ETP "category". Level refers to whether content blocking should use the regular or the strict list, or should be disabled entirely. While "category" refers to the preset of anti-tracking features under the ETP umbrella that should be enabled.
- Parameters:
level- The level of ETP blocking to use; must be one ofContentBlocking.EtpLevelflags. Only takes effect if the cookie behavior isContentBlocking.CookieBehavior.ACCEPT_NON_TRACKERSorContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY_AND_ISOLATE_OTHERS.- Returns:
- This Settings instance.
-
setEnhancedTrackingProtectionCategory
Set the ETP behavior category.- Parameters:
category- The category of ETP blocking to use.- Returns:
- This Settings instance.
-
setStrictSocialTrackingProtection
Set whether or not strict social tracking protection is enabled (ie, whether to block content or just cookies). Will only block if social tracking protection lists are supplied tosetAntiTracking(int).- Parameters:
enabled- A boolean indicating whether or not to enable strict social tracking protection.- Returns:
- This Settings instance.
-
setSafeBrowsing
Set safe browsing categories.- Parameters:
cat- The categories of resources that should be blocked. Use one or more of theContentBlocking.SafeBrowsingflags.- Returns:
- This Settings instance.
-
getAntiTrackingCategories
public int getAntiTrackingCategories()Get the set anti-tracking categories.- Returns:
- The categories of resources to be blocked.
-
getEnhancedTrackingProtectionLevel
public int getEnhancedTrackingProtectionLevel()Get the set ETP behavior level.- Returns:
- The current ETP level; one of
ContentBlocking.EtpLevel.
-
getEnhancedTrackingProtectionCategory
public int getEnhancedTrackingProtectionCategory()Get the set ETP behavior category.- Returns:
- The current ETP category; one of
ContentBlocking.EtpCategory.
-
getStrictSocialTrackingProtection
public boolean getStrictSocialTrackingProtection()Get whether or not strict social tracking protection is enabled.- Returns:
- A boolean indicating whether or not strict social tracking protection is enabled.
-
getSafeBrowsingCategories
public int getSafeBrowsingCategories()Get the set safe browsing categories.- Returns:
- The categories of resources to be blocked.
-
getCookieBehavior
public int getCookieBehavior()Get the assigned cookie storage behavior.- Returns:
- The assigned behavior, as one of
ContentBlocking.CookieBehaviorflags.
-
setCookieBehavior
Set cookie storage behavior.- Parameters:
behavior- The storage behavior that should be applied. Use one of theContentBlocking.CookieBehaviorflags.- Returns:
- This Settings instance.
-
getCookieBehaviorPrivateMode
public int getCookieBehaviorPrivateMode()Get the assigned private mode cookie storage behavior.- Returns:
- The assigned behavior, as one of
ContentBlocking.CookieBehaviorflags.
-
setCookieBehaviorPrivateMode
Set cookie storage behavior for private browsing mode.- Parameters:
behavior- The storage behavior that should be applied. Use one of theContentBlocking.CookieBehaviorflags.- Returns:
- This Settings instance.
-
getCookiePurging
public boolean getCookiePurging()Get whether or not cookie purging is enabled.- Returns:
- A boolean indicating whether or not cookie purging is enabled.
-
setCookiePurging
Enable or disable cookie purging. This will automatically purge cookies from tracking sites that have no recent user interaction, provided the cookie behavior is set toContentBlocking.CookieBehavior.ACCEPT_NON_TRACKERSorContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY_AND_ISOLATE_OTHERS.- Parameters:
enabled- A boolean indicating whether to enable cookie purging.- Returns:
- This Settings instance.
-
setCookieBannerMode
Set the Cookie Banner Handling Mode to the new providedContentBlocking.CBCookieBannerModevalue.- Parameters:
mode- Integer indicating the new mode.- Returns:
- This Settings instance.
-
setCookieBannerDetectOnlyMode
When set to true, cookie banners are detected and detection events are dispatched, but they will not be handled. Requires the service to be enabled for the desired mode via setCookieBannerMode.- Parameters:
enabled- A boolean indicating whether to enable cookie banners.- Returns:
- This Settings instance.
-
setCookieBannerGlobalRulesEnabled
Enables/disables the use of global CookieBannerRules, which apply to all sites. This enable handling of CMPs across sites without the use of site-specific rules.- Parameters:
enabled- A boolean indicating whether or not to enable.- Returns:
- This Settings instance.
-
getCookieBannerGlobalRulesEnabled
public boolean getCookieBannerGlobalRulesEnabled()Indicates if global CookieBannerRules is enabled or not.- Returns:
- Indicates if global CookieBannerRule is enabled or disabled.
-
setCookieBannerGlobalRulesSubFramesEnabled
@NonNull public ContentBlocking.Settings setCookieBannerGlobalRulesSubFramesEnabled(boolean enabled) Whether global rules are allowed to run in sub-frames. Running query selectors in every sub-frame may negatively impact performance, but is required for some CMPs.- Parameters:
enabled- A boolean indicating whether or not to enable.- Returns:
- This Settings instance.
-
getEmailTrackerBlockingPrivateBrowsingEnabled
Indicates if email tracker blocking is enabled in private mode.- Returns:
- Indicates if email tracker blocking is enabled or disabled in private mode.
-
setEmailTrackerBlockingPrivateBrowsing
Sets whether email tracker blocking is enabled in private mode.- Parameters:
enabled- A boolean indicating whether or not to enable.- Returns:
- This Settings instance.
-
setQueryParameterStrippingEnabled
Sets whether query parameter stripping is enabled in normal mode.- Parameters:
enabled- A boolean indicating whether or not to enable.- Returns:
- This Settings instance.
-
getQueryParameterStrippingEnabled
public boolean getQueryParameterStrippingEnabled()Indicates if query parameter stripping is enabled in normal mode.- Returns:
- Indicates if query parameter stripping is enabled or disabled in normal mode.
-
setQueryParameterStrippingPrivateBrowsingEnabled
@NonNull public ContentBlocking.Settings setQueryParameterStrippingPrivateBrowsingEnabled(boolean enabled) Sets Whether query parameter stripping is enabled in private mode.- Parameters:
enabled- A boolean indicating whether or not to enable in private mode.- Returns:
- This Settings instance.
-
getQueryParameterStrippingPrivateBrowsingEnabled
public boolean getQueryParameterStrippingPrivateBrowsingEnabled()Indicates if query parameter stripping is enabled in private mode.- Returns:
- Indicates if global CookieBannerRules is enabled or disabled in sub-frames.
-
getCookieBannerGlobalRulesSubFramesEnabled
public boolean getCookieBannerGlobalRulesSubFramesEnabled()Indicates if global CookieBannerRules is enabled or not in sub-frames.- Returns:
- Indicates if global CookieBannerRules is enabled or disabled in sub-frames.
-
getCookieBannerDetectOnlyMode
public boolean getCookieBannerDetectOnlyMode()Indicates if cookie banner handling detect only mode is enabled.- Returns:
- boolean indicating if the cookie banner handling detect only mode setting is enabled.
-
getCookieBannerMode
public int getCookieBannerMode()Gets the current cookie banner handling mode.- Returns:
- int the current cookie banner handling mode, one of the
ContentBlocking.CBCookieBannerMode.
-
setCookieBannerModePrivateBrowsing
Set the Cookie Banner Handling Mode for private browsing to the new providedContentBlocking.CBCookieBannerModevalue.- Parameters:
mode- Integer indicating the new mode.- Returns:
- This Settings instance.
-
getCookieBannerModePrivateBrowsing
public int getCookieBannerModePrivateBrowsing()Gets the current cookie banner handling mode for private browsing.- Returns:
- int the current cookie banner handling mode, one of the
ContentBlocking.CBCookieBannerMode.
-
getBounceTrackingProtectionMode
public int getBounceTrackingProtectionMode()Get the current mode of the bounce tracking protection. See nsIBounceTrackingProtection.idl for mode descriptions.- Returns:
- int indicating the bounce tracking protection mode.
-
setBounceTrackingProtectionMode
Sets the bounce tracking protection mode.- Parameters:
mode- A int indicating the new mode.- Returns:
- This Settings instance.
-
getAllowListBaselineTrackingProtection
public boolean getAllowListBaselineTrackingProtection()Gets the tracking protection baseline allow list status.- Returns:
- Indicates if the baseline allow list is enabled or not.
-
getAllowListConvenienceTrackingProtection
public boolean getAllowListConvenienceTrackingProtection()Gets the tracking protection convenience allow list status.- Returns:
- Indicates if the convenience allow list is enabled or not.
-
setAllowListBaselineTrackingProtection
Sets the tracking protection allow list baseline status.- Parameters:
enabled- A boolean indicating whether to enable the baseline allow list.- Returns:
- This Settings instance.
-
setAllowListConvenienceTrackingProtection
Sets the tracking protection allow list convenience status.- Parameters:
enabled- A boolean indicating whether to enable the convenience allow list.- Returns:
- This Settings instance.
-