diff options
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | chrome/android/java/src/org/chromium/chrome/browser/password_manager/PasswordAuthenticationManager.java | 130 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 1 |
3 files changed, 1 insertions, 131 deletions
@@ -13,6 +13,7 @@ Aaron Leventhal <aaronlevbugs@gmail.com> Aaron Randolph <aaron.randolph@gmail.com> Abhijeet Kandalkar <abhijeet.k@samsung.com> Abhishek Agarwal <abhishek.a21@samsung.com> +Abhishek Singh <abhi.rathore@samsung.com> Adam Roben <adam@github.com> Adam Treat <adam.treat@samsung.com> Addanki Gandhi Kishor <kishor.ag@samsung.com> diff --git a/chrome/android/java/src/org/chromium/chrome/browser/password_manager/PasswordAuthenticationManager.java b/chrome/android/java/src/org/chromium/chrome/browser/password_manager/PasswordAuthenticationManager.java deleted file mode 100644 index 78e7eb3..0000000 --- a/chrome/android/java/src/org/chromium/chrome/browser/password_manager/PasswordAuthenticationManager.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2014 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.password_manager; - -import org.chromium.base.CalledByNative; -import org.chromium.chrome.browser.Tab; - -/** - * Allows embedders to authenticate the usage of passwords. - */ -public class PasswordAuthenticationManager { - - /** - * The delegate that allows embedders to control the authentication of passwords. - */ - public interface PasswordAuthenticationDelegate { - /** - * @return Whether password authentication is enabled. - */ - boolean isPasswordAuthenticationEnabled(); - - /** - * Requests password authentication be presented for the given tab. - * @param tab The tab containing the protected password. - * @param callback The callback to be triggered on authentication result. - */ - void requestAuthentication(Tab tab, PasswordAuthenticationCallback callback); - - /** - * @return The message to be displayed in the save password infobar that will allow - * the user to opt-in to additional password authentication. - */ - String getPasswordProtectionString(); - } - - /** - * The callback to be triggered on success or failure of the password authentication. - */ - public static class PasswordAuthenticationCallback { - private long mNativePtr; - - @CalledByNative("PasswordAuthenticationCallback") - private static PasswordAuthenticationCallback create(long nativePtr) { - return new PasswordAuthenticationCallback(nativePtr); - } - - private PasswordAuthenticationCallback(long nativePtr) { - mNativePtr = nativePtr; - } - - /** - * Called upon authentication results to allow usage of the password or not. - * @param authenticated Whether the authentication was successful. - */ - public final void onResult(boolean authenticated) { - if (mNativePtr == 0) { - assert false : "Can not call onResult more than once per callback."; - return; - } - nativeOnResult(mNativePtr, authenticated); - mNativePtr = 0; - } - } - - private static class DefaultPasswordAuthenticationDelegate - implements PasswordAuthenticationDelegate { - @Override - public boolean isPasswordAuthenticationEnabled() { - return false; - } - - @Override - public void requestAuthentication(Tab tab, PasswordAuthenticationCallback callback) { - callback.onResult(true); - } - - @Override - public String getPasswordProtectionString() { - return ""; - } - } - - private static PasswordAuthenticationDelegate sDelegate; - - private PasswordAuthenticationManager() {} - - private static PasswordAuthenticationDelegate getDelegate() { - if (sDelegate == null) { - sDelegate = new DefaultPasswordAuthenticationDelegate(); - } - return sDelegate; - } - - /** - * Sets the password authentication delegate to be used. - */ - public static void setDelegate(PasswordAuthenticationDelegate delegate) { - sDelegate = delegate; - } - - /** - * @return Whether password authentication is enabled. - */ - public static boolean isPasswordAuthenticationEnabled() { - return getDelegate().isPasswordAuthenticationEnabled(); - } - - /** - * Requests password authentication be presented for the given tab. - * @param tab The tab containing the protected password. - * @param callback The callback to be triggered on authentication result. - */ - @CalledByNative - public static void requestAuthentication( - Tab tab, PasswordAuthenticationCallback callback) { - getDelegate().requestAuthentication(tab, callback); - } - - /** - * @return The message to be displayed in the save password infobar that will allow the user - * to opt-in to additional password authentication. - */ - public static String getPasswordProtectionString() { - return getDelegate().getPasswordProtectionString(); - } - - private static native void nativeOnResult(long callbackPtr, boolean authenticated); -} diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 91dd5fd..789702d 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1731,7 +1731,6 @@ 'android/java/src/org/chromium/chrome/browser/omnibox/OmniboxViewUtil.java', 'android/java/src/org/chromium/chrome/browser/partnerbookmarks/PartnerBookmarksReader.java', 'android/java/src/org/chromium/chrome/browser/password_manager/Credential.java', - 'android/java/src/org/chromium/chrome/browser/password_manager/PasswordAuthenticationManager.java', 'android/java/src/org/chromium/chrome/browser/policy/PolicyManager.java', 'android/java/src/org/chromium/chrome/browser/PasswordUIView.java', 'android/java/src/org/chromium/chrome/browser/precache/PrecacheLauncher.java', |