summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustav Sennton <gsennton@google.com>2018-03-09 18:29:59 +0000
committerGustav Sennton <gsennton@google.com>2018-03-12 11:31:31 +0000
commit7a06470db32251f50f63e68a149515758dd4883b (patch)
tree2ddb305b67b3a4dbeb0790a6fb5b19ad6df030c6
parent68349a8634db3a240a19b72aea99176bc5260e29 (diff)
downloadwebview_support_interfaces-7a06470db32251f50f63e68a149515758dd4883b.tar.gz
[WebView Support Library] Pass and fetch list of supported features.
We need some way for either side (android support library + chromium) of the webview support library to tell what features the other side of the support library supports. We do this by passing a list of integers across the boundary. These integers will each represent a feature (which will be defined in a class in the boundary interface package). Add a single feature to the list of features to support (visual state callback). Bug: 740082 Change-Id: I791af590cb846d536d01d63649ab6cfffe558ee9 Reviewed-on: https://chromium-review.googlesource.com/941805 Commit-Queue: Gustav Sennton <gsennton@chromium.org> Reviewed-by: Nate Fischer <ntfschr@chromium.org> Reviewed-by: Bo <boliu@chromium.org> Reviewed-by: Richard Coles <torne@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#542169} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: ba016de1efcd69651c043f5958e9c4530c7d36a2
-rw-r--r--BUILD.gn2
-rw-r--r--src/org/chromium/support_lib_boundary/SupportLibraryInfoBoundaryInterface.java12
-rw-r--r--src/org/chromium/support_lib_boundary/WebViewProviderFactoryBoundaryInterface.java1
-rw-r--r--src/org/chromium/support_lib_boundary/util/Features.java18
4 files changed, 33 insertions, 0 deletions
diff --git a/BUILD.gn b/BUILD.gn
index bc1fcb3..dda7b79 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -8,12 +8,14 @@ import("//build/config/android/rules.gni")
android_library("boundary_interface_java") {
java_files = [
"src/org/chromium/support_lib_boundary/StaticsBoundaryInterface.java",
+ "src/org/chromium/support_lib_boundary/SupportLibraryInfoBoundaryInterface.java",
"src/org/chromium/support_lib_boundary/VisualStateCallbackBoundaryInterface.java",
"src/org/chromium/support_lib_boundary/WebSettingsBoundaryInterface.java",
"src/org/chromium/support_lib_boundary/WebViewProviderBoundaryInterface.java",
"src/org/chromium/support_lib_boundary/WebViewProviderFactoryBoundaryInterface.java",
"src/org/chromium/support_lib_boundary/WebkitToCompatConverterBoundaryInterface.java",
"src/org/chromium/support_lib_boundary/util/BoundaryInterfaceReflectionUtil.java",
+ "src/org/chromium/support_lib_boundary/util/Features.java",
]
proguard_configs = [ "proguard.flags" ]
diff --git a/src/org/chromium/support_lib_boundary/SupportLibraryInfoBoundaryInterface.java b/src/org/chromium/support_lib_boundary/SupportLibraryInfoBoundaryInterface.java
new file mode 100644
index 0000000..11a141f
--- /dev/null
+++ b/src/org/chromium/support_lib_boundary/SupportLibraryInfoBoundaryInterface.java
@@ -0,0 +1,12 @@
+// Copyright 2018 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;
+
+/**
+ * Contains information about the WebView support library side, e.g. which features are supported on
+ * that side.
+ * This is passed to the WebView APK code on support library initialization.
+ */
+public interface SupportLibraryInfoBoundaryInterface { String[] getSupportedFeatures(); }
diff --git a/src/org/chromium/support_lib_boundary/WebViewProviderFactoryBoundaryInterface.java b/src/org/chromium/support_lib_boundary/WebViewProviderFactoryBoundaryInterface.java
index e868f7a..094e2cf 100644
--- a/src/org/chromium/support_lib_boundary/WebViewProviderFactoryBoundaryInterface.java
+++ b/src/org/chromium/support_lib_boundary/WebViewProviderFactoryBoundaryInterface.java
@@ -14,4 +14,5 @@ public interface WebViewProviderFactoryBoundaryInterface {
/* SupportLibraryWebViewChromium */ InvocationHandler createWebView(WebView webview);
/* SupportLibWebkitToCompatConverter */ InvocationHandler getWebkitToCompatConverter();
/* StaticsAdapter */ InvocationHandler getStatics();
+ String[] getSupportedFeatures();
}
diff --git a/src/org/chromium/support_lib_boundary/util/Features.java b/src/org/chromium/support_lib_boundary/util/Features.java
new file mode 100644
index 0000000..d74ea55
--- /dev/null
+++ b/src/org/chromium/support_lib_boundary/util/Features.java
@@ -0,0 +1,18 @@
+// Copyright 2018 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.util;
+
+/**
+ * Class containing all the features the support library can support.
+ * This class lives in the boundary interface directory so that the Android Support Library and
+ * Chromium can share its definition.
+ */
+public class Features {
+ // This class just contains constants representing features.
+ private Features() {}
+
+ // WebViewCompat.postVisualStateCallback
+ public static final String VISUAL_STATE_CALLBACK = "VISUAL_STATE_CALLBACK";
+}