Interface GeckoSession.NavigationDelegate

Enclosing class:
GeckoSession

public static interface GeckoSession.NavigationDelegate
  • Field Details

    • TARGET_WINDOW_NONE

      static final int TARGET_WINDOW_NONE
      See Also:
    • TARGET_WINDOW_CURRENT

      static final int TARGET_WINDOW_CURRENT
      See Also:
    • TARGET_WINDOW_NEW

      static final int TARGET_WINDOW_NEW
      See Also:
    • LOAD_REQUEST_IS_REDIRECT

      static final int LOAD_REQUEST_IS_REDIRECT
      The load request was triggered by an HTTP redirect.
      See Also:
  • Method Details

    • onLocationChange

      @UiThread @Deprecated @DeprecationSchedule(id="location-permissions", version=104) default void onLocationChange(@NonNull GeckoSession session, @Nullable String url)
      Deprecated.
      A view has started loading content from the network.
      Parameters:
      session - The GeckoSession that initiated the callback.
      url - The resource being loaded.
    • onLocationChange

      @UiThread default void onLocationChange(@NonNull GeckoSession session, @Nullable String url, @NonNull List<GeckoSession.PermissionDelegate.ContentPermission> perms)
      A view has started loading content from the network.
      Parameters:
      session - The GeckoSession that initiated the callback.
      url - The resource being loaded.
      perms - The permissions currently associated with this url.
    • onCanGoBack

      @UiThread default void onCanGoBack(@NonNull GeckoSession session, boolean canGoBack)
      The view's ability to go back has changed.
      Parameters:
      session - The GeckoSession that initiated the callback.
      canGoBack - The new value for the ability.
    • onCanGoForward

      @UiThread default void onCanGoForward(@NonNull GeckoSession session, boolean canGoForward)
      The view's ability to go forward has changed.
      Parameters:
      session - The GeckoSession that initiated the callback.
      canGoForward - The new value for the ability.
    • onLoadRequest

      @UiThread @Nullable default GeckoResult<AllowOrDeny> onLoadRequest(@NonNull GeckoSession session, @NonNull GeckoSession.NavigationDelegate.LoadRequest request)
      A request to open an URI. This is called before each top-level page load to allow custom behavior. For example, this can be used to override the behavior of TAGET_WINDOW_NEW requests, which defaults to requesting a new GeckoSession via onNewSession.
      Parameters:
      session - The GeckoSession that initiated the callback.
      request - The GeckoSession.NavigationDelegate.LoadRequest containing the request details.
      Returns:
      A GeckoResult with a AllowOrDeny value which indicates whether or not the load was handled. If unhandled, Gecko will continue the load as normal. If handled (a DENY value), Gecko will abandon the load. A null return value is interpreted as ALLOW (unhandled).
    • onSubframeLoadRequest

      @UiThread @Nullable default GeckoResult<AllowOrDeny> onSubframeLoadRequest(@NonNull GeckoSession session, @NonNull GeckoSession.NavigationDelegate.LoadRequest request)
      A request to load a URI in a non-top-level context.
      Parameters:
      session - The GeckoSession that initiated the callback.
      request - The GeckoSession.NavigationDelegate.LoadRequest containing the request details.
      Returns:
      A GeckoResult with a AllowOrDeny value which indicates whether or not the load was handled. If unhandled, Gecko will continue the load as normal. If handled (a DENY value), Gecko will abandon the load. A null return value is interpreted as ALLOW (unhandled).
    • onNewSession

      @UiThread @Nullable default GeckoResult<GeckoSession> onNewSession(@NonNull GeckoSession session, @NonNull String uri)
      A request has been made to open a new session. The URI is provided only for informational purposes. Do not call GeckoSession.load here. Additionally, the returned GeckoSession must be a newly-created one.
      Parameters:
      session - The GeckoSession that initiated the callback.
      uri - The URI to be loaded.
      Returns:
      A GeckoResult which holds the returned GeckoSession. May be null, in which case the request for a new window by web content will fail. e.g., window.open() will return null. The implementation of onNewSession is responsible for maintaining a reference to the returned object, to prevent it from being garbage collected.
    • onLoadError

      @UiThread @Nullable default GeckoResult<String> onLoadError(@NonNull GeckoSession session, @Nullable String uri, @NonNull WebRequestError error)
      Parameters:
      session - The GeckoSession that initiated the callback.
      uri - The URI that failed to load.
      error - A WebRequestError containing details about the error
      Returns:
      A URI to display as an error. Returning null will halt the load entirely. The following special methods are made available to the URI: - document.addCertException(isTemporary), returns Promise - document.getFailedCertSecurityInfo(), returns FailedCertSecurityInfo - document.getNetErrorInfo(), returns NetErrorInfo - document.allowDeprecatedTls, a property indicating whether or not TLS 1.0/1.1 is allowed - document.reloadWithHttpsOnlyException()
      See Also: