diff options
author | Adam Langley <agl@chromium.org> | 2022-01-13 18:43:25 +0000 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-01-13 11:00:31 -0800 |
commit | fd0a79bc6562ff8a09fa0ab6543801be5dbf7957 (patch) | |
tree | 8c5e1ab437d2dc46d3e9684243988976d1b04f31 /src/org | |
parent | 24b3ad70385c0c5655af7ebd4af705512d1f949f (diff) | |
download | webview_support_interfaces-fd0a79bc6562ff8a09fa0ab6543801be5dbf7957.tar.gz |
android_webview: add no-op boundary interfaces.
This change adds WebView boundary interfaces for supporting WebAuthn in
WebViews. They are currently no-ops, but the full change is huge so I'm
trying to split it up.
BUG=1284805
Change-Id: I8ce75d7077e9db7d15c071e27cf9529a4b94d2a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3368924
Reviewed-by: Richard Coles <torne@chromium.org>
Auto-Submit: Adam Langley <agl@chromium.org>
Reviewed-by: Peter Beverloo <peter@chromium.org>
Commit-Queue: Peter Beverloo <peter@chromium.org>
Cr-Commit-Position: refs/heads/main@{#958718}
NOKEYCHECK=True
GitOrigin-RevId: aa5dd97385dcf06a2d517a48207f11c29f03e863
Diffstat (limited to 'src/org')
4 files changed, 36 insertions, 0 deletions
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..8b6efc1 --- /dev/null +++ b/src/org/chromium/support_lib_boundary/WebAuthnCallbackBoundaryInterface.java @@ -0,0 +1,18 @@ +// Copyright 2021 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 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/WebSettingsBoundaryInterface.java b/src/org/chromium/support_lib_boundary/WebSettingsBoundaryInterface.java index 426eb6d..38ee17e 100644 --- a/src/org/chromium/support_lib_boundary/WebSettingsBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/WebSettingsBoundaryInterface.java @@ -41,4 +41,15 @@ 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(); } diff --git a/src/org/chromium/support_lib_boundary/WebViewClientBoundaryInterface.java b/src/org/chromium/support_lib_boundary/WebViewClientBoundaryInterface.java index 9cdde0d..fc60168 100644 --- a/src/org/chromium/support_lib_boundary/WebViewClientBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/WebViewClientBoundaryInterface.java @@ -4,6 +4,7 @@ package org.chromium.support_lib_boundary; +import android.app.PendingIntent; import android.webkit.WebResourceRequest; import android.webkit.WebResourceResponse; import android.webkit.WebView; @@ -22,4 +23,6 @@ public interface WebViewClientBoundaryInterface extends FeatureFlagHolderBoundar 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/util/Features.java b/src/org/chromium/support_lib_boundary/util/Features.java index 3038a4f..d2b8ec9 100644 --- a/src/org/chromium/support_lib_boundary/util/Features.java +++ b/src/org/chromium/support_lib_boundary/util/Features.java @@ -185,4 +185,8 @@ public class Features { // WebViewCompat.addDocumentStartJavascript public static final String DOCUMENT_START_SCRIPT = "DOCUMENT_START_SCRIPT"; + + // WebSettingsCompat.setWebAuthnSupport + // WebSettingsCompat.getWebAuthnSupport + public static final String WEB_AUTHENTICATION = "WEB_AUTHENTICATION"; } |