Package org.mozilla.geckoview
Interface GeckoSession.HistoryDelegate
- Enclosing class:
- GeckoSession
public static interface GeckoSession.HistoryDelegate
An interface for recording new history visits and fetching the visited status for links.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA representation of an entry in browser history.static interfaceA representation of browser history, accessible as a `List`. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe URL is the target of a permanent redirect.static final intThe URL is temporarily redirected to another URL.static final intThe URL is permanently redirected to another URL.static final intThe URL is the target of a temporary redirect.static final intThe URL was visited a top-level window.static final intThe URL failed to load due to a client or server error. -
Method Summary
Modifier and TypeMethodDescriptiondefault GeckoResult<boolean[]>getVisited(GeckoSession session, String[] urls) Returns the visited statuses for links on a page.default voidonHistoryStateChange(GeckoSession session, GeckoSession.HistoryDelegate.HistoryList historyList) Notifies the delegate that the navigation history state has changed.default GeckoResult<Boolean>onVisited(GeckoSession session, String url, String lastVisitedURL, int flags) Records a visit to a page.
-
Field Details
-
VISIT_TOP_LEVEL
static final int VISIT_TOP_LEVELThe URL was visited a top-level window.- See Also:
-
VISIT_REDIRECT_TEMPORARY
static final int VISIT_REDIRECT_TEMPORARYThe URL is the target of a temporary redirect.- See Also:
-
VISIT_REDIRECT_PERMANENT
static final int VISIT_REDIRECT_PERMANENTThe URL is the target of a permanent redirect.- See Also:
-
VISIT_REDIRECT_SOURCE
static final int VISIT_REDIRECT_SOURCEThe URL is temporarily redirected to another URL.- See Also:
-
VISIT_REDIRECT_SOURCE_PERMANENT
static final int VISIT_REDIRECT_SOURCE_PERMANENTThe URL is permanently redirected to another URL.- See Also:
-
VISIT_UNRECOVERABLE_ERROR
static final int VISIT_UNRECOVERABLE_ERRORThe URL failed to load due to a client or server error.- See Also:
-
-
Method Details
-
onVisited
@UiThread @Nullable default GeckoResult<Boolean> onVisited(@NonNull GeckoSession session, @NonNull String url, @Nullable String lastVisitedURL, int flags) Records a visit to a page.- Parameters:
session- The session where the URL was visited.url- The visited URL.lastVisitedURL- The last visited URL in this session, to detect redirects and reloads.flags- Additional flags for this visit, including redirect and error statuses. This is a bitmask of one or moreVISIT_*flags, OR-ed together.- Returns:
- A
GeckoResultcompleted with a boolean indicating whether to highlight links for the new URL as visited (true) or unvisited (false).
-
getVisited
@UiThread @Nullable default GeckoResult<boolean[]> getVisited(@NonNull GeckoSession session, @NonNull String[] urls) Returns the visited statuses for links on a page. This is used to highlight links as visited or unvisited, for example.- Parameters:
session- The session requesting the visited statuses.urls- A list of URLs to check.- Returns:
- A
GeckoResultcompleted with a list of booleans corresponding to the URLs inurls, and indicating whether to highlight links for each URL as visited (true) or unvisited (false).
-
onHistoryStateChange
@UiThread default void onHistoryStateChange(@NonNull GeckoSession session, @NonNull GeckoSession.HistoryDelegate.HistoryList historyList) Notifies the delegate that the navigation history state has changed.- Parameters:
session- The session where the history state changed.historyList- The updated history list for this session.
-