public class

WebSettingsAdapter

extends java.lang.Object

 java.lang.Object

↳androidx.webkit.internal.WebSettingsAdapter

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

Adapter between WebSettingsCompat and org.chromium.support_lib_boundary.WebSettingsBoundaryInterface (the corresponding interface shared with the support library glue in the WebView APK).

Summary

Constructors
publicWebSettingsAdapter(org.chromium.support_lib_boundary.WebSettingsBoundaryInterface boundaryInterface)

Methods
public intgetAttributionRegistrationBehavior()

Adapter method for WebSettingsCompat.getAttributionRegistrationBehavior(WebSettings)

public intgetDisabledActionModeMenuItems()

Adapter method for WebSettingsCompat.getDisabledActionModeMenuItems(WebSettings).

public booleangetEnterpriseAuthenticationAppLinkPolicyEnabled()

Adapter method for WebSettingsCompat.getEnterpriseAuthenticationAppLinkPolicyEnabled(WebSettings).

public intgetForceDark()

Adapter method for WebSettingsCompat.getForceDark(WebSettings).

public intgetForceDarkStrategy()

Adapter method for WebSettingsCompat.getForceDarkStrategy(WebSettings).

public booleangetOffscreenPreRaster()

Adapter method for WebSettingsCompat.getOffscreenPreRaster(WebSettings).

public java.util.Set<java.lang.String>getRequestedWithHeaderOriginAllowList()

Adapter method for WebSettingsCompat.getRequestedWithHeaderOriginAllowList(WebSettings).

public booleangetSafeBrowsingEnabled()

Adapter method for WebSettingsCompat.getSafeBrowsingEnabled(WebSettings).

public UserAgentMetadatagetUserAgentMetadata()

Adapter method for WebSettingsCompat.getUserAgentMetadata(WebSettings).

public WebViewMediaIntegrityApiStatusConfiggetWebViewMediaIntegrityApiStatus()

Adapter method for WebSettingsCompat.getWebViewMediaIntegrityApiStatus(WebSettings)

public booleanisAlgorithmicDarkeningAllowed()

Adapter method for WebSettingsCompat.isAlgorithmicDarkeningAllowed(WebSettings).

public voidsetAlgorithmicDarkeningAllowed(boolean allow)

Adapter method for WebSettingsCompat.setAlgorithmicDarkeningAllowed(WebSettings, boolean).

public voidsetAttributionRegistrationBehavior(int behavior)

Adapter method for WebSettingsCompat.setAttributionRegistrationBehavior(WebSettings, int)

public voidsetDisabledActionModeMenuItems(int menuItems)

Adapter method for WebSettingsCompat.setDisabledActionModeMenuItems(WebSettings, int).

public voidsetEnterpriseAuthenticationAppLinkPolicyEnabled(boolean enabled)

Adapter method for WebSettingsCompat.setEnterpriseAuthenticationAppLinkPolicyEnabled(WebSettings, boolean).

public voidsetForceDark(int forceDarkMode)

Adapter method for WebSettingsCompat.setForceDark(WebSettings, int).

public voidsetForceDarkStrategy(int forceDarkStrategy)

Adapter method for WebSettingsCompat.setForceDarkStrategy(WebSettings, int).

public voidsetOffscreenPreRaster(boolean enabled)

Adapter method for WebSettingsCompat.setOffscreenPreRaster(WebSettings, boolean).

public voidsetRequestedWithHeaderOriginAllowList(java.util.Set<java.lang.String> allowList)

Adapter method for WebSettingsCompat.setRequestedWithHeaderOriginAllowList(WebSettings, Set).

public voidsetSafeBrowsingEnabled(boolean enabled)

Adapter method for WebSettingsCompat.setSafeBrowsingEnabled(WebSettings, boolean).

public voidsetUserAgentMetadata(UserAgentMetadata uaMetadata)

Adapter method for WebSettingsCompat.setUserAgentMetadata(WebSettings, UserAgentMetadata).

public voidsetWebViewMediaIntegrityApiStatus(WebViewMediaIntegrityApiStatusConfig permissionConfig)

Adapter method for WebSettingsCompat.setWebViewMediaIntegrityApiStatus(WebSettings, WebViewMediaIntegrityApiStatusConfig)

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public WebSettingsAdapter(org.chromium.support_lib_boundary.WebSettingsBoundaryInterface boundaryInterface)

Methods

public void setOffscreenPreRaster(boolean enabled)

Adapter method for WebSettingsCompat.setOffscreenPreRaster(WebSettings, boolean).

public boolean getOffscreenPreRaster()

Adapter method for WebSettingsCompat.getOffscreenPreRaster(WebSettings).

public void setSafeBrowsingEnabled(boolean enabled)

Adapter method for WebSettingsCompat.setSafeBrowsingEnabled(WebSettings, boolean).

public boolean getSafeBrowsingEnabled()

Adapter method for WebSettingsCompat.getSafeBrowsingEnabled(WebSettings).

public void setDisabledActionModeMenuItems(int menuItems)

Adapter method for WebSettingsCompat.setDisabledActionModeMenuItems(WebSettings, int).

public int getDisabledActionModeMenuItems()

Adapter method for WebSettingsCompat.getDisabledActionModeMenuItems(WebSettings).

public void setForceDark(int forceDarkMode)

Adapter method for WebSettingsCompat.setForceDark(WebSettings, int).

public int getForceDark()

Adapter method for WebSettingsCompat.getForceDark(WebSettings).

public void setForceDarkStrategy(int forceDarkStrategy)

Adapter method for WebSettingsCompat.setForceDarkStrategy(WebSettings, int).

public int getForceDarkStrategy()

Adapter method for WebSettingsCompat.getForceDarkStrategy(WebSettings).

public void setAlgorithmicDarkeningAllowed(boolean allow)

Adapter method for WebSettingsCompat.setAlgorithmicDarkeningAllowed(WebSettings, boolean).

public boolean isAlgorithmicDarkeningAllowed()

Adapter method for WebSettingsCompat.isAlgorithmicDarkeningAllowed(WebSettings).

public void setEnterpriseAuthenticationAppLinkPolicyEnabled(boolean enabled)

Adapter method for WebSettingsCompat.setEnterpriseAuthenticationAppLinkPolicyEnabled(WebSettings, boolean).

public boolean getEnterpriseAuthenticationAppLinkPolicyEnabled()

Adapter method for WebSettingsCompat.getEnterpriseAuthenticationAppLinkPolicyEnabled(WebSettings).

public java.util.Set<java.lang.String> getRequestedWithHeaderOriginAllowList()

Adapter method for WebSettingsCompat.getRequestedWithHeaderOriginAllowList(WebSettings).

public void setRequestedWithHeaderOriginAllowList(java.util.Set<java.lang.String> allowList)

Adapter method for WebSettingsCompat.setRequestedWithHeaderOriginAllowList(WebSettings, Set).

public UserAgentMetadata getUserAgentMetadata()

Adapter method for WebSettingsCompat.getUserAgentMetadata(WebSettings).

public void setUserAgentMetadata(UserAgentMetadata uaMetadata)

Adapter method for WebSettingsCompat.setUserAgentMetadata(WebSettings, UserAgentMetadata).

public int getAttributionRegistrationBehavior()

Adapter method for WebSettingsCompat.getAttributionRegistrationBehavior(WebSettings)

public void setAttributionRegistrationBehavior(int behavior)

Adapter method for WebSettingsCompat.setAttributionRegistrationBehavior(WebSettings, int)

public void setWebViewMediaIntegrityApiStatus(WebViewMediaIntegrityApiStatusConfig permissionConfig)

Adapter method for WebSettingsCompat.setWebViewMediaIntegrityApiStatus(WebSettings, WebViewMediaIntegrityApiStatusConfig)

public WebViewMediaIntegrityApiStatusConfig getWebViewMediaIntegrityApiStatus()

Adapter method for WebSettingsCompat.getWebViewMediaIntegrityApiStatus(WebSettings)

Source

/*
 * Copyright 2018 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.internal;

import android.webkit.WebSettings;

import androidx.annotation.NonNull;
import androidx.webkit.UserAgentMetadata;
import androidx.webkit.WebViewMediaIntegrityApiStatusConfig;


import org.chromium.support_lib_boundary.WebSettingsBoundaryInterface;

import java.util.Set;

/**
 * Adapter between WebSettingsCompat and
 * {@link org.chromium.support_lib_boundary.WebSettingsBoundaryInterface} (the
 * corresponding interface shared with the support library glue in the WebView APK).
 */
public class WebSettingsAdapter {
    private final WebSettingsBoundaryInterface mBoundaryInterface;

    public WebSettingsAdapter(@NonNull WebSettingsBoundaryInterface boundaryInterface) {
        mBoundaryInterface = boundaryInterface;
    }

    /**
     * Adapter method for {@link androidx.webkit.WebSettingsCompat#setOffscreenPreRaster}.
     */
    public void setOffscreenPreRaster(boolean enabled) {
        mBoundaryInterface.setOffscreenPreRaster(enabled);
    }

    /**
     * Adapter method for {@link androidx.webkit.WebSettingsCompat#getOffscreenPreRaster}.
     */
    public boolean getOffscreenPreRaster() {
        return mBoundaryInterface.getOffscreenPreRaster();
    }

    /**
     * Adapter method for {@link androidx.webkit.WebSettingsCompat#setSafeBrowsingEnabled}.
     */
    public void setSafeBrowsingEnabled(boolean enabled) {
        mBoundaryInterface.setSafeBrowsingEnabled(enabled);
    }

    /**
     * Adapter method for {@link androidx.webkit.WebSettingsCompat#getSafeBrowsingEnabled}.
     */
    public boolean getSafeBrowsingEnabled() {
        return mBoundaryInterface.getSafeBrowsingEnabled();
    }

    /**
     * Adapter method for {@link androidx.webkit.WebSettingsCompat#setDisabledActionModeMenuItems}.
     */
    public void setDisabledActionModeMenuItems(int menuItems) {
        mBoundaryInterface.setDisabledActionModeMenuItems(menuItems);
    }

    /**
     * Adapter method for {@link androidx.webkit.WebSettingsCompat#getDisabledActionModeMenuItems}.
     */
    public int getDisabledActionModeMenuItems() {
        return mBoundaryInterface.getDisabledActionModeMenuItems();
    }

    /**
     * Adapter method for {@link androidx.webkit.WebSettingsCompat#setForceDark}.
     */
    public void setForceDark(int forceDarkMode) {
        mBoundaryInterface.setForceDark(forceDarkMode);
    }

    /**
     * Adapter method for {@link androidx.webkit.WebSettingsCompat#getForceDark}.
     */
    public int getForceDark() {
        return mBoundaryInterface.getForceDark();
    }

    /**
     * Adapter method for {@link androidx.webkit.WebSettingsCompat#setForceDarkStrategy}.
     */
    public void setForceDarkStrategy(int forceDarkStrategy) {
        mBoundaryInterface.setForceDarkBehavior(forceDarkStrategy);
    }

    /**
     * Adapter method for {@link androidx.webkit.WebSettingsCompat#getForceDarkStrategy}.
     */
    public int getForceDarkStrategy() {
        return mBoundaryInterface.getForceDarkBehavior();
    }

    /**
     * Adapter method for {@link androidx.webkit.WebSettingsCompat#setAlgorithmicDarkeningAllowed}.
     */
    public void setAlgorithmicDarkeningAllowed(boolean allow) {
        mBoundaryInterface.setAlgorithmicDarkeningAllowed(allow);
    }

    /**
     * Adapter method for {@link androidx.webkit.WebSettingsCompat#isAlgorithmicDarkeningAllowed}.
     */
    public boolean isAlgorithmicDarkeningAllowed() {
        return mBoundaryInterface.isAlgorithmicDarkeningAllowed();
    }

    /**
     * Adapter method for
     * {@link androidx.webkit.WebSettingsCompat#setEnterpriseAuthenticationAppLinkPolicyEnabled}.
     */
    public void setEnterpriseAuthenticationAppLinkPolicyEnabled(boolean enabled) {
        mBoundaryInterface.setEnterpriseAuthenticationAppLinkPolicyEnabled(enabled);
    }

    /**
     * Adapter method for
     * {@link androidx.webkit.WebSettingsCompat#getEnterpriseAuthenticationAppLinkPolicyEnabled}.
     */
    public boolean getEnterpriseAuthenticationAppLinkPolicyEnabled() {
        return mBoundaryInterface.getEnterpriseAuthenticationAppLinkPolicyEnabled();
    }

    /**
     * Adapter method for
     * {@link androidx.webkit.WebSettingsCompat#getRequestedWithHeaderOriginAllowList(WebSettings)}.
     */
    @NonNull
    public Set<String> getRequestedWithHeaderOriginAllowList() {
        return mBoundaryInterface.getRequestedWithHeaderOriginAllowList();
    }

    /**
     * Adapter method for
     * {@link androidx.webkit.WebSettingsCompat#setRequestedWithHeaderOriginAllowList(
     * WebSettings, Set)}.
     */
    public void setRequestedWithHeaderOriginAllowList(@NonNull Set<String> allowList) {
        mBoundaryInterface.setRequestedWithHeaderOriginAllowList(allowList);
    }

    /**
     * Adapter method for
     * {@link androidx.webkit.WebSettingsCompat#getUserAgentMetadata(WebSettings)}.
     */
    @NonNull
    public UserAgentMetadata getUserAgentMetadata() {
        return UserAgentMetadataInternal.getUserAgentMetadataFromMap(
                mBoundaryInterface.getUserAgentMetadataMap());
    }

    /**
     * Adapter method for
     * {@link androidx.webkit.WebSettingsCompat#setUserAgentMetadata(
     * WebSettings, UserAgentMetadata)}.
     */
    public void setUserAgentMetadata(@NonNull UserAgentMetadata uaMetadata) {
        mBoundaryInterface.setUserAgentMetadataFromMap(
                UserAgentMetadataInternal.convertUserAgentMetadataToMap(uaMetadata));
    }

    /**
     * Adapter method for
     * {@link androidx.webkit.WebSettingsCompat#getAttributionRegistrationBehavior(WebSettings)}
     */
    public int getAttributionRegistrationBehavior() {
        return mBoundaryInterface.getAttributionBehavior();
    }

    /**
     * Adapter method for
     * {@link androidx.webkit.WebSettingsCompat#setAttributionRegistrationBehavior(WebSettings, int)}
     */
    public void setAttributionRegistrationBehavior(int behavior) {
        mBoundaryInterface.setAttributionBehavior(behavior);
    }

    /**
     * Adapter method for
     * {@link androidx.webkit.WebSettingsCompat#setWebViewMediaIntegrityApiStatus(WebSettings, WebViewMediaIntegrityApiStatusConfig)}
     */
    public void setWebViewMediaIntegrityApiStatus(
            @NonNull WebViewMediaIntegrityApiStatusConfig permissionConfig) {
        mBoundaryInterface.setWebViewMediaIntegrityApiStatus(permissionConfig.getDefaultStatus(),
                permissionConfig.getOverrideRules());
    }

    /**
     * Adapter method for
     * {@link androidx.webkit.WebSettingsCompat#getWebViewMediaIntegrityApiStatus(WebSettings)}
     */
    @NonNull
    public WebViewMediaIntegrityApiStatusConfig getWebViewMediaIntegrityApiStatus() {
        return new WebViewMediaIntegrityApiStatusConfig
                .Builder(mBoundaryInterface.getWebViewMediaIntegrityApiDefaultStatus())
                .setOverrideRules(mBoundaryInterface.getWebViewMediaIntegrityApiOverrideRules())
                .build();
    }

}