Commit e7513e2b authored by Kim Paulhamus's avatar Kim Paulhamus Committed by Commit Bot

[WebAuthN] Add U2fApiHandler to AppHooks.

Bug: 678885
Change-Id: I0916fcb1e6ec72e2703c0b61f2af04aa53661ffe
Reviewed-on: https://chromium-review.googlesource.com/942464
Commit-Queue: Kim Paulhamus <kpaulhamus@chromium.org>
Reviewed-by: default avatarMaria Khomenko <mariakhomenko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547525}
parent 6c13a7ee
......@@ -48,6 +48,7 @@ import org.chromium.chrome.browser.sync.GmsCoreSyncListener;
import org.chromium.chrome.browser.tab.AuthenticatorNavigationInterceptor;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.webapps.GooglePlayWebApkInstallDelegate;
import org.chromium.chrome.browser.webauth.U2fApiHandler;
import org.chromium.components.signin.AccountManagerDelegate;
import org.chromium.components.signin.SystemAccountManagerDelegate;
import org.chromium.policy.AppRestrictionsProvider;
......@@ -334,4 +335,11 @@ public abstract class AppHooks {
public FeedbackSourceProvider getAdditionalFeedbackSources() {
return new FeedbackSourceProvider() {};
}
/**
* @return a new {@link U2fApiHandler} instance.
*/
public U2fApiHandler createU2fApiHandler() {
return new U2fApiHandler();
}
}
......@@ -47,6 +47,7 @@ public class AuthenticatorImpl implements Authenticator, HandlerResponseCallback
mMakeCredentialCallback = callback;
if (mIsOperationPending) {
onError(AuthenticatorStatus.PENDING_REQUEST);
return;
}
mIsOperationPending = true;
......@@ -59,6 +60,7 @@ public class AuthenticatorImpl implements Authenticator, HandlerResponseCallback
mGetAssertionCallback = callback;
if (mIsOperationPending) {
onError(AuthenticatorStatus.PENDING_REQUEST);
return;
}
mIsOperationPending = true;
......
// 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.chrome.browser.webauth;
import org.chromium.base.ThreadUtils;
import org.chromium.chrome.browser.AppHooks;
import org.chromium.webauth.mojom.PublicKeyCredentialCreationOptions;
import org.chromium.webauth.mojom.PublicKeyCredentialRequestOptions;
/**
* Android implementation of the Authenticator service defined in
* components/webauth/authenticator.mojom.
*/
public class U2fApiHandler {
private static U2fApiHandler sInstance;
/**
* @return The U2fApiHandler for use during the lifetime of the browser process.
*/
public static U2fApiHandler getInstance() {
ThreadUtils.checkUiThread();
if (sInstance == null) {
sInstance = AppHooks.get().createU2fApiHandler();
}
return sInstance;
}
protected void u2fRegister(
PublicKeyCredentialCreationOptions options, HandlerResponseCallback callback) {}
protected void u2fSign(
PublicKeyCredentialRequestOptions options, HandlerResponseCallback callback) {}
}
......@@ -1382,6 +1382,7 @@ chrome_java_sources = [
"java/src/org/chromium/chrome/browser/webauth/AuthenticatorFactory.java",
"java/src/org/chromium/chrome/browser/webauth/AuthenticatorImpl.java",
"java/src/org/chromium/chrome/browser/webauth/HandlerResponseCallback.java",
"java/src/org/chromium/chrome/browser/webauth/U2fApiHandler.java",
"java/src/org/chromium/chrome/browser/webshare/ShareServiceImpl.java",
"java/src/org/chromium/chrome/browser/webshare/ShareServiceImplementationFactory.java",
"java/src/org/chromium/chrome/browser/widget/AlertDialogEditText.java",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment