Interface GeckoSession.ContentDelegate

Enclosing class:
GeckoSession

public static interface GeckoSession.ContentDelegate
  • Method Details

    • onTitleChange

      @UiThread default void onTitleChange(@NonNull GeckoSession session, @Nullable String title)
      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

      @UiThread default void onFocusRequest(@NonNull GeckoSession session)
      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

      @UiThread default void onCloseRequest(@NonNull GeckoSession session)
      A page has requested to close
      Parameters:
      session - The GeckoSession that initiated the callback.
    • onFullScreen

      @UiThread default void onFullScreen(@NonNull GeckoSession session, boolean fullScreen)
      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:
    • onProductUrl

      @Deprecated @DeprecationSchedule(id="session-onProductUrl", version=131) @UiThread default void onProductUrl(@NonNull GeckoSession session)
      Deprecated.
      This method is scheduled for deprecation, see Bug 1898055 for details.

      Session is on a product url.

      Parameters:
      session - The GeckoSession that initiated the callback.
    • 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

      @UiThread default void onCrash(@NonNull GeckoSession session)
      The content process hosting this GeckoSession has crashed. The GeckoSession is now closed and unusable. You may call GeckoSession.open(GeckoRuntime) to recover the session, but no state is preserved. Most applications will want to call GeckoSession.load(org.mozilla.geckoview.GeckoSession.Loader) or GeckoSession.restoreState(SessionState) at this point.
      Parameters:
      session - The GeckoSession for which the content process has crashed.
    • onKill

      @UiThread default void onKill(@NonNull GeckoSession session)
      The content process hosting this GeckoSession has been killed. The GeckoSession is now closed and unusable. You may call GeckoSession.open(GeckoRuntime) to recover the session, but no state is preserved. Most applications will want to call GeckoSession.load(org.mozilla.geckoview.GeckoSession.Loader) or GeckoSession.restoreState(SessionState) at this point.
      Parameters:
      session - The GeckoSession for which the content process has been killed.
    • onFirstComposite

      @UiThread default void onFirstComposite(@NonNull GeckoSession session)
      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

      @UiThread default void onFirstContentfulPaint(@NonNull GeckoSession session)
      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 a onPaintStatusReset(GeckoSession) event. The function onFirstComposite(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

      @UiThread default void onPaintStatusReset(@NonNull GeckoSession session)
      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 Manifest
      manifest - A parsed and validated JSONObject 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

      @UiThread default void onShowDynamicToolbar(@NonNull GeckoSession geckoSession)
      The app should display its dynamic toolbar, fully expanded to the height that was previously specified via GeckoView.setDynamicToolbarMaxHeight(int).
      Parameters:
      geckoSession - GeckoSession that initiated the callback.
    • onHideDynamicToolbar

      @UiThread default void onHideDynamicToolbar(@NonNull GeckoSession geckoSession)
      The app should hide its dynamic toolbar.
      Parameters:
      geckoSession - GeckoSession that initiated the callback.
    • onCookieBannerDetected

      @AnyThread default void onCookieBannerDetected(@NonNull GeckoSession session)
      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

      @AnyThread default void onCookieBannerHandled(@NonNull GeckoSession session)
      This method is called when a cookie banner was handled.
      Parameters:
      session - GeckoSession that initiated the callback.