diff options
author | Gustav Sennton <gsennton@google.com> | 2017-11-15 14:05:13 +0000 |
---|---|---|
committer | Gustav Sennton <gsennton@google.com> | 2018-02-13 19:55:47 +0000 |
commit | af81723b47791fdec366e214c42646dec0a4564d (patch) | |
tree | 9f71fed4dadda8194d3e9d5078659bcdb812bb16 | |
parent | cb5e083e36c470b85ecd88ee8490a55946a78c61 (diff) | |
download | webview_support_interfaces-af81723b47791fdec366e214c42646dec0a4564d.tar.gz |
[WebView] Add directory for interfaces between support library and glue
We will build a set of interfaces to communicate between the WebView
support library (statically built into apps), and the WebView support
library glue layer (built into the WebView APK, loaded into app
processes at run-time).
To allow Chromium and the Android Support Library to share these
interfaces we put them in their own directory, and mirror that directory
publicly so that they can be referenced by the support library.
This CL creates the interface directory, and adds some examples of
interfaces.
BUG=755506
Change-Id: I3f7040c4ab88c7e0d26379aebc4b74fb53eee1de
Reviewed-on: https://chromium-review.googlesource.com/768712
Commit-Queue: Gustav Sennton <gsennton@chromium.org>
Reviewed-by: Richard Coles <torne@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#516688}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: b1ea1aff463b4c061a3c7f60894129bff89e8bb1
-rw-r--r-- | BUILD.gn | 19 | ||||
-rw-r--r-- | DEPS | 10 | ||||
-rw-r--r-- | src/org/chromium/support_lib_boundary/VisualStateCallbackInterface.java | 9 | ||||
-rw-r--r-- | src/org/chromium/support_lib_boundary/WebSettingsInterface.java | 16 | ||||
-rw-r--r-- | src/org/chromium/support_lib_boundary/WebViewProvider.java | 16 | ||||
-rw-r--r-- | src/org/chromium/support_lib_boundary/WebViewProviderFactory.java | 16 |
6 files changed, 86 insertions, 0 deletions
diff --git a/BUILD.gn b/BUILD.gn new file mode 100644 index 0000000..66f2fee --- /dev/null +++ b/BUILD.gn @@ -0,0 +1,19 @@ +# Copyright 2017 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. + +import("//build/config/android/config.gni") +import("//build/config/android/rules.gni") + +android_library("boundary_interface_java") { + java_files = [ + "src/org/chromium/support_lib_boundary/VisualStateCallbackInterface.java", + "src/org/chromium/support_lib_boundary/WebSettingsInterface.java", + "src/org/chromium/support_lib_boundary/WebViewProvider.java", + "src/org/chromium/support_lib_boundary/WebViewProviderFactory.java", + ] + + # We can't use ANY deps here, the support library should be able to build + # these interfaces without any other chromium dependencies. + deps = [] +} @@ -0,0 +1,10 @@ + +# This directory cannot depend on ANYTHING else in chromium +# These negative rules just rule out some of the major components. +include_rules = [ + "-base", + "-chrome", + "-components", + "-content", + "-services", +] diff --git a/src/org/chromium/support_lib_boundary/VisualStateCallbackInterface.java b/src/org/chromium/support_lib_boundary/VisualStateCallbackInterface.java new file mode 100644 index 0000000..1511191 --- /dev/null +++ b/src/org/chromium/support_lib_boundary/VisualStateCallbackInterface.java @@ -0,0 +1,9 @@ +// Copyright 2017 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; + +/** + */ +public interface VisualStateCallbackInterface { void onComplete(long requestId); } diff --git a/src/org/chromium/support_lib_boundary/WebSettingsInterface.java b/src/org/chromium/support_lib_boundary/WebSettingsInterface.java new file mode 100644 index 0000000..c138afb --- /dev/null +++ b/src/org/chromium/support_lib_boundary/WebSettingsInterface.java @@ -0,0 +1,16 @@ +// Copyright 2017 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; + +// Technically this interface is not needed until we add a method to WebSettings with an +// android.webkit parameter or android.webkit return value. But for forwards compatibility all +// app-facing classes should have a boundary-interface that the WebView glue layer can build +// against. +/** + */ +public interface WebSettingsInterface { + void setSafeBrowsingEnabled(boolean enabled); + boolean getSafeBrowsingEnabled(); +} diff --git a/src/org/chromium/support_lib_boundary/WebViewProvider.java b/src/org/chromium/support_lib_boundary/WebViewProvider.java new file mode 100644 index 0000000..977902d --- /dev/null +++ b/src/org/chromium/support_lib_boundary/WebViewProvider.java @@ -0,0 +1,16 @@ +// Copyright 2017 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; + +import java.lang.reflect.InvocationHandler; + +/** + */ +public interface WebViewProvider { + void insertVisualStateCallback(long requestId, + InvocationHandler + /* org.chromium.sup_lib_boundary.VisualStateCallback */ callbackInvoHandler); + InvocationHandler /* org.chromium.sup_lib_boundary.WebSettingsInterface */ getSettings(); +} diff --git a/src/org/chromium/support_lib_boundary/WebViewProviderFactory.java b/src/org/chromium/support_lib_boundary/WebViewProviderFactory.java new file mode 100644 index 0000000..734e281 --- /dev/null +++ b/src/org/chromium/support_lib_boundary/WebViewProviderFactory.java @@ -0,0 +1,16 @@ +// Copyright 2017 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; + +import java.lang.reflect.InvocationHandler; + +/** + */ +public interface WebViewProviderFactory { + // android.webkit.WebViewProvider is in the SystemApi, not public, so we pass it as an Object + // here. + InvocationHandler /* org.chromium.sup_lib_boundary.WebViewProvider */ createWebView( + Object /* android.webkit.WebViewProvider */ webviewProvider); +} |