public interface

Profile

 androidx.webkit.Profile

Subclasses:

ProfileImpl

Gradle dependencies

compile group: 'androidx.webkit', name: 'webkit', version: '1.12.0-rc01'

  • groupId: androidx.webkit
  • artifactId: webkit
  • version: 1.12.0-rc01

Artifact androidx.webkit:webkit:1.12.0-rc01 it located at Google repository (https://maven.google.com/)

Androidx artifact mapping:

androidx.webkit:webkit com.android.support:webkit

Overview

A Profile represents one browsing session for WebView.

You can have multiple profiles and each profile holds its own set of data. The creation and deletion of the Profile is being managed by ProfileStore.

Summary

Fields
public static final java.lang.StringDEFAULT_PROFILE_NAME

Represents the name of the default profile which can't be deleted.

Methods
public CookieManagergetCookieManager()

Returns the profile's cookie manager.

public GeolocationPermissionsgetGeolocationPermissions()

Returns the geolocation permissions of the profile.

public java.lang.StringgetName()

public ServiceWorkerControllergetServiceWorkerController()

Returns the service worker controller of the profile.

public WebStoragegetWebStorage()

Returns the profile's web storage.

Fields

public static final java.lang.String DEFAULT_PROFILE_NAME

Represents the name of the default profile which can't be deleted.

Methods

public java.lang.String getName()

Returns:

the name of this Profile which was used to create the Profile from ProfileStore create methods.

public CookieManager getCookieManager()

Returns the profile's cookie manager.

Can be called from any thread.

public WebStorage getWebStorage()

Returns the profile's web storage.

Can be called from any thread.

public GeolocationPermissions getGeolocationPermissions()

Returns the geolocation permissions of the profile.

Can be called from any thread.

public ServiceWorkerController getServiceWorkerController()

Returns the service worker controller of the profile.

Can be called from any thread.

Source

/*
 * Copyright 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.webkit;

import android.webkit.CookieManager;
import android.webkit.GeolocationPermissions;
import android.webkit.ServiceWorkerController;
import android.webkit.WebStorage;

import androidx.annotation.NonNull;
import androidx.annotation.RequiresFeature;

/**
 * A Profile represents one browsing session for WebView.
 * <p> You can have multiple profiles and each profile holds its own set of data. The creation
 * and deletion of the Profile is being managed by {@link ProfileStore}.
 *
 */
public interface Profile {

    /**
     * Represents the name of the default profile which can't be deleted.
     */
    String DEFAULT_PROFILE_NAME = "Default";

    /**
     * @return the name of this Profile which was used to create the Profile from
     * ProfileStore create methods.
     */
    @NonNull
    @RequiresFeature(name = WebViewFeature.MULTI_PROFILE,
            enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
    String getName();

    /**
     * Returns the profile's cookie manager.
     * <p>
     * Can be called from any thread.
     *
     * @throws IllegalStateException if the profile has been deleted by
     * {@link ProfileStore#deleteProfile(String)}}.
     */
    @NonNull
    @RequiresFeature(name = WebViewFeature.MULTI_PROFILE,
            enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
    CookieManager getCookieManager();

    /**
     * Returns the profile's web storage.
     * <p>
     * Can be called from any thread.
     *
     * @throws IllegalStateException if the profile has been deleted by
     * {@link ProfileStore#deleteProfile(String)}}.
     */
    @NonNull
    @RequiresFeature(name = WebViewFeature.MULTI_PROFILE,
            enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
    WebStorage getWebStorage();

    /**
     * Returns the geolocation permissions of the profile.
     * <p>
     * Can be called from any thread.
     *
     * @throws IllegalStateException if the profile has been deleted by
     * {@link ProfileStore#deleteProfile(String)}}.
     */
    @NonNull
    @RequiresFeature(name = WebViewFeature.MULTI_PROFILE,
            enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
    GeolocationPermissions getGeolocationPermissions();

    /**
     * Returns the service worker controller of the profile.
     * <p>
     * Can be called from any thread.
     *
     * @throws IllegalStateException if the profile has been deleted by
     * {@link ProfileStore#deleteProfile(String)}}.
     */
    @NonNull
    @RequiresFeature(name = WebViewFeature.MULTI_PROFILE,
            enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
    ServiceWorkerController getServiceWorkerController();

}