Class GeckoSession
GeckoSession represents a single tab or browser window and provides APIs for loading content, handling navigation, managing permissions, and interacting with web content through various delegate interfaces.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceApp link launch type constants indicating how the app was started by the external intent.static @interfaceClipboard permission type definitions for clipboard access.static interfaceGeckoSession applications implement this interface to handle scroll events.static interfaceInterface for handling content-related events such as title changes, focus events, and context menus.static @interfaceFinder display flag definitions for find-in-page display options.static @interfaceFinder search flag definitions for find-in-page operations.static classRepresent the result of a find-in-page operation.static classThrown when failure occurs when printing from a website.static @interfaceKeep in sync with GeckoViewNavigation.javastatic interfaceAn interface for recording new history visits and fetching the visited status for links.static classMain entry point for loading URIs into aGeckoSession.static @interfaceLoad flags type definitions for nsIWebNavigation.static interfaceGeckoSession applications implement this interface to handle media events.static interfaceInterface for handling navigation events such as loading, redirects, and location changes.static classRepresent the result of a save-pdf operation.static @interfacePermission type definitions for web permissions.static interfaceGeckoSession applications implement this interface to handle requests for permissions from content, such as geolocation and notifications.static interfaceUsed for printing page content.static @interfaceThe priority of the GeckoSession, either default or high.static interfaceInterface for handling progress updates and security information during content loading.static interfaceGeckoSession applications implement this interface to handle prompts triggered by content in the GeckoSession, such as alerts, authentication dialogs, and select list pickers.static @interfaceRestart reason type definitions for text input restart.static interfaceGeckoSession applications implement this interface to handle content scroll events.classInformation about an update to the content's scroll position.static interfaceInterface for handling text selection actions and providing custom selection action items.static @interfaceSelection action type definitions for text selection operations.static @interfaceSelection flag type definitions for text selection state.static @interfaceSelection hide reason type definitions for text selection dismissal.static classClass representing a saved session state.static @interfaceTarget window type definitions for navigation target.static interfaceInterface that SessionTextInput uses for performing operations such as opening and closing the software keyboard.static @interfaceVisit flag type definitions for history visits.static classWebResponseInfo contains information about a single web response. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intApp link intent's launch type for cold start, i.e.static final intApp link intent's launch type for hot start, i.e.static final intApp link intent's launch type for unknown state, i.e.static final intApp link intent's launch type for warm start, i.e.static final intDim the rest of the page when showing a find-in-page match.static final intDraw outlines around matching links.static final intHighlight all find-in-page matches.static final intGo backwards when finding the next match.static final intGo forward when finding the next match.static final intLimit matches to links on the page.static final intPerform case-sensitive match; default is to perform a case-insensitive match.static final intMust match entire words; default is to allow matching partial words.static final intFilter headers according to the CORS safelisted rules.static final intAllows most headers.static final intPopup blocking will be disabled for this loadstatic final intBypass the cache.static final intBypass the URI classifier (content blocking and Safe Browsing).static final intThis load should bypass the NavigationDelegate.onLoadRequest.static final intBypass the proxy, if one has been configured.static final intThe load is coming from an external app.static final intAllows a top-level data: navigation to occur.static final intDefault load flag, no special considerations.static final intThis flag specifies that any existing history entry should be replaced.protected org.mozilla.geckoview.GeckoSession.WindowThe nsWindow connected to this GeckoSession; null if not attached.static final intValue for Priority when it is default.static final intValue for Priority when it is high. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new GeckoSession with default settings.GeckoSession(GeckoSessionSettings settings) Creates a new GeckoSession with the specified settings. -
Method Summary
Modifier and TypeMethodDescriptionAcquire the GeckoDisplay instance for providing the session with a drawing Surface.voidclose()Closes the session.Get whether this GeckoSession has form data.Prints the currently displayed page and provides dialog finished status or if an exception occured.voidExits fullscreen modevoidFlushes the currentGeckoSessionstate.Get the SessionAccessibility instance for this session.Provides an autofill structure similar toView.onProvideAutofillVirtualStructure(ViewStructure, int), but does not rely onViewStructureto build the tree.voidgetClientBounds(RectF rect) Get the bounds of the client area in client coordinates.voidgetClientToScreenMatrix(Matrix matrix) Get a matrix for transforming from client coordinates to screen coordinates.voidgetClientToSurfaceMatrix(Matrix matrix) Get a matrix for transforming from client coordinates to surface coordinates.Get the CompositorController instance for this session.Get the current compositor scroll callback handler.Get the content blocking callback handler.Get the content callback handler.static StringGet the default user agent for this GeckoView build.Gets the experiment delegate for this session.Get the SessionFinder instance for this session, to perform find-in-page operations.Get the Media callback handler.Get the media session delegate.Get the navigation callback handler.Get the OverscrollEdgeEffect instance for this session.voidgetPageToScreenMatrix(Matrix matrix) Get a matrix for transforming from page coordinates to screen coordinates.voidgetPageToSurfaceMatrix(Matrix matrix) Get a matrix for transforming from page coordinates to surface coordinates.Get the PanZoomController instance for this session.Get the SessionPdfFileSaver instance for this session, to save a pdf document.Get the current permission delegate for this GeckoSession.Gets the print delegate for this session.Get the progress callback handler.Get the current prompt delegate for this GeckoSession.Get the current scroll callback handler.Get the current selection action delegate for this GeckoSession.The session translation object coordinates receiving and sending session messages with the translations toolkit.Returns the settings used by this GeckoSession.voidgetSurfaceBounds(Rect rect) Get the bounds of the client area in surface coordinates.Get the SessionTextInput instance for this session.Get the translations delegate.Get the current user agent string for this GeckoSession.Get the web compatibility info when a site is reported as broken.Returns a WebExtensionController for this GeckoSession.voidgoBack()Go back in history and assumes the call was based on a user interaction.voidgoBack(boolean userInteraction) Go back in history.voidGo forward in history and assumes the call was based on a user interaction.voidgoForward(boolean userInteraction) Go forward in history.voidgotoHistoryIndex(int index) Navigate to an index in browser history; the index of the currently viewed page can be retrieved from an up-to-date HistoryList by callingGeckoSession.HistoryDelegate.HistoryList.getCurrentIndex().Checks whether we have a rule for this session.booleanisOpen()Return whether this session is open.isPdfJs()Check if the document being viewed is a pdf.voidload(GeckoSession.Loader request) Load page using theGeckoSession.Loaderspecified.voidLoad the given URI.voidopen(GeckoRuntime runtime) Opens the session.voidPrints the currently displayed page.voidPurge history for the session.voidreleaseDisplay(GeckoDisplay display) Release an acquired GeckoDisplay instance.voidreload()Reload the current URI.voidreload(int flags) Reload the current URI.voidRestore a saved state to this GeckoSession; only data that is saved (history, scroll position, zoom, and form data) will be restored.Saves a PDF of the currently displayed page.Send more web compatibility info when a site is reported as broken.voidsetActive(boolean active) Set this GeckoSession as active or inactive, which represents if the session is currently visible or not.voidsetAutofillDelegate(Autofill.Delegate delegate) Sets the autofill delegate for this session.voidSet the compositor scroll callback handler.voidSet the content blocking callback handler.voidSet the content callback handler.voidsetExperimentDelegate(ExperimentDelegate delegate) Sets the experiment delegate for this session.voidsetFocused(boolean focused) Move focus to this session or away from this session.voidSet the history tracking delegate for this session, replacing the current delegate if one is set.voidsetMediaDelegate(GeckoSession.MediaDelegate delegate) Set the media callback handler.voidsetMediaSessionDelegate(MediaSession.Delegate delegate) Set the media session delegate.voidSet the navigation callback handler.voidSet the current permission delegate for this GeckoSession.voidsetPrintDelegate(GeckoSession.PrintDelegate delegate) Sets the print delegate for this session.voidsetPriorityHint(int priorityHint) Notify GeckoView of the priority for this GeckoSession.voidSet the progress callback handler.voidsetPromptDelegate(GeckoSession.PromptDelegate delegate) Set the current prompt delegate for this GeckoSession.voidsetScrollDelegate(GeckoSession.ScrollDelegate delegate) Set the content scroll callback handler.voidSet the current selection action delegate for this GeckoSession.protected voidsetShouldPinOnScreen(boolean pinned) Sets whether the content should be pinned on screen.voidSet the translation delegate, which receives translations events.voidstop()Stop loading.
-
Field Details
-
mWindow
@Nullable protected org.mozilla.geckoview.GeckoSession.Window mWindowThe nsWindow connected to this GeckoSession; null if not attached. -
PRIORITY_DEFAULT
public static final int PRIORITY_DEFAULTValue for Priority when it is default.- See Also:
-
PRIORITY_HIGH
public static final int PRIORITY_HIGHValue for Priority when it is high.- See Also:
-
LOAD_FLAGS_NONE
public static final int LOAD_FLAGS_NONEDefault load flag, no special considerations.- See Also:
-
LOAD_FLAGS_BYPASS_CACHE
public static final int LOAD_FLAGS_BYPASS_CACHEBypass the cache.- See Also:
-
LOAD_FLAGS_BYPASS_PROXY
public static final int LOAD_FLAGS_BYPASS_PROXYBypass the proxy, if one has been configured.- See Also:
-
LOAD_FLAGS_EXTERNAL
public static final int LOAD_FLAGS_EXTERNALThe load is coming from an external app. Perform additional checks.- See Also:
-
LOAD_FLAGS_ALLOW_POPUPS
public static final int LOAD_FLAGS_ALLOW_POPUPSPopup blocking will be disabled for this load- See Also:
-
LOAD_FLAGS_BYPASS_CLASSIFIER
public static final int LOAD_FLAGS_BYPASS_CLASSIFIERBypass the URI classifier (content blocking and Safe Browsing).- See Also:
-
LOAD_FLAGS_FORCE_ALLOW_DATA_URI
public static final int LOAD_FLAGS_FORCE_ALLOW_DATA_URIAllows a top-level data: navigation to occur. E.g. view-image is an explicit user action which should be allowed.- See Also:
-
LOAD_FLAGS_REPLACE_HISTORY
public static final int LOAD_FLAGS_REPLACE_HISTORYThis flag specifies that any existing history entry should be replaced.- See Also:
-
LOAD_FLAGS_BYPASS_LOAD_URI_DELEGATE
public static final int LOAD_FLAGS_BYPASS_LOAD_URI_DELEGATEThis load should bypass the NavigationDelegate.onLoadRequest.- See Also:
-
HEADER_FILTER_CORS_SAFELISTED
public static final int HEADER_FILTER_CORS_SAFELISTEDFilter headers according to the CORS safelisted rules.- See Also:
-
HEADER_FILTER_UNRESTRICTED_UNSAFE
public static final int HEADER_FILTER_UNRESTRICTED_UNSAFEAllows most headers.Note: the
HostandConnectionheaders are still ignored.This should only be used when input is hard-coded from the app or when properly sanitized, as some headers could cause unexpected consequences and security issues.
Only use this if you know what you're doing.
- See Also:
-
APP_LINK_LAUNCH_TYPE_COLD
public static final int APP_LINK_LAUNCH_TYPE_COLDApp link intent's launch type for cold start, i.e. the app process was not running when the intent arrived.- See Also:
-
APP_LINK_LAUNCH_TYPE_WARM
public static final int APP_LINK_LAUNCH_TYPE_WARMApp link intent's launch type for warm start, i.e. the app process was alive, but the system created a new Activity instance to handle the intent.- See Also:
-
APP_LINK_LAUNCH_TYPE_HOT
public static final int APP_LINK_LAUNCH_TYPE_HOTApp link intent's launch type for hot start, i.e. the intent was delivered to an existing activity instance; no new activity was created.- See Also:
-
APP_LINK_LAUNCH_TYPE_UNKNOWN
public static final int APP_LINK_LAUNCH_TYPE_UNKNOWNApp link intent's launch type for unknown state, i.e. the launch type is not applicable or not yet determined.- See Also:
-
FINDER_FIND_FORWARD
public static final int FINDER_FIND_FORWARDGo forward when finding the next match.- See Also:
-
FINDER_FIND_BACKWARDS
public static final int FINDER_FIND_BACKWARDSGo backwards when finding the next match.- See Also:
-
FINDER_FIND_MATCH_CASE
public static final int FINDER_FIND_MATCH_CASEPerform case-sensitive match; default is to perform a case-insensitive match.- See Also:
-
FINDER_FIND_WHOLE_WORD
public static final int FINDER_FIND_WHOLE_WORDMust match entire words; default is to allow matching partial words.- See Also:
-
FINDER_FIND_LINKS_ONLY
public static final int FINDER_FIND_LINKS_ONLYLimit matches to links on the page.- See Also:
-
FINDER_DISPLAY_HIGHLIGHT_ALL
public static final int FINDER_DISPLAY_HIGHLIGHT_ALLHighlight all find-in-page matches.- See Also:
-
FINDER_DISPLAY_DIM_PAGE
public static final int FINDER_DISPLAY_DIM_PAGEDim the rest of the page when showing a find-in-page match.- See Also:
-
FINDER_DISPLAY_DRAW_LINK_OUTLINE
public static final int FINDER_DISPLAY_DRAW_LINK_OUTLINEDraw outlines around matching links.- See Also:
-
-
Constructor Details
-
GeckoSession
public GeckoSession()Creates a new GeckoSession with default settings. -
GeckoSession
Creates a new GeckoSession with the specified settings.- Parameters:
settings- The settings to configure this GeckoSession, or null to use defaults.
-
-
Method Details
-
getUserAgent
Get the current user agent string for this GeckoSession.- Returns:
- a
GeckoResultcontaining the UserAgent string
-
getDefaultUserAgent
Get the default user agent for this GeckoView build.This method does not account for any override that might have been applied to the user agent string.
- Returns:
- the default user agent string
-
getPermissionDelegate
Get the current permission delegate for this GeckoSession.- Returns:
- PermissionDelegate instance or null if using default delegate.
-
setPermissionDelegate
Set the current permission delegate for this GeckoSession.- Parameters:
delegate- PermissionDelegate instance or null to use the default delegate.
-
isOpen
@UiThread public boolean isOpen()Return whether this session is open.- Returns:
- True if session is open.
- See Also:
-
open
Opens the session.Call this when you are ready to use a GeckoSession instance.
The session is in a 'closed' state when first created. Opening it creates the underlying Gecko objects necessary to load a page, etc. Most GeckoSession methods only take affect on an open session, and are queued until the session is opened here. Opening a session is an asynchronous operation.
-
close
@UiThread public void close()Closes the session.This frees the underlying Gecko objects and unloads the current page. The session may be reopened later, but page state is not restored. Call this when you are finished using a GeckoSession instance.
-
getTextInput
Get the SessionTextInput instance for this session. May be called on any thread.- Returns:
- SessionTextInput instance.
-
getAccessibility
Get the SessionAccessibility instance for this session.- Returns:
- SessionAccessibility instance.
-
load
Load page using theGeckoSession.Loaderspecified.- Parameters:
request- Loader for this request.- See Also:
-
loadUri
Load the given URI.Convenience method for
session.load(new Loader().uri(uri));- Parameters:
uri- The URI of the resource to load.
-
reload
@AnyThread public void reload()Reload the current URI. -
reload
@AnyThread public void reload(int flags) Reload the current URI.- Parameters:
flags- the load flags to use, an OR-ed value ofLOAD_FLAGS_*
-
stop
@AnyThread public void stop()Stop loading. -
goBack
@AnyThread public void goBack()Go back in history and assumes the call was based on a user interaction.- See Also:
-
goBack
@AnyThread public void goBack(boolean userInteraction) Go back in history.- Parameters:
userInteraction- Whether the action was invoked by a user interaction.
-
goForward
@AnyThread public void goForward()Go forward in history and assumes the call was based on a user interaction.- See Also:
-
goForward
@AnyThread public void goForward(boolean userInteraction) Go forward in history.- Parameters:
userInteraction- Whether the action was invoked by a user interaction.
-
gotoHistoryIndex
@AnyThread public void gotoHistoryIndex(int index) Navigate to an index in browser history; the index of the currently viewed page can be retrieved from an up-to-date HistoryList by callingGeckoSession.HistoryDelegate.HistoryList.getCurrentIndex().- Parameters:
index- The index of the location in browser history you want to navigate to.
-
getWebExtensionController
Returns a WebExtensionController for this GeckoSession. Delegates attached to this controller will receive events specific to this session.- Returns:
- an instance of
WebExtension.SessionController.
-
purgeHistory
@AnyThread public void purgeHistory()Purge history for the session. The session history is used for back and forward history. Purging the session history meansGeckoSession.NavigationDelegate.onCanGoBack(GeckoSession, boolean)andGeckoSession.NavigationDelegate.onCanGoForward(GeckoSession, boolean)will be false. -
getFinder
Get the SessionFinder instance for this session, to perform find-in-page operations.- Returns:
- SessionFinder instance.
-
hasCookieBannerRuleForBrowsingContextTree
Checks whether we have a rule for this session. Uses the browsing context or any of its children, calls nsICookieBannerService.hasRuleForBrowsingContextTree- Returns:
GeckoResultwith boolean
-
getPdfFileSaver
Get the SessionPdfFileSaver instance for this session, to save a pdf document.- Returns:
- SessionPdfFileSaver instance.
-
isPdfJs
Check if the document being viewed is a pdf.- Returns:
- Result of the check operation as a
GeckoResultobject.
-
flushSessionState
@AnyThread public void flushSessionState()Flushes the currentGeckoSessionstate. This method triggers an asynchronous operation to flush the session state maintained by Gecko. The flush ensures that the most recent session data (such as navigation history and other stateful information) is captured and made available for persistence or inspection. Note: Since the operation is asynchronous, the flush may not complete immediately after this method returns. -
setActive
@AnyThread public void setActive(boolean active) Set this GeckoSession as active or inactive, which represents if the session is currently visible or not. Setting a GeckoSession to inactive will significantly reduce its memory footprint, but should only be done if the GeckoSession is not currently visible. Note that a session can be active (i.e. visible) but not focused. When a session is set inactive, it will flush the session state and trigger a `ProgressDelegate.onSessionStateChange` callback.- Parameters:
active- A boolean determining whether the GeckoSession is active.- See Also:
-
setFocused
@AnyThread public void setFocused(boolean focused) Move focus to this session or away from this session. Only one session has focus at a given time. Note that a session can be unfocused but still active (i.e. visible).- Parameters:
focused- True if the session should gain focus or false if the session should lose focus.- See Also:
-
setPriorityHint
@AnyThread public void setPriorityHint(int priorityHint) Notify GeckoView of the priority for this GeckoSession.Set this GeckoSession to high priority (PRIORITY_HIGH) whenever the app wants to signal to GeckoView that this GeckoSession is important to the app. GeckoView will keep the session state as long as possible. Set this to default priority (PRIORITY_DEFAULT) in any other case.
- Parameters:
priorityHint- Priority of the geckosession, either high priority or default.
-
restoreState
Restore a saved state to this GeckoSession; only data that is saved (history, scroll position, zoom, and form data) will be restored. These will overwrite the corresponding state of this GeckoSession.- Parameters:
state- A saved session state; this should originate from onSessionStateChange().
-
containsFormData
Get whether this GeckoSession has form data.- Returns:
- a
GeckoResultresult of if there is existing form data.
-
getWebCompatInfo
Get the web compatibility info when a site is reported as broken.- Returns:
- a
GeckoResultcontaining the WebCompatInfo as a JSONObject.
-
sendMoreWebCompatInfo
Send more web compatibility info when a site is reported as broken.- Parameters:
info- AJSONObjectcontaining the web compatibility report details. The expected format of the JSON object is:{ "reason": "User-selected reason for reporting", "description": "User-provided description of the issue", "endpointUrl": "https://webcompat.com/issues/new", "reportUrl": "URL of the reported site", "reporterConfig": { "src": "android-components-reporter", "utm_campaign": "report-site-issue-button", "utm_source": "android-components-reporter" }, "webcompatInfo": { //JSONObject from GeckoSession.getWebCompatInfo() } }- Returns:
- a
GeckoResultwil complete if sending more web compatibility info was successful. Will complete exceptionally if the web compat info was not sent.
-
acquireDisplay
Acquire the GeckoDisplay instance for providing the session with a drawing Surface. Be sure to callGeckoDisplay.surfaceChanged(SurfaceInfo)on the acquired display if there is already a valid Surface.- Returns:
- GeckoDisplay instance.
- See Also:
-
releaseDisplay
Release an acquired GeckoDisplay instance. Be sure to callGeckoDisplay.surfaceDestroyed()before releasing the display if it still has a valid Surface.- Parameters:
display- Acquired GeckoDisplay instance.- See Also:
-
getSettings
Returns the settings used by this GeckoSession.- Returns:
- The non-null GeckoSessionSettings for this session.
-
exitFullScreen
@AnyThread public void exitFullScreen()Exits fullscreen mode -
setContentDelegate
Set the content callback handler. This will replace the current handler.- Parameters:
delegate- An implementation of ContentDelegate.
-
getContentDelegate
Get the content callback handler.- Returns:
- The current content callback handler.
-
setProgressDelegate
Set the progress callback handler. This will replace the current handler.- Parameters:
delegate- An implementation of ProgressDelegate.
-
getProgressDelegate
Get the progress callback handler.- Returns:
- The current progress callback handler.
-
setScrollDelegate
Set the content scroll callback handler. This will replace the current handler.- Parameters:
delegate- An implementation of ScrollDelegate.
-
getScrollDelegate
Get the current scroll callback handler.- Returns:
- An implementation of ScrollDelegate.
-
setCompositorScrollDelegate
@UiThread public void setCompositorScrollDelegate(@Nullable GeckoSession.CompositorScrollDelegate delegate) Set the compositor scroll callback handler. This will replace the current handler.- Parameters:
delegate- An implementation of CompositorScrollDelegate.
-
getCompositorScrollDelegate
Get the current compositor scroll callback handler.- Returns:
- An implementation of CompositorScrollDelegate.
-
setHistoryDelegate
Set the history tracking delegate for this session, replacing the current delegate if one is set.- Parameters:
delegate- The history tracking delegate, ornullto unset.
-
getHistoryDelegate
- Returns:
- The history tracking delegate for this session.
-
setContentBlockingDelegate
Set the content blocking callback handler. This will replace the current handler.- Parameters:
delegate- An implementation ofContentBlocking.Delegate.
-
getContentBlockingDelegate
Get the content blocking callback handler.- Returns:
- The current content blocking callback handler.
-
setPromptDelegate
Set the current prompt delegate for this GeckoSession.- Parameters:
delegate- PromptDelegate instance or null to use the built-in delegate.
-
getPromptDelegate
Get the current prompt delegate for this GeckoSession.- Returns:
- PromptDelegate instance or null if using built-in delegate.
-
setSelectionActionDelegate
@UiThread public void setSelectionActionDelegate(@Nullable GeckoSession.SelectionActionDelegate delegate) Set the current selection action delegate for this GeckoSession.- Parameters:
delegate- SelectionActionDelegate instance or null to unset.
-
setMediaDelegate
Set the media callback handler. This will replace the current handler.- Parameters:
delegate- An implementation of MediaDelegate.
-
getMediaDelegate
Get the Media callback handler.- Returns:
- The current Media callback handler.
-
setMediaSessionDelegate
Set the media session delegate. This will replace the current handler.- Parameters:
delegate- An implementation ofMediaSession.Delegate.
-
getMediaSessionDelegate
Get the media session delegate.- Returns:
- The current media session delegate.
-
getSessionTranslation
The session translation object coordinates receiving and sending session messages with the translations toolkit. Notably, it can be used to request translations.- Returns:
- The current translation session coordinator.
-
setTranslationsSessionDelegate
@AnyThread public void setTranslationsSessionDelegate(@Nullable TranslationsController.SessionTranslation.Delegate delegate) Set the translation delegate, which receives translations events.- Parameters:
delegate- An implementation of @link{TranslationsController.SessionTranslation.Delegate}.
-
getTranslationsSessionDelegate
@AnyThread @Nullable public TranslationsController.SessionTranslation.Delegate getTranslationsSessionDelegate()Get the translations delegate. The application embedder must initially set the translations delegate for use.- Returns:
- The current translations delegate.
-
getSelectionActionDelegate
Get the current selection action delegate for this GeckoSession.- Returns:
- SelectionActionDelegate instance or null if not set.
-
setShouldPinOnScreen
@UiThread protected void setShouldPinOnScreen(boolean pinned) Sets whether the content should be pinned on screen.- Parameters:
pinned- true to pin the content on screen, false to unpin.
-
getPanZoomController
Get the PanZoomController instance for this session.- Returns:
- PanZoomController instance.
-
getOverscrollEdgeEffect
Get the OverscrollEdgeEffect instance for this session.- Returns:
- OverscrollEdgeEffect instance.
-
getCompositorController
Get the CompositorController instance for this session.- Returns:
- CompositorController instance.
-
getClientToSurfaceMatrix
Get a matrix for transforming from client coordinates to surface coordinates.- Parameters:
matrix- Matrix to be replaced by the transformation matrix.- See Also:
-
getClientToScreenMatrix
Get a matrix for transforming from client coordinates to screen coordinates. The client coordinates are in CSS pixels and are relative to the viewport origin; their relation to screen coordinates does not depend on the current scroll position.- Parameters:
matrix- Matrix to be replaced by the transformation matrix.- See Also:
-
getPageToScreenMatrix
Get a matrix for transforming from page coordinates to screen coordinates. The page coordinates are in CSS pixels and are relative to the page origin; their relation to screen coordinates depends on the current scroll position of the outermost frame.- Parameters:
matrix- Matrix to be replaced by the transformation matrix.- See Also:
-
getPageToSurfaceMatrix
Get a matrix for transforming from page coordinates to surface coordinates.- Parameters:
matrix- Matrix to be replaced by the transformation matrix.- See Also:
-
getClientBounds
Get the bounds of the client area in client coordinates. The returned top-left coordinates are always (0, 0). Use the matrix fromgetClientToSurfaceMatrix(Matrix)orgetClientToScreenMatrix(Matrix)to map these bounds to surface or screen coordinates, respectively.- Parameters:
rect- RectF to be replaced by the client bounds in client coordinates.- See Also:
-
getSurfaceBounds
Get the bounds of the client area in surface coordinates. This is equivalent to mapping the bounds returned by #getClientBounds(RectF) with the matrix returned by #getClientToSurfaceMatrix(Matrix).- Parameters:
rect- Rect to be replaced by the client bounds in surface coordinates.
-
setAutofillDelegate
Sets the autofill delegate for this session.- Parameters:
delegate- An instance ofAutofill.Delegate.
-
getAutofillDelegate
- Returns:
- The current
Autofill.Delegatefor this session, if any.
-
getAutofillSession
Provides an autofill structure similar toView.onProvideAutofillVirtualStructure(ViewStructure, int), but does not rely onViewStructureto build the tree. This is useful for apps that want to provide autofill functionality without using the Android autofill system or requiring API 26.- Returns:
- The elements available for autofill.
-
saveAsPdf
Saves a PDF of the currently displayed page.- Returns:
- A GeckoResult with an InputStream containing the PDF. The result could
CompleteExceptionally with a
GeckoSession.GeckoPrintExceptions, if there are any issues while generating the PDF.
-
printPageContent
@AnyThread public void printPageContent()Prints the currently displayed page. -
didPrintPageContent
Prints the currently displayed page and provides dialog finished status or if an exception occured.- Returns:
- if the printing dialog finished or an exception.
-
getPrintDelegate
Gets the print delegate for this session.- Returns:
- The current
GeckoSession.PrintDelegatefor this session, if any.
-
setPrintDelegate
Sets the print delegate for this session.- Parameters:
delegate- An instance ofGeckoSession.PrintDelegate.
-
getExperimentDelegate
Gets the experiment delegate for this session.- Returns:
- The current
ExperimentDelegatefor this session, if any.
-
setExperimentDelegate
Sets the experiment delegate for this session. Default is set to the runtime experiment delegate.- Parameters:
delegate- An instance ofExperimentDelegate.
-