Class GeckoSessionSettings.Builder

Object
org.mozilla.geckoview.GeckoSessionSettings.Builder
Enclosing class:
GeckoSessionSettings

@AnyThread public static final class GeckoSessionSettings.Builder extends Object
Settings builder used to construct the settings object.
  • Constructor Details

  • Method Details

    • build

      @NonNull public GeckoSessionSettings build()
      Finalize and return the settings.
      Returns:
      The constructed settings.
    • chromeUri

      @NonNull public GeckoSessionSettings.Builder chromeUri(@NonNull String uri)
      Set the chrome URI.
      Parameters:
      uri - The URI to set the Chrome URI to.
      Returns:
      This Builder instance.
    • screenId

      @NonNull public GeckoSessionSettings.Builder screenId(int id)
      Set the screen id.
      Parameters:
      id - The screen id.
      Returns:
      This Builder instance.
    • usePrivateMode

      @NonNull public GeckoSessionSettings.Builder usePrivateMode(boolean flag)
      Set the privacy mode for this instance.
      Parameters:
      flag - A flag determining whether Private Mode should be enabled. Default is false.
      Returns:
      This Builder instance.
    • contextId

      @NonNull public GeckoSessionSettings.Builder contextId(@Nullable String value)
      Set the session context ID for this instance. Setting a context ID partitions the cookie jars based on the provided IDs. This isolates the browser storage like cookies and localStorage between sessions, only sessions that share the same ID share storage data.

      Warning: Storage data is collected persistently for each context, to delete context data, call StorageController.clearDataForSessionContext(java.lang.String) for the given context.

      Parameters:
      value - The custom context ID. The default ID is null, which removes isolation for this instance.
      Returns:
      This Builder instance.
    • useTrackingProtection

      @NonNull public GeckoSessionSettings.Builder useTrackingProtection(boolean flag)
      Set whether tracking protection should be enabled.
      Parameters:
      flag - A flag determining whether tracking protection should be enabled. Default is false.
      Returns:
      This Builder instance.
    • userAgentMode

      @NonNull public GeckoSessionSettings.Builder userAgentMode(int mode)
      Set the user agent mode.
      Parameters:
      mode - The mode to set the user agent to. Use one or more of the GeckoSessionSettings.USER_AGENT_MODE_* flags.
      Returns:
      This Builder instance.
    • userAgentOverride

      @NonNull public GeckoSessionSettings.Builder userAgentOverride(@NonNull String agent)
      Override the user agent.
      Parameters:
      agent - The user agent to use.
      Returns:
      This Builder instance.
    • displayMode

      @NonNull public GeckoSessionSettings.Builder displayMode(int mode)
      Specify which display-mode to use.
      Parameters:
      mode - The mode to set the display to. Use one or more of the GeckoSessionSettings.DISPLAY_MODE_* flags.
      Returns:
      This Builder instance.
    • suspendMediaWhenInactive

      @NonNull public GeckoSessionSettings.Builder suspendMediaWhenInactive(boolean flag)
      Set whether to suspend the playing of media when the session is inactive.
      Parameters:
      flag - A flag determining whether media should be suspended. Default is false.
      Returns:
      This Builder instance.
    • allowJavascript

      @NonNull public GeckoSessionSettings.Builder allowJavascript(boolean flag)
      Set whether JavaScript support should be enabled.
      Parameters:
      flag - A flag determining whether JavaScript should be enabled. Default is true.
      Returns:
      This Builder instance.
    • fullAccessibilityTree

      @NonNull public GeckoSessionSettings.Builder fullAccessibilityTree(boolean flag)
      Set whether the entire accessible tree should be exposed with no caching.
      Parameters:
      flag - A flag determining if the entire accessible tree should be exposed. Default is false.
      Returns:
      This Builder instance.
    • viewportMode

      @NonNull public GeckoSessionSettings.Builder viewportMode(int mode)
      Specify which viewport mode to use.
      Parameters:
      mode - The mode to set the viewport to. Use one or more of the GeckoSessionSettings.VIEWPORT_MODE_* flags.
      Returns:
      This Builder instance.