Interface GeckoSession.PermissionDelegate

Enclosing class:
GeckoSession

public static interface GeckoSession.PermissionDelegate
GeckoSession applications implement this interface to handle requests for permissions from content, such as geolocation and notifications. For each permission, usually two requests are generated: one request for the Android app permission through requestAppPermissions, which is typically handled by a system permission dialog; and another request for the content permission (e.g. through requestContentPermission), which is typically handled by an app-specific permission dialog.

When denying an Android app permission, the response is not stored by GeckoView. It is the responsibility of the consumer to store the response state and therefore prevent further requests from being presented to the user.

  • Field Details

    • PERMISSION_GEOLOCATION

      static final int PERMISSION_GEOLOCATION
      Permission for using the geolocation API. See: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation
      See Also:
    • PERMISSION_DESKTOP_NOTIFICATION

      static final int PERMISSION_DESKTOP_NOTIFICATION
      Permission for using the notifications API. See: https://developer.mozilla.org/en-US/docs/Web/API/notification
      See Also:
    • PERMISSION_PERSISTENT_STORAGE

      static final int PERMISSION_PERSISTENT_STORAGE
      Permission for using the storage API. See: https://developer.mozilla.org/en-US/docs/Web/API/Storage_API
      See Also:
    • PERMISSION_XR

      static final int PERMISSION_XR
      Permission for using the WebXR API. See: https://www.w3.org/TR/webxr
      See Also:
    • PERMISSION_AUTOPLAY_INAUDIBLE

      static final int PERMISSION_AUTOPLAY_INAUDIBLE
      Permission for allowing autoplay of inaudible (silent) video.
      See Also:
    • PERMISSION_AUTOPLAY_AUDIBLE

      static final int PERMISSION_AUTOPLAY_AUDIBLE
      Permission for allowing autoplay of audible video.
      See Also:
    • PERMISSION_MEDIA_KEY_SYSTEM_ACCESS

      static final int PERMISSION_MEDIA_KEY_SYSTEM_ACCESS
      Permission for accessing system media keys used to decode DRM media.
      See Also:
    • PERMISSION_TRACKING

      static final int PERMISSION_TRACKING
      Permission for trackers to operate on the page -- disables all tracking protection features for a given site.
      See Also:
    • PERMISSION_STORAGE_ACCESS

      static final int PERMISSION_STORAGE_ACCESS
      Permission for third party frames to access first party cookies. May be granted heuristically in some cases.
      See Also:
  • Method Details

    • onAndroidPermissionsRequest

      @UiThread default void onAndroidPermissionsRequest(@NonNull GeckoSession session, @Nullable String[] permissions, @NonNull GeckoSession.PermissionDelegate.Callback callback)
      Request Android app permissions.
      Parameters:
      session - GeckoSession instance requesting the permissions.
      permissions - List of permissions to request; possible values are, android.Manifest.permission.ACCESS_COARSE_LOCATION android.Manifest.permission.ACCESS_FINE_LOCATION android.Manifest.permission.CAMERA android.Manifest.permission.RECORD_AUDIO
      callback - Callback interface.
    • onContentPermissionRequest

      @UiThread @Nullable default GeckoResult<Integer> onContentPermissionRequest(@NonNull GeckoSession session, @NonNull GeckoSession.PermissionDelegate.ContentPermission perm)
      Request content permission.

      Note, that in the case of PERMISSION_PERSISTENT_STORAGE, once permission has been granted for a site, it cannot be revoked. If the permission has previously been granted, it is the responsibility of the consuming app to remember the permission and prevent the prompt from being redisplayed to the user.

      Parameters:
      session - GeckoSession instance requesting the permission.
      perm - An GeckoSession.PermissionDelegate.ContentPermission describing the permission being requested and its current status.
      Returns:
      A GeckoResult resolving to one of VALUE_*, determining the response to the permission request and updating the permissions for this site.
    • onMediaPermissionRequest

      @UiThread default void onMediaPermissionRequest(@NonNull GeckoSession session, @NonNull String uri, @Nullable GeckoSession.PermissionDelegate.MediaSource[] video, @Nullable GeckoSession.PermissionDelegate.MediaSource[] audio, @NonNull GeckoSession.PermissionDelegate.MediaCallback callback)
      Request content media permissions, including request for which video and/or audio source to use.

      Media permissions will still be requested if the associated device permissions have been denied if there are video or audio sources in that category that can still be accessed. It is the responsibility of consumers to ensure that media permission requests are not displayed in this case.

      Parameters:
      session - GeckoSession instance requesting the permission.
      uri - The URI of the content requesting the permission.
      video - List of video sources, or null if not requesting video.
      audio - List of audio sources, or null if not requesting audio.
      callback - Callback interface.