ProfileStore


@UiThread
public interface ProfileStore


Manages any creation, deletion for Profile.

Example usage:

   ProfileStore profileStore = ProfileStore.getInstance();

      

// Use this store instance to manage Profiles. Profile createdProfile = profileStore.getOrCreateProfile("test_profile"); createdProfile.getGeolocationPermissions().clear("example"); //... profileStore.deleteProfile("profile_test");

Summary

Public methods

abstract boolean
@RequiresFeature(name = WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
deleteProfile(@NonNull String name)

Deletes the profile data associated with the name.

abstract @NonNull List<String>
@RequiresFeature(name = WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
getAllProfileNames()

Returns the names of all available profiles.

default static @NonNull ProfileStore
@RequiresFeature(name = WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
getInstance()

Returns the production instance of ProfileStore.

abstract @NonNull Profile
@RequiresFeature(name = WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
getOrCreateProfile(@NonNull String name)

Returns a profile with the given name, creating if needed.

abstract @Nullable Profile
@RequiresFeature(name = WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
getProfile(@NonNull String name)

Returns a profile with the given name, if it exists.

Public methods

deleteProfile

Added in 1.9.0
@RequiresFeature(name = WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
abstract boolean deleteProfile(@NonNull String name)

Deletes the profile data associated with the name.

If this method returns true, the Profile object associated with the name will no longer be usable by the application. Returning false means that this profile doesn't exist.

Some data may be deleted async and is not guaranteed to be cleared from disk by the time this method returns.

Parameters
@NonNull String name

the profile name to be deleted.

Returns
boolean

true if profile exists and its data is to be deleted, otherwise false.

Throws
java.lang.IllegalStateException

if there are living WebViews associated with that profile.

java.lang.IllegalStateException

if you are trying to delete a Profile that was loaded in the memory using getOrCreateProfile} or getProfile.

java.lang.IllegalArgumentException

if you are trying to delete the default Profile.

getAllProfileNames

Added in 1.9.0
@RequiresFeature(name = WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
abstract @NonNull List<StringgetAllProfileNames()

Returns the names of all available profiles.

Default profile name will be included in this list.

Returns
@NonNull List<String>

profile names as a list.

getInstance

Added in 1.9.0
@RequiresFeature(name = WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
default static @NonNull ProfileStore getInstance()

Returns the production instance of ProfileStore.

Returns
@NonNull ProfileStore

ProfileStore instance to use for managing profiles.

getOrCreateProfile

Added in 1.9.0
@RequiresFeature(name = WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
abstract @NonNull Profile getOrCreateProfile(@NonNull String name)

Returns a profile with the given name, creating if needed.

Returns the associated Profile with this name, if there's no match with this name it will create a new Profile instance.

Parameters
@NonNull String name

name of the profile to retrieve.

Returns
@NonNull Profile

instance of Profile matching this name.

getProfile

Added in 1.9.0
@RequiresFeature(name = WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
abstract @Nullable Profile getProfile(@NonNull String name)

Returns a profile with the given name, if it exists.

Returns the associated Profile with this name, if there's no Profile with this name or the Profile was deleted by deleteProfile it will return null.

Parameters
@NonNull String name

the name of the profile to retrieve.

Returns
@Nullable Profile

instance of Profile matching this name, null otherwise if there's no match.