[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
diff --git a/BUILD.gn b/BUILD.gn
index bc1fcb3..dda7b79 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -8,12 +8,14 @@
 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 @@
     /* 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";
+}