Package org.mozilla.geckoview
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 Summary
Modifier and TypeMethodDescriptiondefault GeckoResult<AllowOrDeny>
onCloseTab
(WebExtension source, GeckoSession session) Called when tabs.remove is invoked, this method decides if WebExtension can close the tab.default GeckoResult<AllowOrDeny>
onUpdateTab
(WebExtension extension, GeckoSession session, WebExtension.UpdateTabDetails details) Called when tabs.update is invoked.
-
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 ofWebExtension
session
- An instance ofGeckoSession
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 callloadURI
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
- TheGeckoSession
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.
-