Package org.mozilla.geckoview
Class ContentBlocking.Settings.Builder
Object
org.mozilla.geckoview.RuntimeSettings.Builder<ContentBlocking.Settings>
org.mozilla.geckoview.ContentBlocking.Settings.Builder
- Enclosing class:
- ContentBlocking.Settings
@AnyThread
public static class ContentBlocking.Settings.Builder
extends RuntimeSettings.Builder<ContentBlocking.Settings>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionantiTracking
(int cat) Set anti-tracking categories.cookieBannerGlobalRulesEnabled
(boolean enabled) When set to true, enable the use of global CookieBannerRules.cookieBannerGlobalRulesSubFramesEnabled
(boolean enabled) When set to true, enable the use of global CookieBannerRules in sub-frames.cookieBannerHandlingDetectOnlyMode
(boolean enabled) When set to true, cookie banners are detected and detection events are dispatched, but they will not be handled.cookieBannerHandlingMode
(int mode) Set the Cookie Banner Handling Mode.cookieBannerHandlingModePrivateBrowsing
(int mode) Set the Cookie Banner Handling Mode for private browsing.cookieBehavior
(int behavior) Set cookie storage behavior.cookieBehaviorPrivateMode
(int behavior) Set cookie storage behavior in private browsing mode.cookiePurging
(boolean enabled) Set whether or not to automatically purge tracking cookies.emailTrackerBlockingPrivateMode
(boolean enabled) Set whether or not email tracker blocking is enabled in private mode.enhancedTrackingProtectionLevel
(int level) Set the ETP behavior level.protected ContentBlocking.Settings
newSettings
(ContentBlocking.Settings settings) Create a default or copy settings object.queryParameterStrippingAllowList
(String... list) The allowed list for the query parameter stripping feature.queryParameterStrippingEnabled
(boolean enabled) When set to true, query parameter stripping is enabled in normal mode.queryParameterStrippingPrivateBrowsingEnabled
(boolean enabled) When set to true, query parameter stripping is enabled in private mode.queryParameterStrippingStripList
(String... list) The strip list for the query parameter stripping feature.safeBrowsing
(int cat) Set safe browsing categories.safeBrowsingMalwareTable
(String[] safeBrowsingMalwareTable) Set the safe browsing table for malware threats.safeBrowsingPhishingTable
(String[] safeBrowsingPhishingTable) Set the safe browsing table for phishing threats.safeBrowsingProviders
(ContentBlocking.SafeBrowsingProvider... providers) Set custom safe browsing providers.strictSocialTrackingProtection
(boolean enabled) Set whether or not strict social tracking protection is enabled.Methods inherited from class org.mozilla.geckoview.RuntimeSettings.Builder
build, getSettings
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
newSettings
@NonNull protected ContentBlocking.Settings newSettings(@Nullable ContentBlocking.Settings settings) Description copied from class:RuntimeSettings.Builder
Create a default or copy settings object.- Specified by:
newSettings
in classRuntimeSettings.Builder<ContentBlocking.Settings>
- Parameters:
settings
- Settings object to copy, null for default settings.- Returns:
- The constructed settings object.
-
safeBrowsingProviders
@NonNull public ContentBlocking.Settings.Builder safeBrowsingProviders(@NonNull ContentBlocking.SafeBrowsingProvider... providers) Set custom safe browsing providers.- Parameters:
providers
- one or more custom providers.- Returns:
- This Builder instance.
- See Also:
-
safeBrowsingPhishingTable
@NonNull public ContentBlocking.Settings.Builder safeBrowsingPhishingTable(@NonNull String[] safeBrowsingPhishingTable) Set the safe browsing table for phishing threats.- Parameters:
safeBrowsingPhishingTable
- one or more lists for safe browsing phishing.- Returns:
- This Builder instance.
- See Also:
-
safeBrowsingMalwareTable
@NonNull public ContentBlocking.Settings.Builder safeBrowsingMalwareTable(@NonNull String[] safeBrowsingMalwareTable) Set the safe browsing table for malware threats.- Parameters:
safeBrowsingMalwareTable
- one or more lists for safe browsing malware.- Returns:
- This Builder instance.
- See Also:
-
antiTracking
Set anti-tracking categories.- Parameters:
cat
- The categories of resources that should be blocked. Use one or more of theContentBlocking.AntiTracking
flags.- Returns:
- This Builder instance.
-
safeBrowsing
Set safe browsing categories.- Parameters:
cat
- The categories of resources that should be blocked. Use one or more of theContentBlocking.SafeBrowsing
flags.- Returns:
- This Builder instance.
-
cookieBehavior
Set cookie storage behavior.- Parameters:
behavior
- The storage behavior that should be applied. Use one of theContentBlocking.CookieBehavior
flags.- Returns:
- The Builder instance.
-
cookieBehaviorPrivateMode
Set cookie storage behavior in private browsing mode.- Parameters:
behavior
- The storage behavior that should be applied. Use one of theContentBlocking.CookieBehavior
flags.- Returns:
- The Builder instance.
-
enhancedTrackingProtectionLevel
Set the ETP behavior level.- Parameters:
level
- The level of ETP blocking to use. Only takes effect if cookie behavior is set toContentBlocking.CookieBehavior.ACCEPT_NON_TRACKERS
orContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY_AND_ISOLATE_OTHERS
.- Returns:
- The Builder instance.
-
emailTrackerBlockingPrivateMode
Set whether or not email tracker blocking is enabled in private mode.- Parameters:
enabled
- A boolean indicating whether or not email tracker blocking should be enabled in private mode.- Returns:
- The builder instance.
-
strictSocialTrackingProtection
Set whether or not strict social tracking protection is enabled. This will block resources from loading if they are on the social tracking protection list, rather than just blocking cookies as with normal social tracking protection.- Parameters:
enabled
- A boolean indicating whether or not strict social tracking protection should be enabled.- Returns:
- The builder instance.
-
cookiePurging
Set whether or not to automatically purge tracking cookies. This will purge cookies from tracking sites that do not have recent user interaction provided that the cookie behavior is set to eitherContentBlocking.CookieBehavior.ACCEPT_NON_TRACKERS
orContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY_AND_ISOLATE_OTHERS
.- Parameters:
enabled
- A boolean indicating whether or not cookie purging should be enabled.- Returns:
- The builder instance.
-
cookieBannerHandlingMode
Set the Cookie Banner Handling Mode.- Parameters:
mode
- The mode of the Cookie Banner Handling one of theContentBlocking.CBCookieBannerMode
.- Returns:
- The Builder instance.
-
cookieBannerGlobalRulesEnabled
When set to true, enable the use of global CookieBannerRules.- Parameters:
enabled
- A boolean indicating whether to enable the use of global CookieBannerRules.- Returns:
- The Builder instance.
-
cookieBannerGlobalRulesSubFramesEnabled
@NonNull public ContentBlocking.Settings.Builder cookieBannerGlobalRulesSubFramesEnabled(boolean enabled) When set to true, enable the use of global CookieBannerRules in sub-frames.- Parameters:
enabled
- A boolean indicating whether to enable the use of global CookieBannerRules in sub-frames.- Returns:
- The Builder instance.
-
queryParameterStrippingEnabled
When set to true, query parameter stripping is enabled in normal mode.- Parameters:
enabled
- A boolean indicating whether to query parameter stripping enabled in normal mode.- Returns:
- The Builder instance.
-
queryParameterStrippingPrivateBrowsingEnabled
@NonNull public ContentBlocking.Settings.Builder queryParameterStrippingPrivateBrowsingEnabled(boolean enabled) When set to true, query parameter stripping is enabled in private mode.- Parameters:
enabled
- A boolean indicating whether to query parameter stripping enabled in private mode.- Returns:
- The Builder instance.
-
queryParameterStrippingAllowList
@NonNull public ContentBlocking.Settings.Builder queryParameterStrippingAllowList(@NonNull String... list) The allowed list for the query parameter stripping feature.- Parameters:
list
- an array of identifiers for query parameter's stripping feature.- Returns:
- The Builder instance.
-
queryParameterStrippingStripList
@NonNull public ContentBlocking.Settings.Builder queryParameterStrippingStripList(@NonNull String... list) 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:
- The Builder instance.
-
cookieBannerHandlingModePrivateBrowsing
Set the Cookie Banner Handling Mode for private browsing.- Parameters:
mode
- The mode of the Cookie Banner Handling one of theContentBlocking.CBCookieBannerMode
.- Returns:
- The Builder instance.
-
cookieBannerHandlingDetectOnlyMode
@NonNull public ContentBlocking.Settings.Builder cookieBannerHandlingDetectOnlyMode(boolean enabled) When set to true, cookie banners are detected and detection events are dispatched, but they will not be handled.- Parameters:
enabled
- A boolean indicating whether to enable cookie banner detect only mode.- Returns:
- The Builder instance.
-