Snap for 6795580 from 021571f9ab2fb3cf7c162fa43f2a6329dcda89b4 to androidx-master-release
Change-Id: I866b1a85c01b1fcbac5fbedb0167b974ca85faf3
diff --git a/BUILD.gn b/BUILD.gn
index a6cc4b5..d3c7500 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -6,12 +6,13 @@
import("//build/config/android/rules.gni")
android_library("boundary_interface_java") {
- java_files = [
+ sources = [
"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/ProxyControllerBoundaryInterface.java",
"src/org/chromium/support_lib_boundary/SafeBrowsingResponseBoundaryInterface.java",
+ "src/org/chromium/support_lib_boundary/ScriptReferenceBoundaryInterface.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",
@@ -41,13 +42,23 @@
# 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/android_deps:androidx_annotation_annotation_java" ]
+}
- # 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
+android_apk("boundary_interface_example_apk") {
+ apk_name = "BoundaryInterfaceExample"
+
+ # 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
+
+ # 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 4fbc108..0000000
--- a/build.gradle
+++ /dev/null
@@ -1,25 +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.SdkHelperKt
-import androidx.build.SupportConfig
-
-plugins {
- id('java-library')
-}
-
-dependencies {
- api("androidx.annotation:annotation:1.1.0")
- implementation fileTree(dir: "${SdkHelperKt.getSdkPath(project.rootDir)}/platforms/$SupportConfig.COMPILE_SDK_VERSION/",
- include: "android.jar")
-}
-
-sourceSets {
- main {
- java.srcDirs = ['src']
- }
-}
diff --git a/src/org/chromium/support_lib_boundary/ScriptReferenceBoundaryInterface.java b/src/org/chromium/support_lib_boundary/ScriptReferenceBoundaryInterface.java
new file mode 100644
index 0000000..6358e00
--- /dev/null
+++ b/src/org/chromium/support_lib_boundary/ScriptReferenceBoundaryInterface.java
@@ -0,0 +1,12 @@
+// Copyright 2020 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.
+
+package org.chromium.support_lib_boundary;
+
+/**
+ * Boundary interface for AwContents.addDocumentStartJavascript().
+ */
+public interface ScriptReferenceBoundaryInterface {
+ void remove();
+}
diff --git a/src/org/chromium/support_lib_boundary/StaticsBoundaryInterface.java b/src/org/chromium/support_lib_boundary/StaticsBoundaryInterface.java
index 648d416..c2d3864 100644
--- a/src/org/chromium/support_lib_boundary/StaticsBoundaryInterface.java
+++ b/src/org/chromium/support_lib_boundary/StaticsBoundaryInterface.java
@@ -9,12 +9,14 @@
import android.webkit.ValueCallback;
import java.util.List;
+import java.util.Set;
/**
* 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();
diff --git a/src/org/chromium/support_lib_boundary/WebViewProviderBoundaryInterface.java b/src/org/chromium/support_lib_boundary/WebViewProviderBoundaryInterface.java
index bb677ef..843d387 100644
--- a/src/org/chromium/support_lib_boundary/WebViewProviderBoundaryInterface.java
+++ b/src/org/chromium/support_lib_boundary/WebViewProviderBoundaryInterface.java
@@ -20,6 +20,8 @@
void addWebMessageListener(String jsObjectName, String[] allowedOriginRules,
/* WebMessageListener */ InvocationHandler listener);
void removeWebMessageListener(String jsObjectName);
+ /* ScriptReference */ InvocationHandler addDocumentStartJavaScript(
+ String script, String[] allowedOriginRules);
WebViewClient getWebViewClient();
WebChromeClient getWebChromeClient();
/* WebViewRenderer */ InvocationHandler getWebViewRenderer();
diff --git a/src/org/chromium/support_lib_boundary/WebViewProviderFactoryBoundaryInterface.java b/src/org/chromium/support_lib_boundary/WebViewProviderFactoryBoundaryInterface.java
index 15db689..902a04b 100644
--- a/src/org/chromium/support_lib_boundary/WebViewProviderFactoryBoundaryInterface.java
+++ b/src/org/chromium/support_lib_boundary/WebViewProviderFactoryBoundaryInterface.java
@@ -18,4 +18,5 @@
/* SupportLibraryServiceWorkerController */ InvocationHandler getServiceWorkerController();
/* SupportLibraryTracingController */ InvocationHandler getTracingController();
/* SupportLibraryProxyController */ InvocationHandler getProxyController();
+ void setSupportLibraryVersion(String version);
}
diff --git a/src/org/chromium/support_lib_boundary/util/BoundaryInterfaceReflectionUtil.java b/src/org/chromium/support_lib_boundary/util/BoundaryInterfaceReflectionUtil.java
index 1c5f369..c2dc613 100644
--- a/src/org/chromium/support_lib_boundary/util/BoundaryInterfaceReflectionUtil.java
+++ b/src/org/chromium/support_lib_boundary/util/BoundaryInterfaceReflectionUtil.java
@@ -3,12 +3,11 @@
// 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;
@@ -22,7 +21,6 @@
*/
// 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
@@ -91,7 +89,7 @@
* 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;
@@ -111,7 +109,7 @@
* @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) {
@@ -148,7 +146,7 @@
* 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;
diff --git a/src/org/chromium/support_lib_boundary/util/Features.java b/src/org/chromium/support_lib_boundary/util/Features.java
index 40cd85b..d3a5039 100644
--- a/src/org/chromium/support_lib_boundary/util/Features.java
+++ b/src/org/chromium/support_lib_boundary/util/Features.java
@@ -47,6 +47,9 @@
// 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";
@@ -173,4 +176,10 @@
// WebViewCompat.addWebMessageListener
// WebViewCompat.removeWebMessageListener
public static final String WEB_MESSAGE_LISTENER = "WEB_MESSAGE_LISTENER";
+
+ // WebViewProviderFactoryAdapter.setSupportLibraryVersion
+ public static final String SET_SUPPORT_LIBRARY_VERSION = "SET_SUPPORT_LIBRARY_VERSION";
+
+ // WebViewCompat.addDocumentStartJavascript
+ public static final String DOCUMENT_START_SCRIPT = "DOCUMENT_START_SCRIPT:1";
}