Package org.mozilla.geckoview
Class ContentBlocking.Settings
Object
org.mozilla.geckoview.RuntimeSettings
org.mozilla.geckoview.ContentBlocking.Settings
- All Implemented Interfaces:
Parcelable
- Enclosing class:
- ContentBlocking
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface android.os.Parcelable
Parcelable.ClassLoaderCreator<T extends Object>, Parcelable.Creator<T extends Object>
-
Field Summary
FieldsFields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
Method Summary
Modifier and TypeMethodDescriptionint
Get the set anti-tracking categories.boolean
Indicates if cookie banner handling detect only mode is enabled.boolean
Indicates if global CookieBannerRules is enabled or not.boolean
Indicates if global CookieBannerRules is enabled or not in sub-frames.int
Gets the current cookie banner handling mode.int
Gets the current cookie banner handling mode for private browsing.int
Get the assigned cookie storage behavior.int
Get the assigned private mode cookie storage behavior.boolean
Get whether or not cookie purging is enabled.Indicates if email tracker blocking is enabled in private mode.int
Get the set ETP behavior level.String[]
Get the allowed list for the query parameter stripping feature.boolean
Indicates if query parameter stripping is enabled in normal mode.boolean
Indicates if query parameter stripping is enabled in private mode.String[]
Get the strip list for the query parameter stripping featureint
Get the set safe browsing categories.String[]
Get the table for SafeBrowsing Malware.String[]
Get the table for SafeBrowsing Phishing.Get the collection ofContentBlocking.SafeBrowsingProvider
for this runtime.boolean
Get whether or not strict social tracking protection is enabled.setAntiTracking
(int cat) Set anti-tracking categories.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.CBCookieBannerMode
value.setCookieBannerModePrivateBrowsing
(int mode) Set the Cookie Banner Handling Mode for private browsing to the new providedContentBlocking.CBCookieBannerMode
value.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.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.SafeBrowsingProvider
for this runtime.setStrictSocialTrackingProtection
(boolean enabled) Set whether or not strict social tracking protection is enabled (ie, whether to block content or just cookies).protected void
updatePrefs
(RuntimeSettings settings) Update the prefs based on the provided settings.Methods inherited from class org.mozilla.geckoview.RuntimeSettings
describeContents, readFromParcel, writeToParcel
-
Field Details
-
CREATOR
-
-
Method Details
-
updatePrefs
Description copied from class:RuntimeSettings
Update the prefs based on the provided settings.- Overrides:
updatePrefs
in classRuntimeSettings
- Parameters:
settings
- Copy from this settings.
-
getSafeBrowsingProviders
Get the collection ofContentBlocking.SafeBrowsingProvider
for 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.SafeBrowsingProvider
for this runtime.By default the collection is composed of
ContentBlocking.GOOGLE_LEGACY_SAFE_BROWSING_PROVIDER
andContentBlocking.GOOGLE_SAFE_BROWSING_PROVIDER
.- Parameters:
providers
-ContentBlocking.SafeBrowsingProvider
instances for this runtime.- Returns:
- the
ContentBlocking.Settings
instance. - See Also:
-
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.Settings
instance. - 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.Settings
instance.
-
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.Settings
instance.
-
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.Settings
instance. - See Also:
-
setAntiTracking
Set anti-tracking categories.- Parameters:
cat
- The categories of resources that should be blocked. Use one or more of theContentBlocking.AntiTracking
flags.- Returns:
- This Settings instance.
-
setEnhancedTrackingProtectionLevel
Set the ETP behavior level.- Parameters:
level
- The level of ETP blocking to use; must be one ofContentBlocking.EtpLevel
flags. Only takes effect if the cookie behavior isContentBlocking.CookieBehavior.ACCEPT_NON_TRACKERS
orContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY_AND_ISOLATE_OTHERS
.- 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.SafeBrowsing
flags.- 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
.
-
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.CookieBehavior
flags.
-
setCookieBehavior
Set cookie storage behavior.- Parameters:
behavior
- The storage behavior that should be applied. Use one of theContentBlocking.CookieBehavior
flags.- Returns:
- This Settings instance.
-
getCookieBehaviorPrivateMode
public int getCookieBehaviorPrivateMode()Get the assigned private mode cookie storage behavior.- Returns:
- The assigned behavior, as one of
ContentBlocking.CookieBehavior
flags.
-
setCookieBehaviorPrivateMode
Set cookie storage behavior for private browsing mode.- Parameters:
behavior
- The storage behavior that should be applied. Use one of theContentBlocking.CookieBehavior
flags.- 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_TRACKERS
orContentBlocking.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.CBCookieBannerMode
value.- 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.CBCookieBannerMode
value.- 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
.
-