Interface WebExtension.SessionTabDelegate

Enclosing class:
WebExtension

public static interface WebExtension.SessionTabDelegate
This delegate is invoked whenever an extension uses the `tabs` WebExtension API to modify the state of a tab. See also WebExtensions/API/tabs.
  • Method Details

    • onCloseTab

      @UiThread @NonNull default GeckoResult<AllowOrDeny> onCloseTab(@Nullable WebExtension source, @NonNull GeckoSession session)
      Called when tabs.remove is invoked, this method decides if WebExtension can close the tab. In case WebExtension can close the tab, it should close passed GeckoSession and return GeckoResult.ALLOW or GeckoResult.DENY in case tab cannot be closed.

      See also: WebExtensions/API/tabs/remove

      Parameters:
      source - An instance of WebExtension
      session - An instance of GeckoSession to be closed.
      Returns:
      GeckoResult.ALLOW if the tab will be closed, GeckoResult.DENY otherwise
    • onUpdateTab

      @UiThread @NonNull default GeckoResult<AllowOrDeny> onUpdateTab(@NonNull WebExtension extension, @NonNull GeckoSession session, @NonNull WebExtension.UpdateTabDetails details)
      Called when tabs.update is invoked. The uri is provided for informational purposes, there's no need to call loadURI on it. The page will be loaded if this method returns GeckoResult.ALLOW.

      See also: WebExtensions/API/tabs/update

      Parameters:
      extension - The extension that requested to update the tab.
      session - The GeckoSession instance that needs to be updated.
      details - WebExtension.UpdateTabDetails instance that describes what needs to be updated for this tab.
      Returns:
      GeckoResult.ALLOW if the tab will be updated, GeckoResult.DENY otherwise.