diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-04-22 16:58:39 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-04-22 16:58:39 +0000 |
commit | eff087d2bc3760f98db2314a1025c6d652f7421e (patch) | |
tree | f11ecae27af6ce8a289d9cdc28c024649cb76712 | |
parent | 17be8a8f5ecd74381dcc1b5ff4b8841b9a70399b (diff) | |
parent | b505b3c3e3d5b197e64a62aa0be55dc1ea2b1dd0 (diff) | |
download | webview_support_interfaces-androidx-viewpager2-release.tar.gz |
Snap for 11740702 from b505b3c3e3d5b197e64a62aa0be55dc1ea2b1dd0 to androidx-viewpager2-releaseandroidx-viewpager2-release
Change-Id: I26471435dd73486c51bb6080d5934dde0a64ac48
39 files changed, 563 insertions, 155 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml deleted file mode 100644 index b11a3e8..0000000 --- a/AndroidManifest.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.chromium.support_lib_boundary"> - <!-- This AndroidManifest file only exists to provide package name needed by - gradle script to build these interfaces as part of AndroidX. --> -</manifest> @@ -1,4 +1,4 @@ -# Copyright 2017 The Chromium Authors. All rights reserved. +# Copyright 2017 The Chromium Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -6,26 +6,34 @@ import("//build/config/android/config.gni") import("//build/config/android/rules.gni") android_library("boundary_interface_java") { - java_files = [ + sources = [ + "src/org/chromium/support_lib_boundary/DropDataContentProviderBoundaryInterface.java", "src/org/chromium/support_lib_boundary/FeatureFlagHolderBoundaryInterface.java", "src/org/chromium/support_lib_boundary/IsomorphicObjectBoundaryInterface.java", "src/org/chromium/support_lib_boundary/JsReplyProxyBoundaryInterface.java", + "src/org/chromium/support_lib_boundary/ProcessGlobalConfigConstants.java", + "src/org/chromium/support_lib_boundary/ProfileBoundaryInterface.java", + "src/org/chromium/support_lib_boundary/ProfileStoreBoundaryInterface.java", "src/org/chromium/support_lib_boundary/ProxyControllerBoundaryInterface.java", "src/org/chromium/support_lib_boundary/SafeBrowsingResponseBoundaryInterface.java", + "src/org/chromium/support_lib_boundary/ScriptHandlerBoundaryInterface.java", "src/org/chromium/support_lib_boundary/ServiceWorkerClientBoundaryInterface.java", "src/org/chromium/support_lib_boundary/ServiceWorkerControllerBoundaryInterface.java", "src/org/chromium/support_lib_boundary/ServiceWorkerWebSettingsBoundaryInterface.java", "src/org/chromium/support_lib_boundary/StaticsBoundaryInterface.java", "src/org/chromium/support_lib_boundary/TracingControllerBoundaryInterface.java", "src/org/chromium/support_lib_boundary/VisualStateCallbackBoundaryInterface.java", + "src/org/chromium/support_lib_boundary/WebAuthnCallbackBoundaryInterface.java", "src/org/chromium/support_lib_boundary/WebMessageBoundaryInterface.java", "src/org/chromium/support_lib_boundary/WebMessageCallbackBoundaryInterface.java", "src/org/chromium/support_lib_boundary/WebMessageListenerBoundaryInterface.java", + "src/org/chromium/support_lib_boundary/WebMessagePayloadBoundaryInterface.java", "src/org/chromium/support_lib_boundary/WebMessagePortBoundaryInterface.java", "src/org/chromium/support_lib_boundary/WebResourceErrorBoundaryInterface.java", "src/org/chromium/support_lib_boundary/WebResourceRequestBoundaryInterface.java", "src/org/chromium/support_lib_boundary/WebSettingsBoundaryInterface.java", "src/org/chromium/support_lib_boundary/WebViewClientBoundaryInterface.java", + "src/org/chromium/support_lib_boundary/WebViewCookieManagerBoundaryInterface.java", "src/org/chromium/support_lib_boundary/WebViewProviderBoundaryInterface.java", "src/org/chromium/support_lib_boundary/WebViewProviderFactoryBoundaryInterface.java", "src/org/chromium/support_lib_boundary/WebViewRendererBoundaryInterface.java", @@ -41,13 +49,23 @@ android_library("boundary_interface_java") { # build when we mirror this into AndroidX. We are only permitted to depend on # core Android classes and other AndroidX classes (must be in the androidx.* # package name). - deps = [ - "//third_party/android_deps:androidx_annotation_annotation_java", - ] + deps = [ "//third_party/androidx:androidx_annotation_annotation_java" ] +} + +android_apk("boundary_interface_example_apk") { + apk_name = "BoundaryInterfaceExample" - # This is to verify the boundary interfaces compile and lint correctly against - # the minSdkVersion of the webkit support library module. As the minSdkVersion - # of the support library increases, so should this value. See + # Use a dummy android manifest since this code is copied to androidx. + android_manifest = "//build/android/AndroidManifest.xml" + + # This is to verify that the boundary interfaces compile and lint correctly + # against the minSdkVersion of the webkit support library module. As the + # minSdkVersion of the support library increases, so should this value. See # http://crbug.com/828184 for more details. - min_sdk_version = 14 + lint_min_sdk_version = 14 + + # Explicitly enable lint for this apk. + enable_lint = true + + deps = [ ":boundary_interface_java" ] } diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 300ab6c..0000000 --- a/build.gradle +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This file is to build WebView boundary interfaces as part of the AndroidX webkit library. -// It is not meant to be used or build any targets in chromium project. - -import androidx.build.SupportConfig - -plugins { - id('com.android.library') -} - -dependencies { - api("androidx.annotation:annotation:1.1.0") -} - -android { - // COMPILE_SDK_VERSION provided by AndroidX build scripts to build all AndroidX modules. - compileSdkVersion SupportConfig.COMPILE_SDK_VERSION - - sourceSets { - main.manifest.srcFile 'AndroidManifest.xml' - main.java.srcDirs += ['src'] - } - - buildTypes.all { - consumerProguardFiles 'proguard.flags' - } -} diff --git a/proguard.flags b/proguard.flags index 4a0d580..8938347 100644 --- a/proguard.flags +++ b/proguard.flags @@ -1,4 +1,4 @@ -# Copyright 2018 The Chromium Authors. All rights reserved. +# Copyright 2018 The Chromium Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/src/org/chromium/support_lib_boundary/DropDataContentProviderBoundaryInterface.java b/src/org/chromium/support_lib_boundary/DropDataContentProviderBoundaryInterface.java new file mode 100644 index 0000000..8872999 --- /dev/null +++ b/src/org/chromium/support_lib_boundary/DropDataContentProviderBoundaryInterface.java @@ -0,0 +1,43 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.support_lib_boundary; + +import android.content.ContentProvider; +import android.database.Cursor; +import android.net.Uri; +import android.os.Bundle; +import android.os.ParcelFileDescriptor; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import java.io.FileNotFoundException; + +/** Boundary interface for DropDataProvider. */ +public interface DropDataContentProviderBoundaryInterface { + boolean onCreate(); + + String[] getStreamTypes(@NonNull Uri uri, @NonNull String mimeTypeFilter); + + ParcelFileDescriptor openFile(@NonNull ContentProvider providerWrapper, @NonNull Uri uri) + throws FileNotFoundException; + + Cursor query( + @NonNull Uri uri, + @Nullable String[] projection, + @Nullable String selection, + @Nullable String[] selectionArgs, + @Nullable String sortOrder); + + String getType(@NonNull Uri uri); + + Uri cache(byte[] imageBytes, String encodingFormat, String filename); + + void setClearCachedDataIntervalMs(int milliseconds); + + void onDragEnd(boolean imageInUse); + + Bundle call(@NonNull String method, @Nullable String arg, @Nullable Bundle extras); +} diff --git a/src/org/chromium/support_lib_boundary/FeatureFlagHolderBoundaryInterface.java b/src/org/chromium/support_lib_boundary/FeatureFlagHolderBoundaryInterface.java index d2fa11e..df9dec7 100644 --- a/src/org/chromium/support_lib_boundary/FeatureFlagHolderBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/FeatureFlagHolderBoundaryInterface.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/src/org/chromium/support_lib_boundary/IsomorphicObjectBoundaryInterface.java b/src/org/chromium/support_lib_boundary/IsomorphicObjectBoundaryInterface.java index 7cccfc4..3063d44 100644 --- a/src/org/chromium/support_lib_boundary/IsomorphicObjectBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/IsomorphicObjectBoundaryInterface.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/src/org/chromium/support_lib_boundary/JsReplyProxyBoundaryInterface.java b/src/org/chromium/support_lib_boundary/JsReplyProxyBoundaryInterface.java index e2da069..7e70f21 100644 --- a/src/org/chromium/support_lib_boundary/JsReplyProxyBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/JsReplyProxyBoundaryInterface.java @@ -1,12 +1,15 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.support_lib_boundary; -/** - * Boundary interface for org.chromium.android_webview.WebMessageListener. - */ +import java.lang.reflect.InvocationHandler; + +/** Boundary interface for org.chromium.android_webview.WebMessageListener. */ public interface JsReplyProxyBoundaryInterface extends IsomorphicObjectBoundaryInterface { + /** Prefer using {@link #postMessageWithPayload}. */ void postMessage(String message); + + void postMessageWithPayload(/* MessagePayload */ InvocationHandler payload); } diff --git a/src/org/chromium/support_lib_boundary/ProcessGlobalConfigConstants.java b/src/org/chromium/support_lib_boundary/ProcessGlobalConfigConstants.java new file mode 100644 index 0000000..1f40347 --- /dev/null +++ b/src/org/chromium/support_lib_boundary/ProcessGlobalConfigConstants.java @@ -0,0 +1,43 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.support_lib_boundary; + +import androidx.annotation.RestrictTo; +import androidx.annotation.StringDef; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** Constants for ProcessGlobalConfig shared between chromium and AndroidX. */ +public final class ProcessGlobalConfigConstants { + private ProcessGlobalConfigConstants() {} + + /** @hide */ + @RestrictTo(RestrictTo.Scope.LIBRARY) + @StringDef(value = {DATA_DIRECTORY_SUFFIX, DATA_DIRECTORY_BASE_PATH, CACHE_DIRECTORY_BASE_PATH}) + @Retention(RetentionPolicy.SOURCE) + @Target({ElementType.PARAMETER, ElementType.METHOD}) + public @interface ProcessGlobalConfigMapKey {} + + /** + * Key for the data directory suffix in the process global config map that is read in chromium + * via reflection into AndroidX class. + */ + public static final String DATA_DIRECTORY_SUFFIX = "DATA_DIRECTORY_SUFFIX"; + + /** + * Key for the data directory base path in the process global config map that is read in + * chromium via reflection into AndroidX class. + */ + public static final String DATA_DIRECTORY_BASE_PATH = "DATA_DIRECTORY_BASE_PATH"; + + /** + * Key for the cache directory base path in the process global config map that is read in + * chromium via reflection into AndroidX class. + */ + public static final String CACHE_DIRECTORY_BASE_PATH = "CACHE_DIRECTORY_BASE_PATH"; +} diff --git a/src/org/chromium/support_lib_boundary/ProfileBoundaryInterface.java b/src/org/chromium/support_lib_boundary/ProfileBoundaryInterface.java new file mode 100644 index 0000000..457a561 --- /dev/null +++ b/src/org/chromium/support_lib_boundary/ProfileBoundaryInterface.java @@ -0,0 +1,23 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.support_lib_boundary; + +import android.webkit.CookieManager; +import android.webkit.GeolocationPermissions; +import android.webkit.ServiceWorkerController; +import android.webkit.WebStorage; + +/** Boundary interface for Profile. */ +public interface ProfileBoundaryInterface { + String getName(); + + CookieManager getCookieManager(); + + WebStorage getWebStorage(); + + GeolocationPermissions getGeoLocationPermissions(); + + ServiceWorkerController getServiceWorkerController(); +} diff --git a/src/org/chromium/support_lib_boundary/ProfileStoreBoundaryInterface.java b/src/org/chromium/support_lib_boundary/ProfileStoreBoundaryInterface.java new file mode 100644 index 0000000..1db724e --- /dev/null +++ b/src/org/chromium/support_lib_boundary/ProfileStoreBoundaryInterface.java @@ -0,0 +1,18 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.support_lib_boundary; + +import java.lang.reflect.InvocationHandler; +import java.util.List; + +public interface ProfileStoreBoundaryInterface { + /* ProfileBoundaryInterface */ InvocationHandler getOrCreateProfile(String name); + + /* ProfileBoundaryInterface */ InvocationHandler getProfile(String name); + + List<String> getAllProfileNames(); + + boolean deleteProfile(String name); +} diff --git a/src/org/chromium/support_lib_boundary/ProxyControllerBoundaryInterface.java b/src/org/chromium/support_lib_boundary/ProxyControllerBoundaryInterface.java index f9abc59..77e1644 100644 --- a/src/org/chromium/support_lib_boundary/ProxyControllerBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/ProxyControllerBoundaryInterface.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,11 +6,17 @@ package org.chromium.support_lib_boundary; import java.util.concurrent.Executor; -/** - * Boundary interface for ProxyController. - */ +/** Boundary interface for ProxyController. */ public interface ProxyControllerBoundaryInterface { void setProxyOverride( String[][] proxyRules, String[] bypassRules, Runnable listener, Executor executor); + + void setProxyOverride( + String[][] proxyRules, + String[] bypassRules, + Runnable listener, + Executor executor, + boolean reverseBypass); + void clearProxyOverride(Runnable listener, Executor executor); } diff --git a/src/org/chromium/support_lib_boundary/SafeBrowsingResponseBoundaryInterface.java b/src/org/chromium/support_lib_boundary/SafeBrowsingResponseBoundaryInterface.java index 737ef36..4419770 100644 --- a/src/org/chromium/support_lib_boundary/SafeBrowsingResponseBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/SafeBrowsingResponseBoundaryInterface.java @@ -1,14 +1,14 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.support_lib_boundary; -/** - * Boundary interface for SafeBrowsingResponseCompat. - */ +/** Boundary interface for SafeBrowsingResponseCompat. */ public interface SafeBrowsingResponseBoundaryInterface { void showInterstitial(boolean allowReporting); + void proceed(boolean report); + void backToSafety(boolean report); } diff --git a/src/org/chromium/support_lib_boundary/ScriptHandlerBoundaryInterface.java b/src/org/chromium/support_lib_boundary/ScriptHandlerBoundaryInterface.java new file mode 100644 index 0000000..c8134bb --- /dev/null +++ b/src/org/chromium/support_lib_boundary/ScriptHandlerBoundaryInterface.java @@ -0,0 +1,10 @@ +// Copyright 2020 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.support_lib_boundary; + +/** Boundary interface for AwContents.addDocumentStartJavascript(). */ +public interface ScriptHandlerBoundaryInterface { + void remove(); +} diff --git a/src/org/chromium/support_lib_boundary/ServiceWorkerClientBoundaryInterface.java b/src/org/chromium/support_lib_boundary/ServiceWorkerClientBoundaryInterface.java index ed7d30d..713ba5c 100644 --- a/src/org/chromium/support_lib_boundary/ServiceWorkerClientBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/ServiceWorkerClientBoundaryInterface.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,9 +7,7 @@ package org.chromium.support_lib_boundary; import android.webkit.WebResourceRequest; import android.webkit.WebResourceResponse; -/** - * Boundary interface for ServiceWorkerClient. - */ +/** Boundary interface for ServiceWorkerClient. */ public interface ServiceWorkerClientBoundaryInterface extends FeatureFlagHolderBoundaryInterface { WebResourceResponse shouldInterceptRequest(WebResourceRequest request); } diff --git a/src/org/chromium/support_lib_boundary/ServiceWorkerControllerBoundaryInterface.java b/src/org/chromium/support_lib_boundary/ServiceWorkerControllerBoundaryInterface.java index e25e3ed..9acb9a8 100644 --- a/src/org/chromium/support_lib_boundary/ServiceWorkerControllerBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/ServiceWorkerControllerBoundaryInterface.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,10 +6,9 @@ package org.chromium.support_lib_boundary; import java.lang.reflect.InvocationHandler; -/** - * Boundary interface for ServiceWorkerController. - */ +/** Boundary interface for ServiceWorkerController. */ public interface ServiceWorkerControllerBoundaryInterface { /* ServiceWorkerWebSettings */ InvocationHandler getServiceWorkerWebSettings(); + void setServiceWorkerClient(/* ServiceWorkerClient */ InvocationHandler client); } diff --git a/src/org/chromium/support_lib_boundary/ServiceWorkerWebSettingsBoundaryInterface.java b/src/org/chromium/support_lib_boundary/ServiceWorkerWebSettingsBoundaryInterface.java index dfd61fa..b308814 100644 --- a/src/org/chromium/support_lib_boundary/ServiceWorkerWebSettingsBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/ServiceWorkerWebSettingsBoundaryInterface.java @@ -1,12 +1,12 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.support_lib_boundary; -/** - * Boundary interface for ServiceWorkerWebSettings. - */ +import java.util.Set; + +/** Boundary interface for ServiceWorkerWebSettings. */ public interface ServiceWorkerWebSettingsBoundaryInterface { void setCacheMode(int mode); @@ -23,4 +23,8 @@ public interface ServiceWorkerWebSettingsBoundaryInterface { void setBlockNetworkLoads(boolean flag); boolean getBlockNetworkLoads(); + + void setRequestedWithHeaderOriginAllowList(Set<String> allowedOriginRules); + + Set<String> getRequestedWithHeaderOriginAllowList(); } diff --git a/src/org/chromium/support_lib_boundary/StaticsBoundaryInterface.java b/src/org/chromium/support_lib_boundary/StaticsBoundaryInterface.java index 648d416..d39558f 100644 --- a/src/org/chromium/support_lib_boundary/StaticsBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/StaticsBoundaryInterface.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,13 +9,19 @@ import android.net.Uri; import android.webkit.ValueCallback; import java.util.List; +import java.util.Set; -/** - * Boundary interface for WebViewFactoryProvider.Statics. - */ +/** Boundary interface for WebViewFactoryProvider.Statics. */ public interface StaticsBoundaryInterface { void initSafeBrowsing(Context context, ValueCallback<Boolean> callback); + + void setSafeBrowsingAllowlist(Set<String> hosts, ValueCallback<Boolean> callback); + void setSafeBrowsingWhitelist(List<String> hosts, ValueCallback<Boolean> callback); + Uri getSafeBrowsingPrivacyPolicyUrl(); + boolean isMultiProcessEnabled(); + + String getVariationsHeader(); } diff --git a/src/org/chromium/support_lib_boundary/TracingControllerBoundaryInterface.java b/src/org/chromium/support_lib_boundary/TracingControllerBoundaryInterface.java index 84b7a1e..c8606db 100644 --- a/src/org/chromium/support_lib_boundary/TracingControllerBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/TracingControllerBoundaryInterface.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,9 +8,7 @@ import java.io.OutputStream; import java.util.Collection; import java.util.concurrent.Executor; -/** - * Boundary interface for TracingController. - */ +/** Boundary interface for TracingController. */ public interface TracingControllerBoundaryInterface { boolean isTracing(); @@ -18,4 +16,4 @@ public interface TracingControllerBoundaryInterface { throws IllegalStateException, IllegalArgumentException; boolean stop(OutputStream outputStream, Executor executor); -}
\ No newline at end of file +} diff --git a/src/org/chromium/support_lib_boundary/VisualStateCallbackBoundaryInterface.java b/src/org/chromium/support_lib_boundary/VisualStateCallbackBoundaryInterface.java index 6fd25c5..f40b601 100644 --- a/src/org/chromium/support_lib_boundary/VisualStateCallbackBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/VisualStateCallbackBoundaryInterface.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,4 +6,6 @@ package org.chromium.support_lib_boundary; /** */ -public interface VisualStateCallbackBoundaryInterface { void onComplete(long requestId); } +public interface VisualStateCallbackBoundaryInterface { + void onComplete(long requestId); +} diff --git a/src/org/chromium/support_lib_boundary/WebAuthnCallbackBoundaryInterface.java b/src/org/chromium/support_lib_boundary/WebAuthnCallbackBoundaryInterface.java new file mode 100644 index 0000000..6eeaa41 --- /dev/null +++ b/src/org/chromium/support_lib_boundary/WebAuthnCallbackBoundaryInterface.java @@ -0,0 +1,18 @@ +// Copyright 2021 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.support_lib_boundary; + +import android.content.Intent; + +/** + * Boundary interface for the response to a WebAuthn intent. + * <p> + * An instance of this object is given to the embedder in <code>onWebAuthnIntent</code>. + * Once the result of the intent is known the method in this interface is called so that the + * embedder can pass the result back into Chromium. + */ +public interface WebAuthnCallbackBoundaryInterface { + void onResult(int resultCode, Intent intent); +} diff --git a/src/org/chromium/support_lib_boundary/WebMessageBoundaryInterface.java b/src/org/chromium/support_lib_boundary/WebMessageBoundaryInterface.java index dff7990..15a2e06 100644 --- a/src/org/chromium/support_lib_boundary/WebMessageBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/WebMessageBoundaryInterface.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,11 +6,12 @@ package org.chromium.support_lib_boundary; import java.lang.reflect.InvocationHandler; -/** - * Boundary interface for WebMessage. - */ +/** Boundary interface for WebMessage. */ public interface WebMessageBoundaryInterface extends FeatureFlagHolderBoundaryInterface { + @Deprecated String getData(); + /* MessagePayload */ InvocationHandler getMessagePayload(); + /* WebMessagePort */ InvocationHandler[] getPorts(); } diff --git a/src/org/chromium/support_lib_boundary/WebMessageCallbackBoundaryInterface.java b/src/org/chromium/support_lib_boundary/WebMessageCallbackBoundaryInterface.java index acac2dc..19cbcdd 100644 --- a/src/org/chromium/support_lib_boundary/WebMessageCallbackBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/WebMessageCallbackBoundaryInterface.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,10 +6,9 @@ package org.chromium.support_lib_boundary; import java.lang.reflect.InvocationHandler; -/** - * Boundary interface for WebMessagePort.WebMessageCallback. - */ +/** Boundary interface for WebMessagePort.WebMessageCallback. */ public interface WebMessageCallbackBoundaryInterface extends FeatureFlagHolderBoundaryInterface { - void onMessage(/* WebMessagePort */ InvocationHandler port, + void onMessage( + /* WebMessagePort */ InvocationHandler port, /* WebMessage */ InvocationHandler message); } diff --git a/src/org/chromium/support_lib_boundary/WebMessageListenerBoundaryInterface.java b/src/org/chromium/support_lib_boundary/WebMessageListenerBoundaryInterface.java index 92a393f..4527a09 100644 --- a/src/org/chromium/support_lib_boundary/WebMessageListenerBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/WebMessageListenerBoundaryInterface.java @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,10 +9,12 @@ import android.webkit.WebView; import java.lang.reflect.InvocationHandler; -/** - * Boundary interface for org.chromium.android_webview.WebMessageListener. - */ +/** Boundary interface for org.chromium.android_webview.WebMessageListener. */ public interface WebMessageListenerBoundaryInterface extends FeatureFlagHolderBoundaryInterface { - void onPostMessage(WebView view, /* WebMessage */ InvocationHandler message, Uri sourceOrigin, - boolean isMainFrame, /* JsReplyProxy */ InvocationHandler replyProxy); + void onPostMessage( + WebView view, + /* WebMessage */ InvocationHandler message, + Uri sourceOrigin, + boolean isMainFrame, + /* JsReplyProxy */ InvocationHandler replyProxy); } diff --git a/src/org/chromium/support_lib_boundary/WebMessagePayloadBoundaryInterface.java b/src/org/chromium/support_lib_boundary/WebMessagePayloadBoundaryInterface.java new file mode 100644 index 0000000..1b3061f --- /dev/null +++ b/src/org/chromium/support_lib_boundary/WebMessagePayloadBoundaryInterface.java @@ -0,0 +1,33 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.support_lib_boundary; + +import androidx.annotation.IntDef; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +/** Boundary interface for WebMessagePayload. */ +public interface WebMessagePayloadBoundaryInterface extends FeatureFlagHolderBoundaryInterface { + @WebMessagePayloadType + int getType(); + + @Nullable + String getAsString(); + + @NonNull + byte[] getAsArrayBuffer(); + + @Retention(RetentionPolicy.SOURCE) + @IntDef( + flag = true, + value = {WebMessagePayloadType.TYPE_STRING, WebMessagePayloadType.TYPE_ARRAY_BUFFER}) + @interface WebMessagePayloadType { + int TYPE_STRING = 0; + int TYPE_ARRAY_BUFFER = 1; + } +} diff --git a/src/org/chromium/support_lib_boundary/WebMessagePortBoundaryInterface.java b/src/org/chromium/support_lib_boundary/WebMessagePortBoundaryInterface.java index 3aacd26..95ba756 100644 --- a/src/org/chromium/support_lib_boundary/WebMessagePortBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/WebMessagePortBoundaryInterface.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,9 +8,7 @@ import android.os.Handler; import java.lang.reflect.InvocationHandler; -/** - * Boundary interface for WebMessagePort. - */ +/** Boundary interface for WebMessagePort. */ public interface WebMessagePortBoundaryInterface { void postMessage(/* WebMessage */ InvocationHandler message); diff --git a/src/org/chromium/support_lib_boundary/WebResourceErrorBoundaryInterface.java b/src/org/chromium/support_lib_boundary/WebResourceErrorBoundaryInterface.java index 953d8cb..93c9399 100644 --- a/src/org/chromium/support_lib_boundary/WebResourceErrorBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/WebResourceErrorBoundaryInterface.java @@ -1,13 +1,12 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.support_lib_boundary; -/** - * Boundary interface for WebResourceErrorCompat. - */ +/** Boundary interface for WebResourceErrorCompat. */ public interface WebResourceErrorBoundaryInterface { int getErrorCode(); + CharSequence getDescription(); } diff --git a/src/org/chromium/support_lib_boundary/WebResourceRequestBoundaryInterface.java b/src/org/chromium/support_lib_boundary/WebResourceRequestBoundaryInterface.java index b91100a..43629ce 100644 --- a/src/org/chromium/support_lib_boundary/WebResourceRequestBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/WebResourceRequestBoundaryInterface.java @@ -1,10 +1,10 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.support_lib_boundary; -/** - * Boundary interface for WebResourceRequest. - */ -public interface WebResourceRequestBoundaryInterface { boolean isRedirect(); } +/** Boundary interface for WebResourceRequest. */ +public interface WebResourceRequestBoundaryInterface { + boolean isRedirect(); +} diff --git a/src/org/chromium/support_lib_boundary/WebSettingsBoundaryInterface.java b/src/org/chromium/support_lib_boundary/WebSettingsBoundaryInterface.java index 426eb6d..f3a27ce 100644 --- a/src/org/chromium/support_lib_boundary/WebSettingsBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/WebSettingsBoundaryInterface.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,28 +9,39 @@ package org.chromium.support_lib_boundary; // app-facing classes should have a boundary-interface that the WebView glue layer can build // against. +import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.util.Map; +import java.util.Set; -/** - * Boundary interface for WebSettingsCompat. - */ +/** Boundary interface for WebSettingsCompat. */ public interface WebSettingsBoundaryInterface { void setOffscreenPreRaster(boolean enabled); + boolean getOffscreenPreRaster(); void setSafeBrowsingEnabled(boolean enabled); + boolean getSafeBrowsingEnabled(); void setDisabledActionModeMenuItems(int menuItems); + int getDisabledActionModeMenuItems(); void setWillSuppressErrorPage(boolean suppressed); + boolean getWillSuppressErrorPage(); void setForceDark(int forceDarkMode); + int getForceDark(); + void setAlgorithmicDarkeningAllowed(boolean allow); + + boolean isAlgorithmicDarkeningAllowed(); + @Retention(RetentionPolicy.SOURCE) @interface ForceDarkBehavior { int FORCE_DARK_ONLY = 0; @@ -39,6 +50,61 @@ public interface WebSettingsBoundaryInterface { } void setForceDarkBehavior(@ForceDarkBehavior int forceDarkBehavior); + @ForceDarkBehavior int getForceDarkBehavior(); + + @Retention(RetentionPolicy.SOURCE) + @interface WebauthnSupport { + int NONE = 0; + int APP = 1; + int BROWSER = 2; + } + + void setWebauthnSupport(@WebauthnSupport int support); + + @WebauthnSupport + int getWebauthnSupport(); + + void setRequestedWithHeaderOriginAllowList(Set<String> allowedOriginRules); + + Set<String> getRequestedWithHeaderOriginAllowList(); + + void setEnterpriseAuthenticationAppLinkPolicyEnabled(boolean enabled); + + boolean getEnterpriseAuthenticationAppLinkPolicyEnabled(); + + void setUserAgentMetadataFromMap(Map<String, Object> uaMetadata); + + Map<String, Object> getUserAgentMetadataMap(); + + @Retention(RetentionPolicy.SOURCE) + @interface AttributionBehavior { + int DISABLED = 0; + int APP_SOURCE_AND_WEB_TRIGGER = 1; + int WEB_SOURCE_AND_WEB_TRIGGER = 2; + int APP_SOURCE_AND_APP_TRIGGER = 3; + } + + void setAttributionBehavior(@AttributionBehavior int behavior); + + @AttributionBehavior + int getAttributionBehavior(); + + @Target(ElementType.TYPE_USE) + @Retention(RetentionPolicy.SOURCE) + @interface WebViewMediaIntegrityApiStatus { + int DISABLED = 0; + int ENABLED_WITHOUT_APP_IDENTITY = 1; + int ENABLED = 2; + } + + void setWebViewMediaIntegrityApiStatus( + @WebViewMediaIntegrityApiStatus int defaultPermission, + Map<String, @WebViewMediaIntegrityApiStatus Integer> permissionConfig); + + @WebViewMediaIntegrityApiStatus + int getWebViewMediaIntegrityApiDefaultStatus(); + + Map<String, @WebViewMediaIntegrityApiStatus Integer> getWebViewMediaIntegrityApiOverrideRules(); } diff --git a/src/org/chromium/support_lib_boundary/WebViewClientBoundaryInterface.java b/src/org/chromium/support_lib_boundary/WebViewClientBoundaryInterface.java index 9cdde0d..17cdee1 100644 --- a/src/org/chromium/support_lib_boundary/WebViewClientBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/WebViewClientBoundaryInterface.java @@ -1,25 +1,38 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.support_lib_boundary; +import android.app.PendingIntent; import android.webkit.WebResourceRequest; import android.webkit.WebResourceResponse; import android.webkit.WebView; import java.lang.reflect.InvocationHandler; -/** - * Boundary interface for WebViewClientCompat. - */ +/** Boundary interface for WebViewClientCompat. */ public interface WebViewClientBoundaryInterface extends FeatureFlagHolderBoundaryInterface { void onPageCommitVisible(WebView view, String url); - void onReceivedError(WebView view, WebResourceRequest request, + + void onReceivedError( + WebView view, + WebResourceRequest request, /* WebResourceError */ InvocationHandler error); + void onReceivedHttpError( WebView view, WebResourceRequest request, WebResourceResponse errorResponse); - void onSafeBrowsingHit(WebView view, WebResourceRequest request, int threatType, + + void onSafeBrowsingHit( + WebView view, + WebResourceRequest request, + int threatType, /* SafeBrowsingResponse */ InvocationHandler callback); + boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request); + + boolean onWebAuthnIntent( + WebView view, + PendingIntent intent, + /* WebAuthnCallbackBoundaryInterface */ InvocationHandler callback); } diff --git a/src/org/chromium/support_lib_boundary/WebViewCookieManagerBoundaryInterface.java b/src/org/chromium/support_lib_boundary/WebViewCookieManagerBoundaryInterface.java new file mode 100644 index 0000000..64bd71f --- /dev/null +++ b/src/org/chromium/support_lib_boundary/WebViewCookieManagerBoundaryInterface.java @@ -0,0 +1,12 @@ +// Copyright 2018 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.support_lib_boundary; + +import java.util.List; + +/** Boundary interface for CookieManagerCompat. */ +public interface WebViewCookieManagerBoundaryInterface { + List<String> getCookieInfo(String url); +} diff --git a/src/org/chromium/support_lib_boundary/WebViewProviderBoundaryInterface.java b/src/org/chromium/support_lib_boundary/WebViewProviderBoundaryInterface.java index bb677ef..717b3d3 100644 --- a/src/org/chromium/support_lib_boundary/WebViewProviderBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/WebViewProviderBoundaryInterface.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,17 +13,39 @@ import java.lang.reflect.InvocationHandler; /** */ public interface WebViewProviderBoundaryInterface { - void insertVisualStateCallback(long requestId, - /* VisualStateCallback */ InvocationHandler callback); + void insertVisualStateCallback( + long requestId, /* VisualStateCallback */ InvocationHandler callback); + /* WebMessagePort */ InvocationHandler[] createWebMessageChannel(); + void postMessageToMainFrame(/* WebMessage */ InvocationHandler message, Uri targetOrigin); - void addWebMessageListener(String jsObjectName, String[] allowedOriginRules, + + void addWebMessageListener( + String jsObjectName, + String[] allowedOriginRules, /* WebMessageListener */ InvocationHandler listener); + void removeWebMessageListener(String jsObjectName); + + /* ScriptHandler */ InvocationHandler addDocumentStartJavaScript( + String script, String[] allowedOriginRules); + WebViewClient getWebViewClient(); + WebChromeClient getWebChromeClient(); + /* WebViewRenderer */ InvocationHandler getWebViewRenderer(); + /* WebViewRendererClient */ InvocationHandler getWebViewRendererClient(); + void setWebViewRendererClient( /* WebViewRendererClient */ InvocationHandler webViewRendererClient); + + void setProfile(String profileName); + + void setAudioMuted(boolean muted); + + boolean isAudioMuted(); + + /* Profile */ InvocationHandler getProfile(); } diff --git a/src/org/chromium/support_lib_boundary/WebViewProviderFactoryBoundaryInterface.java b/src/org/chromium/support_lib_boundary/WebViewProviderFactoryBoundaryInterface.java index 15db689..521c7bb 100644 --- a/src/org/chromium/support_lib_boundary/WebViewProviderFactoryBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/WebViewProviderFactoryBoundaryInterface.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,10 +12,20 @@ import java.lang.reflect.InvocationHandler; */ public interface WebViewProviderFactoryBoundaryInterface { /* SupportLibraryWebViewChromium */ InvocationHandler createWebView(WebView webview); + /* SupportLibWebkitToCompatConverter */ InvocationHandler getWebkitToCompatConverter(); + /* StaticsAdapter */ InvocationHandler getStatics(); + String[] getSupportedFeatures(); + /* SupportLibraryServiceWorkerController */ InvocationHandler getServiceWorkerController(); + /* SupportLibraryTracingController */ InvocationHandler getTracingController(); + /* SupportLibraryProxyController */ InvocationHandler getProxyController(); + + /* DropDataContentProviderBoundaryInterface*/ InvocationHandler getDropDataProvider(); + + /* ProfileStoreBoundaryInterface */ InvocationHandler getProfileStore(); } diff --git a/src/org/chromium/support_lib_boundary/WebViewRendererBoundaryInterface.java b/src/org/chromium/support_lib_boundary/WebViewRendererBoundaryInterface.java index 829c6e1..5f52afd 100644 --- a/src/org/chromium/support_lib_boundary/WebViewRendererBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/WebViewRendererBoundaryInterface.java @@ -1,12 +1,10 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.support_lib_boundary; -/** - * Boundary interface for WebViewRenderer. - */ +/** Boundary interface for WebViewRenderer. */ public interface WebViewRendererBoundaryInterface extends IsomorphicObjectBoundaryInterface { boolean terminate(); } diff --git a/src/org/chromium/support_lib_boundary/WebViewRendererClientBoundaryInterface.java b/src/org/chromium/support_lib_boundary/WebViewRendererClientBoundaryInterface.java index 043ca66..6e3f4f2 100644 --- a/src/org/chromium/support_lib_boundary/WebViewRendererClientBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/WebViewRendererClientBoundaryInterface.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,10 +8,9 @@ import android.webkit.WebView; import java.lang.reflect.InvocationHandler; -/** - * Boundary interface for WebViewRendererClient. - */ +/** Boundary interface for WebViewRendererClient. */ public interface WebViewRendererClientBoundaryInterface extends FeatureFlagHolderBoundaryInterface { void onRendererUnresponsive(WebView view, /* WebViewRenderer */ InvocationHandler renderer); + void onRendererResponsive(WebView view, /* WebViewRenderer */ InvocationHandler renderer); } diff --git a/src/org/chromium/support_lib_boundary/WebkitToCompatConverterBoundaryInterface.java b/src/org/chromium/support_lib_boundary/WebkitToCompatConverterBoundaryInterface.java index 1913b86..c5ab5fe 100644 --- a/src/org/chromium/support_lib_boundary/WebkitToCompatConverterBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/WebkitToCompatConverterBoundaryInterface.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,6 +21,7 @@ public interface WebkitToCompatConverterBoundaryInterface { // ==================================================== /* SupportLibraryWebSettings */ InvocationHandler convertSettings(WebSettings webSettings); + /* SupportLibraryWebResourceRequest */ InvocationHandler convertWebResourceRequest( WebResourceRequest request); @@ -43,24 +44,32 @@ public interface WebkitToCompatConverterBoundaryInterface { // ServiceWorkerWebSettings /* SupportLibServiceWorkerSettings */ InvocationHandler convertServiceWorkerSettings( /* ServiceWorkerWebSettings */ Object serviceWorkerWebSettings); + /* ServiceWorkerWebSettings */ Object convertServiceWorkerSettings( /* SupportLibServiceWorkerSettings */ InvocationHandler serviceWorkerSettings); // WebResourceError /* SupportLibWebResourceError */ InvocationHandler convertWebResourceError( /* WebResourceError */ Object webResourceError); + /* WebResourceError */ Object convertWebResourceError( /* SupportLibWebResourceError */ InvocationHandler webResourceError); // SafeBrowsingResponse /* SupportLibSafeBrowsingResponse */ InvocationHandler convertSafeBrowsingResponse( /* SafeBrowsingResponse */ Object safeBrowsingResponse); + /* SafeBrowsingResponse */ Object convertSafeBrowsingResponse( /* SupportLibSafeBrowsingResponse */ InvocationHandler safeBrowsingResponse); // WebMessagePort /* SupportLibWebMessagePort */ InvocationHandler convertWebMessagePort( /* WebMessagePort */ Object webMessagePort); + /* WebMessagePort */ Object convertWebMessagePort( /* SupportLibWebMessagePort */ InvocationHandler webMessagePort); + + // CookieManager + /* SupportLibWebViewCookieManager */ InvocationHandler convertCookieManager( + Object cookieManager); } diff --git a/src/org/chromium/support_lib_boundary/package-info.java b/src/org/chromium/support_lib_boundary/package-info.java index 053f844..47ab7de 100644 --- a/src/org/chromium/support_lib_boundary/package-info.java +++ b/src/org/chromium/support_lib_boundary/package-info.java @@ -1,8 +1,6 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -/** - * @hide - */ +/** @hide */ package org.chromium.support_lib_boundary; diff --git a/src/org/chromium/support_lib_boundary/util/BoundaryInterfaceReflectionUtil.java b/src/org/chromium/support_lib_boundary/util/BoundaryInterfaceReflectionUtil.java index 1c5f369..a19dcd0 100644 --- a/src/org/chromium/support_lib_boundary/util/BoundaryInterfaceReflectionUtil.java +++ b/src/org/chromium/support_lib_boundary/util/BoundaryInterfaceReflectionUtil.java @@ -1,14 +1,13 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.support_lib_boundary.util; -import android.annotation.SuppressLint; -import android.annotation.TargetApi; import android.os.Build; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.annotation.RequiresApi; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; @@ -17,12 +16,9 @@ import java.lang.reflect.Proxy; import java.util.Arrays; import java.util.Collection; -/** - * A set of utility methods used for calling across the support library boundary. - */ +/** A set of utility methods used for calling across the support library boundary. */ // Although this is not enforced in chromium, this is a requirement enforced when this file is // mirrored into AndroidX. See http://b/120770118 for details. -@SuppressLint("BanTargetApiAnnotation") public class BoundaryInterfaceReflectionUtil { /** * Check if an object is an instance of {@code className}, resolving {@code className} in @@ -76,8 +72,10 @@ public class BoundaryInterfaceReflectionUtil { @NonNull Class<T> clazz, @Nullable InvocationHandler invocationHandler) { if (invocationHandler == null) return null; return clazz.cast( - Proxy.newProxyInstance(BoundaryInterfaceReflectionUtil.class.getClassLoader(), - new Class[] {clazz}, invocationHandler)); + Proxy.newProxyInstance( + BoundaryInterfaceReflectionUtil.class.getClassLoader(), + new Class[] {clazz}, + invocationHandler)); } /** @@ -91,7 +89,7 @@ public class BoundaryInterfaceReflectionUtil { * method calls to. * @return an InvocationHandlerWithDelegateGetter wrapping {@code delegate} */ - @TargetApi(Build.VERSION_CODES.KITKAT) + @RequiresApi(Build.VERSION_CODES.KITKAT) @Nullable public static InvocationHandler createInvocationHandlerFor(@Nullable final Object delegate) { if (delegate == null) return null; @@ -106,12 +104,12 @@ public class BoundaryInterfaceReflectionUtil { * <p>A {@code null} array of delegates is represented with a {@code null} array of {@link * InvocationHandler}s. Any individual {@code null} delegate is represented with a {@code null} * {@link InvocationHandler}. - + * * @param delegates an array of objects to which to delegate. * @return an array of InvocationHandlerWithDelegateGetter instances, each delegating to * the corresponding member of {@code delegates}. */ - @TargetApi(Build.VERSION_CODES.KITKAT) + @RequiresApi(Build.VERSION_CODES.KITKAT) @Nullable public static InvocationHandler[] createInvocationHandlersForArray( @Nullable final Object[] delegates) { @@ -134,6 +132,7 @@ public class BoundaryInterfaceReflectionUtil { * @param invocationHandler a {@link Nullable} InvocationHandlerWithDelegateGetter. * @return the corresponding delegate. */ + @RequiresApi(Build.VERSION_CODES.KITKAT) @Nullable public static Object getDelegateFromInvocationHandler( @Nullable InvocationHandler invocationHandler) { @@ -148,7 +147,7 @@ public class BoundaryInterfaceReflectionUtil { * This allows us to pass InvocationHandlers across the support library boundary and later * unwrap the objects used as delegates within those InvocationHandlers. */ - @TargetApi(Build.VERSION_CODES.KITKAT) + @RequiresApi(Build.VERSION_CODES.KITKAT) private static class InvocationHandlerWithDelegateGetter implements InvocationHandler { private final Object mDelegate; @@ -169,9 +168,7 @@ public class BoundaryInterfaceReflectionUtil { } } - /** - * Gets the delegate object (which is never {@code null}). - */ + /** Gets the delegate object (which is never {@code null}). */ @NonNull public Object getDelegate() { return mDelegate; diff --git a/src/org/chromium/support_lib_boundary/util/Features.java b/src/org/chromium/support_lib_boundary/util/Features.java index 40cd85b..95b6ff5 100644 --- a/src/org/chromium/support_lib_boundary/util/Features.java +++ b/src/org/chromium/support_lib_boundary/util/Features.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -47,6 +47,9 @@ public class Features { // WebViewCompat.startSafeBrowsing public static final String START_SAFE_BROWSING = "START_SAFE_BROWSING"; + // WebViewCompat.setSafeBrowsingAllowlist + public static final String SAFE_BROWSING_ALLOWLIST = "SAFE_BROWSING_ALLOWLIST"; + // WebViewCompat.setSafeBrowsingWhitelist public static final String SAFE_BROWSING_WHITELIST = "SAFE_BROWSING_WHITELIST"; @@ -102,6 +105,17 @@ public class Features { public static final String SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL = "SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL"; + /** @deprecated Feature was renamed to WEB_MESSAGE_ARRAY_BUFFER. Do not reuse feature name. */ + @Deprecated() + public static final String WEB_MESSAGE_GET_MESSAGE_PAYLOAD = "WEB_MESSAGE_GET_MESSAGE_PAYLOAD"; + + // JsReplyProxy.postMessageWithPayload + // WebMessage.getMessagePayload + // WebMessagePayload.getAsArrayBuffer + // WebMessagePayload.getAsString + // WebMessagePayload.getType + public static final String WEB_MESSAGE_ARRAY_BUFFER = "WEB_MESSAGE_ARRAY_BUFFER"; + // WebMessagePortCompat.postMessage public static final String WEB_MESSAGE_PORT_POST_MESSAGE = "WEB_MESSAGE_PORT_POST_MESSAGE"; @@ -132,6 +146,9 @@ public class Features { // ProxyController.clearProxyOverride public static final String PROXY_OVERRIDE = "PROXY_OVERRIDE:3"; + // ProxyController.setProxyOverride + public static final String PROXY_OVERRIDE_REVERSE_BYPASS = "PROXY_OVERRIDE_REVERSE_BYPASS"; + // WebSettingsCompat.setWillSuppressErrorPage // WebSettingsCompat.getWillSuppressErrorPage public static final String SUPPRESS_ERROR_PAGE = "SUPPRESS_ERROR_PAGE"; @@ -170,7 +187,88 @@ public class Features { // WebSettingsCompat.getForceDarkBehavior public static final String FORCE_DARK_BEHAVIOR = "FORCE_DARK_BEHAVIOR"; + // WebSettingsCompat.setAlgorithmicDarkeningAllowed + // WebSettingsCompat.isAlgorithmicDarkeningAllowed + public static final String ALGORITHMIC_DARKENING = "ALGORITHMIC_DARKENING"; + // WebViewCompat.addWebMessageListener // WebViewCompat.removeWebMessageListener public static final String WEB_MESSAGE_LISTENER = "WEB_MESSAGE_LISTENER"; + + // WebViewCompat.addDocumentStartJavascript + public static final String DOCUMENT_START_SCRIPT = "DOCUMENT_START_SCRIPT:1"; + + // WebSettingsCompat.setWebAuthnSupport + // WebSettingsCompat.getWebAuthnSupport + public static final String WEB_AUTHENTICATION = "WEB_AUTHENTICATION"; + + // WebSettingsCompat.setRequestedWithHeaderMode + // WebSettingsCompat.getRequestedWithHeaderMode + // ServiceWorkerWebSettingsCompat.setRequestedWithHeaderMode + // ServiceWorkerWebSettingsCompat.getRequestedWithHeaderMode + /** @deprecated Feature was never launched. Do not reuse feature name. */ + @Deprecated() + public static final String REQUESTED_WITH_HEADER_CONTROL = "REQUESTED_WITH_HEADER_CONTROL"; + + // WebSettingsCompat.setRequestedWithHeaderAllowList + // WebSettingsCompat.getRequestedWithHeaderAllowList + // ServiceWorkerWebSettingsCompat.setRequestedWithHeaderAllowList + // ServiceWorkerWebSettingsCompat.getRequestedWithHeaderAllowList + public static final String REQUESTED_WITH_HEADER_ALLOW_LIST = + "REQUESTED_WITH_HEADER_ALLOW_LIST"; + + // WebViewCompat.getVariationsHeader + public static final String GET_VARIATIONS_HEADER = "GET_VARIATIONS_HEADER"; + + // WebSettingsCompat.setEnterpriseAuthenticationAppLinkPolicyEnabled + // WebSettingsCompat.getEnterpriseAuthenticationAppLinkPolicyEnabled + public static final String ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY = + "ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY"; + + // CookieManagerCompat.getCookieInfo + public static final String GET_COOKIE_INFO = "GET_COOKIE_INFO"; + + // DropDataContentProvider.onCreate + // DropDataContentProvider.getStreamTypes + // DropDataContentProvider.openFile + // DropDataContentProvider.query + // DropDataContentProvider.getType + // DropDataContentProvider.cache + // DropDataContentProvider.setClearCachedDataIntervalMs + // DropDataContentProvider.onDragEnd + // DropDataContentProvider.call + public static final String IMAGE_DRAG_DROP = "IMAGE_DRAG_DROP"; + + // ProfileStore.getInstance + // ProfileStore.getOrCreateProfile + // ProfileStore.getProfile + // ProfileStore.getAllProfileNames + // ProfileStore.deleteProfile + // Profile.getName + // Profile.getCookieManager + // Profile.getWebStorage + // Profile.getGeolocationPermissions + // Profile.getServiceWorkerController + public static final String MULTI_PROFILE = "MULTI_PROFILE"; + + // WebSettingsCompat.enableRestrictSensitiveWebContent + @Deprecated() + public static final String RESTRICT_SENSITIVE_WEB_CONTENT = "RESTRICT_SENSITIVE_WEB_CONTENT"; + + // WebSettingsCompat.setUserAgentMetadataFromMap + // WebSettingsCompat.getUserAgentMetadataMap + public static final String USER_AGENT_METADATA = "USER_AGENT_METADATA"; + + // WebSettingsCompat.setAttributionBehavior + // WebSettingsCompat.getAttributionBehavior + public static final String ATTRIBUTION_BEHAVIOR = "ATTRIBUTION_BEHAVIOR"; + + // WebSettingsCompat.setWebViewMediaIntegrityApiStatus + // WebSettingsCompat.getWebViewMediaIntegrityApiDefaultStatus + // WebSettingsCompat.getWebViewMediaIntegrityApiOverrideRules + public static final String WEBVIEW_MEDIA_INTEGRITY_API_STATUS = "WEBVIEW_INTEGRITY_API_STATUS"; + + // WebViewCompat.setAudioMuted + // WebViewCompat.isAudioMuted + public static final String MUTE_AUDIO = "MUTE_AUDIO"; } |