Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/signin/AccountIdProvider.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountIdProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountIdProvider.java |
| index a41f02f54ceaa1e218fb083b0aa4cbe8c56a47f0..663107a2b4eb34d1654c97c0a567c50d19c7105e 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountIdProvider.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountIdProvider.java |
| @@ -6,9 +6,14 @@ package org.chromium.chrome.browser.signin; |
| import android.content.Context; |
| +import com.google.android.gms.auth.GoogleAuthException; |
| +import com.google.android.gms.auth.GoogleAuthUtil; |
| + |
| import org.chromium.base.ThreadUtils; |
| import org.chromium.base.VisibleForTesting; |
| +import java.io.IOException; |
| + |
| /** |
| * Returns a stable id that can be used to identify a Google Account. This |
| * id does not change if the email address associated to the account changes, |
| @@ -51,6 +56,22 @@ public abstract class AccountIdProvider { |
| } |
| /** |
| + * Gets the Google Account Id Provider. |
| + */ |
| + public static AccountIdProvider getGoogleAccountIdProvider() { |
| + return new AccountIdProvider() { |
| + @Override |
| + public String getAccountId(Context ctx, String accountName) { |
| + try { |
| + return GoogleAuthUtil.getAccountId(ctx, accountName); |
| + } catch (IOException | GoogleAuthException ex) { |
| + return null; |
| + } |
| + } |
| + }; |
| + } |
|
Roger Tawa OOO till Jul 10th
2015/08/12 15:28:46
What is the reason for moving this code? If the i
gogerald1
2015/08/13 18:12:12
Acknowledged.
|
| + |
| + /** |
| * For testing purposes only, allows to set the provider even if it has already been |
| * initialized. |
| */ |