Class StorageController
Retrieve an instance via GeckoRuntime.getStorageController().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFlags used for data clearing operations.static @interfaceClear flags for storage controller operations. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclearData(long flags) Clear data for all hosts.voidclearDataForSessionContext(String contextId) Clear data for the given context ID.clearDataFromBaseDomain(String baseDomain, long flags) Clear data owned by the given base domain (eTLD+1).clearDataFromHost(String host, long flags) Clear data owned by the given host.Get all currently stored permissions.getPermissions(String uri) Get all currently stored permissions for a given URI and default (unset) context ID, in normal mode This API will be deprecated in the future https://bugzilla.mozilla.org/show_bug.cgi?id=1797379getPermissions(String uri, boolean privateMode) Get all currently stored permissions for a given URI and default (unset) context ID.getPermissions(String uri, String contextId, boolean privateMode) Get all currently stored permissions for a given URI and context ID.voidsetPermission(GeckoSession.PermissionDelegate.ContentPermission perm, int value) Set a new value for an existing permission.voidsetPrivateBrowsingPermanentPermission(GeckoSession.PermissionDelegate.ContentPermission perm, int value) Set a permanent value for a permission in a private browsing session.
-
Constructor Details
-
StorageController
public StorageController()
-
-
Method Details
-
clearData
Clear data for all hosts.Note: Any open session may re-accumulate previously cleared data. To ensure that no persistent data is left behind, you need to close all sessions prior to clearing data.
- Parameters:
flags- Combination ofStorageController.ClearFlags.- Returns:
- A
GeckoResultthat will complete when clearing has finished.
-
clearDataFromHost
@HandlerThread @NonNull public GeckoResult<Void> clearDataFromHost(@NonNull String host, long flags) Clear data owned by the given host. Clearing data for a host will not clear data created by its third-party origins.Note: Any open session may re-accumulate previously cleared data. To ensure that no persistent data is left behind, you need to close all sessions prior to clearing data.
- Parameters:
host- The host to be used.flags- Combination ofStorageController.ClearFlags.- Returns:
- A
GeckoResultthat will complete when clearing has finished.
-
clearDataFromBaseDomain
@HandlerThread @NonNull public GeckoResult<Void> clearDataFromBaseDomain(@NonNull String baseDomain, long flags) Clear data owned by the given base domain (eTLD+1). Clearing data for a base domain will also clear any associated third-party storage. This includes clearing for third-parties embedded by the domain and for the given domain embedded under other sites.Note: Any open session may re-accumulate previously cleared data. To ensure that no persistent data is left behind, you need to close all sessions prior to clearing data.
- Parameters:
baseDomain- The base domain to be used.flags- Combination ofStorageController.ClearFlags.- Returns:
- A
GeckoResultthat will complete when clearing has finished.
-
clearDataForSessionContext
Clear data for the given context ID. UseGeckoSessionSettings.Builder.contextId(java.lang.String).to set a context ID for a session.Note: Any open session may re-accumulate previously cleared data. To ensure that no persistent data is left behind, you need to close all sessions for the given context prior to clearing data.
- Parameters:
contextId- The context ID for the storage data to be deleted.
-
getAllPermissions
@HandlerThread @NonNull public GeckoResult<List<GeckoSession.PermissionDelegate.ContentPermission>> getAllPermissions()Get all currently stored permissions.- Returns:
- A
GeckoResultthat will complete with a list of all currently storedGeckoSession.PermissionDelegate.ContentPermissions.
-
getPermissions
@HandlerThread @NonNull public GeckoResult<List<GeckoSession.PermissionDelegate.ContentPermission>> getPermissions(@NonNull String uri) Get all currently stored permissions for a given URI and default (unset) context ID, in normal mode This API will be deprecated in the future https://bugzilla.mozilla.org/show_bug.cgi?id=1797379- Parameters:
uri- A String representing the URI to get permissions for.- Returns:
- A
GeckoResultthat will complete with a list of all currently storedGeckoSession.PermissionDelegate.ContentPermissions for the URI.
-
getPermissions
@HandlerThread @NonNull public GeckoResult<List<GeckoSession.PermissionDelegate.ContentPermission>> getPermissions(@NonNull String uri, boolean privateMode) Get all currently stored permissions for a given URI and default (unset) context ID.- Parameters:
uri- A String representing the URI to get permissions for.privateMode- indicate where theGeckoSession.PermissionDelegate.ContentPermissions should be in private or normal mode.- Returns:
- A
GeckoResultthat will complete with a list of all currently storedGeckoSession.PermissionDelegate.ContentPermissions for the URI.
-
getPermissions
@HandlerThread @NonNull public GeckoResult<List<GeckoSession.PermissionDelegate.ContentPermission>> getPermissions(@NonNull String uri, @Nullable String contextId, boolean privateMode) Get all currently stored permissions for a given URI and context ID.- Parameters:
uri- A String representing the URI to get permissions for.contextId- A String specifying the context ID.privateMode- indicate where theGeckoSession.PermissionDelegate.ContentPermissions should be in private or normal mode- Returns:
- A
GeckoResultthat will complete with a list of all currently storedGeckoSession.PermissionDelegate.ContentPermissions for the URI.
-
setPermission
@AnyThread public void setPermission(@NonNull GeckoSession.PermissionDelegate.ContentPermission perm, int value) Set a new value for an existing permission.Note: in private browsing, this value will only be cleared at the end of the session to add permanent permissions in private browsing, you can use
setPrivateBrowsingPermanentPermission(org.mozilla.geckoview.GeckoSession.PermissionDelegate.ContentPermission, int).- Parameters:
perm- AGeckoSession.PermissionDelegate.ContentPermissionthat you wish to update the value of.value- The new value for the permission.
-
setPrivateBrowsingPermanentPermission
@AnyThread public void setPrivateBrowsingPermanentPermission(@NonNull GeckoSession.PermissionDelegate.ContentPermission perm, int value) Set a permanent value for a permission in a private browsing session.Normally permissions in private browsing are cleared at the end of the session. This method allows you to set a permanent permission bypassing this behavior.
Note: permanent permissions in private browsing are web discoverable and might make the user more easily trackable.
- Parameters:
perm- AGeckoSession.PermissionDelegate.ContentPermissionthat you wish to update the value of.value- The new value for the permission.- See Also:
-