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 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 class RuntimeSettings.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

      @NonNull public ContentBlocking.Settings.Builder antiTracking(int cat)
      Set anti-tracking categories.
      Parameters:
      cat - The categories of resources that should be blocked. Use one or more of the ContentBlocking.AntiTracking flags.
      Returns:
      This Builder instance.
    • safeBrowsing

      @NonNull public ContentBlocking.Settings.Builder safeBrowsing(int cat)
      Set safe browsing categories.
      Parameters:
      cat - The categories of resources that should be blocked. Use one or more of the ContentBlocking.SafeBrowsing flags.
      Returns:
      This Builder instance.
    • cookieBehavior

      @NonNull public ContentBlocking.Settings.Builder cookieBehavior(int behavior)
      Set cookie storage behavior.
      Parameters:
      behavior - The storage behavior that should be applied. Use one of the ContentBlocking.CookieBehavior flags.
      Returns:
      The Builder instance.
    • cookieBehaviorPrivateMode

      @NonNull public ContentBlocking.Settings.Builder cookieBehaviorPrivateMode(int behavior)
      Set cookie storage behavior in private browsing mode.
      Parameters:
      behavior - The storage behavior that should be applied. Use one of the ContentBlocking.CookieBehavior flags.
      Returns:
      The Builder instance.
    • enhancedTrackingProtectionLevel

      @NonNull public ContentBlocking.Settings.Builder enhancedTrackingProtectionLevel(int level)
      Set the ETP behavior level.
      Parameters:
      level - The level of ETP blocking to use. Only takes effect if cookie behavior is set to ContentBlocking.CookieBehavior.ACCEPT_NON_TRACKERS or ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY_AND_ISOLATE_OTHERS.
      Returns:
      The Builder instance.
    • emailTrackerBlockingPrivateMode

      @NonNull public ContentBlocking.Settings.Builder emailTrackerBlockingPrivateMode(boolean enabled)
      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

      @NonNull public ContentBlocking.Settings.Builder strictSocialTrackingProtection(boolean enabled)
      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

      @NonNull public ContentBlocking.Settings.Builder cookiePurging(boolean enabled)
      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 either ContentBlocking.CookieBehavior.ACCEPT_NON_TRACKERS or ContentBlocking.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

      @NonNull public ContentBlocking.Settings.Builder cookieBannerHandlingMode(int mode)
      Set the Cookie Banner Handling Mode.
      Parameters:
      mode - The mode of the Cookie Banner Handling one of the ContentBlocking.CBCookieBannerMode.
      Returns:
      The Builder instance.
    • cookieBannerGlobalRulesEnabled

      @NonNull public ContentBlocking.Settings.Builder cookieBannerGlobalRulesEnabled(boolean enabled)
      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

      @NonNull public ContentBlocking.Settings.Builder queryParameterStrippingEnabled(boolean enabled)
      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

      @NonNull public ContentBlocking.Settings.Builder cookieBannerHandlingModePrivateBrowsing(int mode)
      Set the Cookie Banner Handling Mode for private browsing.
      Parameters:
      mode - The mode of the Cookie Banner Handling one of the ContentBlocking.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.