Interface GeckoSession.ContentDelegate
- Enclosing class:
- GeckoSession
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Element details for onContextMenu callbacks. -
Method Summary
Modifier and TypeMethodDescriptiondefault void
onCloseRequest
(GeckoSession session) A page has requested to closedefault void
onContextMenu
(GeckoSession session, int screenX, int screenY, GeckoSession.ContentDelegate.ContextElement element) A user has initiated the context menu via long-press.default void
onCookieBannerDetected
(GeckoSession session) This method is called when a cookie banner was detected.default void
onCookieBannerHandled
(GeckoSession session) This method is called when a cookie banner was handled.default void
onCrash
(GeckoSession session) The content process hosting this GeckoSession has crashed.default void
onExternalResponse
(GeckoSession session, WebResponse response) This is fired when there is a response that cannot be handled by Gecko (e.g., a download).default void
onFirstComposite
(GeckoSession session) Notification that the first content composition has occurred.default void
onFirstContentfulPaint
(GeckoSession session) Notification that the first content paint has occurred.default void
onFocusRequest
(GeckoSession session) A page has requested focus.default void
onFullScreen
(GeckoSession session, boolean fullScreen) A page has entered or exited full screen mode.default void
onHideDynamicToolbar
(GeckoSession geckoSession) The app should hide its dynamic toolbar.default void
onKill
(GeckoSession session) The content process hosting this GeckoSession has been killed.default void
onMetaViewportFitChange
(GeckoSession session, String viewportFit) A viewport-fit was discovered in the content or updated after the content.default void
onPaintStatusReset
(GeckoSession session) Notification that the paint status has been reset.default void
onPointerIconChange
(GeckoSession session, PointerIcon icon) A page has requested to change pointer icon.default void
onPreviewImage
(GeckoSession session, String previewImageUrl) A preview image was discovered in the content after the content loaded.default void
onShowDynamicToolbar
(GeckoSession geckoSession) The app should display its dynamic toolbar, fully expanded to the height that was previously specified viaGeckoView.setDynamicToolbarMaxHeight(int)
.default GeckoResult<SlowScriptResponse>
onSlowScript
(GeckoSession geckoSession, String scriptFileName) A script has exceeded its execution timeout valuedefault void
onTitleChange
(GeckoSession session, String title) A page title was discovered in the content or updated after the content loaded.default void
onWebAppManifest
(GeckoSession session, JSONObject manifest) This is fired when the loaded document has a valid Web App Manifest present.
-
Method Details
-
onTitleChange
A page title was discovered in the content or updated after the content loaded.- Parameters:
session
- The GeckoSession that initiated the callback.title
- The title sent from the content.
-
onPreviewImage
@UiThread default void onPreviewImage(@NonNull GeckoSession session, @NonNull String previewImageUrl) A preview image was discovered in the content after the content loaded.- Parameters:
session
- The GeckoSession that initiated the callback.previewImageUrl
- The preview image URL sent from the content.
-
onFocusRequest
A page has requested focus. Note that window.focus() in content will not result in this being called.- Parameters:
session
- The GeckoSession that initiated the callback.
-
onCloseRequest
A page has requested to close- Parameters:
session
- The GeckoSession that initiated the callback.
-
onFullScreen
A page has entered or exited full screen mode. Typically, the implementation would set the Activity containing the GeckoSession to full screen when the page is in full screen mode.- Parameters:
session
- The GeckoSession that initiated the callback.fullScreen
- True if the page is in full screen mode.
-
onMetaViewportFitChange
@UiThread default void onMetaViewportFitChange(@NonNull GeckoSession session, @NonNull String viewportFit) A viewport-fit was discovered in the content or updated after the content.- Parameters:
session
- The GeckoSession that initiated the callback.viewportFit
- The value of viewport-fit of meta element in content.- See Also:
-
onContextMenu
@UiThread default void onContextMenu(@NonNull GeckoSession session, int screenX, int screenY, @NonNull GeckoSession.ContentDelegate.ContextElement element) A user has initiated the context menu via long-press. This event is fired on links, (nested) images and (nested) media elements.- Parameters:
session
- The GeckoSession that initiated the callback.screenX
- The screen coordinates of the press.screenY
- The screen coordinates of the press.element
- The details for the pressed element.
-
onExternalResponse
@UiThread default void onExternalResponse(@NonNull GeckoSession session, @NonNull WebResponse response) This is fired when there is a response that cannot be handled by Gecko (e.g., a download).- Parameters:
session
- the GeckoSession that received the external response.response
- the external WebResponse.
-
onCrash
The content process hosting this GeckoSession has crashed. The GeckoSession is now closed and unusable. You may callGeckoSession.open(GeckoRuntime)
to recover the session, but no state is preserved. Most applications will want to callGeckoSession.load(org.mozilla.geckoview.GeckoSession.Loader)
orGeckoSession.restoreState(SessionState)
at this point.- Parameters:
session
- The GeckoSession for which the content process has crashed.
-
onKill
The content process hosting this GeckoSession has been killed. The GeckoSession is now closed and unusable. You may callGeckoSession.open(GeckoRuntime)
to recover the session, but no state is preserved. Most applications will want to callGeckoSession.load(org.mozilla.geckoview.GeckoSession.Loader)
orGeckoSession.restoreState(SessionState)
at this point.- Parameters:
session
- The GeckoSession for which the content process has been killed.
-
onFirstComposite
Notification that the first content composition has occurred. This callback is invoked for the first content composite after either a start or a restart of the compositor.- Parameters:
session
- The GeckoSession that had a first paint event.
-
onFirstContentfulPaint
Notification that the first content paint has occurred. This callback is invoked for the first content paint after a page has been loaded, or after aonPaintStatusReset(GeckoSession)
event. The functiononFirstComposite(GeckoSession)
will be called once the compositor has started rendering. However, it is possible for the compositor to start rendering before there is any content to render. onFirstContentfulPaint() is called once some content has been rendered. It may be nothing more than the page background color. It is not an indication that the whole page has been rendered.- Parameters:
session
- The GeckoSession that had a first paint event.
-
onPaintStatusReset
Notification that the paint status has been reset.This callback is invoked whenever the painted content is no longer being displayed. This can occur in response to the session being paused. After this has fired the compositor may continue rendering, but may not render the page content. This callback can therefore be used in conjunction with
onFirstContentfulPaint(GeckoSession)
to determine when there is valid content being rendered.- Parameters:
session
- The GeckoSession that had the paint status reset event.
-
onPointerIconChange
@UiThread default void onPointerIconChange(@NonNull GeckoSession session, @NonNull PointerIcon icon) A page has requested to change pointer icon.If the application wants to control pointer icon, it should override this, then handle it.
- Parameters:
session
- The GeckoSession that initiated the callback.icon
- The pointer icon sent from the content.
-
onWebAppManifest
@UiThread default void onWebAppManifest(@NonNull GeckoSession session, @NonNull JSONObject manifest) This is fired when the loaded document has a valid Web App Manifest present.The various colors (theme_color, background_color, etc.) present in the manifest have been transformed into #AARRGGBB format.
- Parameters:
session
- The GeckoSession that contains the Web App Manifestmanifest
- A parsed and validatedJSONObject
containing the manifest contents.- See Also:
-
onSlowScript
@UiThread @Nullable default GeckoResult<SlowScriptResponse> onSlowScript(@NonNull GeckoSession geckoSession, @NonNull String scriptFileName) A script has exceeded its execution timeout value- Parameters:
geckoSession
- GeckoSession that initiated the callback.scriptFileName
- Filename of the slow script- Returns:
- A
GeckoResult
with a SlowScriptResponse value which indicates whether to allow the Slow Script to continue processing. Stop will halt the slow script. Continue will pause notifications for a period of time before resuming.
-
onShowDynamicToolbar
The app should display its dynamic toolbar, fully expanded to the height that was previously specified viaGeckoView.setDynamicToolbarMaxHeight(int)
.- Parameters:
geckoSession
- GeckoSession that initiated the callback.
-
onHideDynamicToolbar
The app should hide its dynamic toolbar.- Parameters:
geckoSession
- GeckoSession that initiated the callback.
-
onCookieBannerDetected
This method is called when a cookie banner was detected.Note: this method is called only if the cookie banner setting is such that allows to handle the banner. For example, if cookiebanners.service.mode=1 (Reject only) but a cookie banner can only be accepted on the website - the detection in that case won't be reported. The exception is MODE_DETECT_ONLY mode, when only the detection event is emitted.
- Parameters:
session
- GeckoSession that initiated the callback.
-
onCookieBannerHandled
This method is called when a cookie banner was handled.- Parameters:
session
- GeckoSession that initiated the callback.
-