Package org.mozilla.geckoview
Interface WebExtensionController.PromptDelegate
- Enclosing class:
- WebExtensionController
@UiThread
public static interface WebExtensionController.PromptDelegate
This delegate will be called whenever an extension is about to be installed or it needs new
permissions, e.g during an update or because it called
permissions.request
-
Method Summary
Modifier and TypeMethodDescriptiondefault GeckoResult<AllowOrDeny>
onInstallPrompt
(WebExtension extension) Called whenever a new extension is being installed.default GeckoResult<AllowOrDeny>
onOptionalPrompt
(WebExtension extension, String[] permissions, String[] origins) Called whenever permissions are requested.default GeckoResult<AllowOrDeny>
onUpdatePrompt
(WebExtension currentlyInstalled, WebExtension updatedExtension, String[] newPermissions, String[] newOrigins) Called whenever an updated extension has new permissions.
-
Method Details
-
onInstallPrompt
Called whenever a new extension is being installed. This is intended as an opportunity for the app to prompt the user for the permissions required by this extension.- Parameters:
extension
- TheWebExtension
that is about to be installed. You can useWebExtension.metaData
to gather information about this extension when building the user prompt dialog.- Returns:
- A
GeckoResult
that completes to eitherALLOW
if this extension should be installed orDENY
if this extension should not be installed. A null value will be interpreted asDENY
.
-
onUpdatePrompt
@Nullable default GeckoResult<AllowOrDeny> onUpdatePrompt(@NonNull WebExtension currentlyInstalled, @NonNull WebExtension updatedExtension, @NonNull String[] newPermissions, @NonNull String[] newOrigins) Called whenever an updated extension has new permissions. This is intended as an opportunity for the app to prompt the user for the new permissions required by this extension.- Parameters:
currentlyInstalled
- TheWebExtension
that is currently installed.updatedExtension
- TheWebExtension
that will replace the previous extension.newPermissions
- The new permissions that are needed.newOrigins
- The new origins that are needed.- Returns:
- A
GeckoResult
that completes to eitherALLOW
if this extension should be update orDENY
if this extension should not be update. A null value will be interpreted asDENY
.
-
onOptionalPrompt
@Nullable default GeckoResult<AllowOrDeny> onOptionalPrompt(@NonNull WebExtension extension, @NonNull String[] permissions, @NonNull String[] origins) Called whenever permissions are requested. This is intended as an opportunity for the app to prompt the user for the permissions required by this extension at runtime.- Parameters:
extension
- TheWebExtension
that is about to be installed. You can useWebExtension.metaData
to gather information about this extension when building the user prompt dialog.permissions
- The permissions that are requested.origins
- The requested host permissions.- Returns:
- A
GeckoResult
that completes to eitherALLOW
if the request should be approved orDENY
if the request should be denied. A null value will be interpreted asDENY
.
-