Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3408)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogAccountHelper.java

Issue 21205007: [rAc Android] Remove the old dialog implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogAccountHelper.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogAccountHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogAccountHelper.java
deleted file mode 100644
index 3dfe34b7e4a97bbebfa4e215f1f06879918027a3..0000000000000000000000000000000000000000
--- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogAccountHelper.java
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright (c) 2013 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.autofill;
-
-import android.accounts.Account;
-import android.content.Context;
-
-import org.chromium.base.JNINamespace;
-import org.chromium.sync.signin.AccountManagerHelper;
-
-import java.util.List;
-
-/**
-* Wallet automatic sign-in helper for AutofillDialog.
-*/
-@JNINamespace("autofill")
-public class AutofillDialogAccountHelper {
- private static final String TAG = "AutofillDialogAccountHelper";
- private static int MAX_ATTEMPTS_TO_GENERATE_TOKENS = 2;
-
- private final Context mContext;
- private final SignInContinuation mSignInContinuation;
-
- private Account mAccount;
- private String mSid;
- private String mLsid;
- private int mAttemptsToGo;
-
- /**
- * Delegate that will be called on the completion of tokens generation.
- */
- public static interface SignInContinuation {
- /**
- * Tokens generation has succeeded.
- * @param accountName The account name.
- * @param sid A GAIA session authentication SID token.
- * @param lsid An SSL-only GAIA authentication LSID token.
- */
- void onTokensGenerationSuccess(String accountName, String sid, String lsid);
-
- /**
- * Tokens generation has failed.
- */
- void onTokensGenerationFailure();
- }
-
- public AutofillDialogAccountHelper(SignInContinuation continuation, Context context) {
- mSignInContinuation = continuation;
- mContext = context;
- }
-
- /**
- * @return An array of Google account emails the user has.
- */
- public String[] getAccountNames() {
- List<String> accountNames = AccountManagerHelper.get(mContext).getGoogleAccountNames();
- return accountNames.toArray(new String[accountNames.size()]);
- }
-
- /**
- * Starts generation of tokens.
- * This results in onTokensGenerationSuccess/onTokensGenerationFailure call.
- * @param accountName An account name.
- */
- public void startTokensGeneration(String accountName) {
- mAccount = AccountManagerHelper.get(mContext).getAccountFromName(accountName);
- if (mAccount == null) {
- mSignInContinuation.onTokensGenerationFailure();
- return;
- }
- mAttemptsToGo = MAX_ATTEMPTS_TO_GENERATE_TOKENS;
- attemptToGenerateTokensOrRetryOrFail();
- }
-
- private void startTokensGenerationImpl() {
- AccountManagerHelper.get(mContext).getNewAuthTokenFromForeground(
- mAccount, mSid, "SID",
- new AccountManagerHelper.GetAuthTokenCallback() {
- @Override
- public void tokenAvailable(String authToken) {
- mSid = authToken;
- if (mSid == null) {
- attemptToGenerateTokensOrRetryOrFail();
- return;
- }
- AccountManagerHelper.get(mContext).getNewAuthTokenFromForeground(
- mAccount, mLsid, "LSID",
- new AccountManagerHelper.GetAuthTokenCallback() {
- @Override
- public void tokenAvailable(String authToken) {
- mLsid = authToken;
- if (mLsid == null) {
- attemptToGenerateTokensOrRetryOrFail();
- return;
- }
- mSignInContinuation.onTokensGenerationSuccess(
- mAccount.name, mSid, mLsid);
- }
- });
- }
- });
- }
-
- private void attemptToGenerateTokensOrRetryOrFail() {
- assert mAttemptsToGo > 0;
- --mAttemptsToGo;
- if (mAttemptsToGo > 0) {
- startTokensGenerationImpl();
- } else {
- mSignInContinuation.onTokensGenerationFailure();
- }
- }
-}

Powered by Google App Engine
This is Rietveld 408576698