Package org.mozilla.geckoview
Interface GeckoSession.NavigationDelegate
- Enclosing class:
- GeckoSession
public static interface GeckoSession.NavigationDelegate
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Load request details. -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The load request was triggered by an HTTP redirect.static final int
static final int
static final int
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
onCanGoBack
(GeckoSession session, boolean canGoBack) The view's ability to go back has changed.default void
onCanGoForward
(GeckoSession session, boolean canGoForward) The view's ability to go forward has changed.default GeckoResult<String>
onLoadError
(GeckoSession session, String uri, WebRequestError error) default GeckoResult<AllowOrDeny>
onLoadRequest
(GeckoSession session, GeckoSession.NavigationDelegate.LoadRequest request) A request to open an URI.default void
onLocationChange
(GeckoSession session, String url, List<GeckoSession.PermissionDelegate.ContentPermission> perms, Boolean hasUserGesture) A view has started loading content from the network.default GeckoResult<GeckoSession>
onNewSession
(GeckoSession session, String uri) A request has been made to open a new session.default GeckoResult<AllowOrDeny>
onSubframeLoadRequest
(GeckoSession session, GeckoSession.NavigationDelegate.LoadRequest request) A request to load a URI in a non-top-level context.
-
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_REDIRECTThe load request was triggered by an HTTP redirect.- See Also:
-
-
Method Details
-
onLocationChange
@UiThread default void onLocationChange(@NonNull GeckoSession session, @Nullable String url, @NonNull List<GeckoSession.PermissionDelegate.ContentPermission> perms, @NonNull Boolean hasUserGesture) 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.hasUserGesture
- Whether or not there was an active user gesture when the location change was requested.
-
onCanGoBack
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
The view's ability to go forward has changed.- Parameters:
session
- The GeckoSession that initiated the callback.canGoForward
- The new value for the ability.
-
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 (cannot be http/https). Returning null or http/https URL 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.reloadWithHttpsOnlyException()
- See Also:
-