Commit 8ccdc38b authored by bsazonov's avatar bsazonov Committed by Commit bot

Rename AccountManagerHelper.mAccountManager field to mDelegate

This CL fixes confusing field name. Field has AccountManagerDelegate type
and should be named accordinly.

BUG=698258

Review-Url: https://codereview.chromium.org/2850813002
Cr-Commit-Position: refs/heads/master@{#468016}
parent 37acc253
...@@ -32,13 +32,9 @@ import java.util.regex.Pattern; ...@@ -32,13 +32,9 @@ import java.util.regex.Pattern;
*/ */
public class AccountManagerHelper { public class AccountManagerHelper {
private static final String TAG = "Sync_Signin"; private static final String TAG = "Sync_Signin";
private static final Pattern AT_SYMBOL = Pattern.compile("@"); private static final Pattern AT_SYMBOL = Pattern.compile("@");
private static final String GMAIL_COM = "gmail.com"; private static final String GMAIL_COM = "gmail.com";
private static final String GOOGLEMAIL_COM = "googlemail.com"; private static final String GOOGLEMAIL_COM = "googlemail.com";
public static final String GOOGLE_ACCOUNT_TYPE = "com.google"; public static final String GOOGLE_ACCOUNT_TYPE = "com.google";
/** /**
...@@ -50,7 +46,7 @@ public class AccountManagerHelper { ...@@ -50,7 +46,7 @@ public class AccountManagerHelper {
private static final AtomicReference<AccountManagerHelper> sInstance = new AtomicReference<>(); private static final AtomicReference<AccountManagerHelper> sInstance = new AtomicReference<>();
private final AccountManagerDelegate mAccountManager; private final AccountManagerDelegate mDelegate;
/** /**
* A simple callback for getAuthToken. * A simple callback for getAuthToken.
...@@ -73,10 +69,10 @@ public class AccountManagerHelper { ...@@ -73,10 +69,10 @@ public class AccountManagerHelper {
} }
/** /**
* @param accountManager the account manager to use as a backend service * @param delegate the account manager to use as a backend service
*/ */
private AccountManagerHelper(AccountManagerDelegate accountManager) { private AccountManagerHelper(AccountManagerDelegate delegate) {
mAccountManager = accountManager; mDelegate = delegate;
} }
/** /**
...@@ -169,7 +165,7 @@ public class AccountManagerHelper { ...@@ -169,7 +165,7 @@ public class AccountManagerHelper {
* See http://crbug.com/517697 for details. * See http://crbug.com/517697 for details.
*/ */
public Account[] getGoogleAccounts() { public Account[] getGoogleAccounts() {
return mAccountManager.getAccountsByType(GOOGLE_ACCOUNT_TYPE); return mDelegate.getAccountsByType(GOOGLE_ACCOUNT_TYPE);
} }
/** /**
...@@ -286,7 +282,7 @@ public class AccountManagerHelper { ...@@ -286,7 +282,7 @@ public class AccountManagerHelper {
* @return Whether or not there is an account authenticator for Google accounts. * @return Whether or not there is an account authenticator for Google accounts.
*/ */
public boolean hasGoogleAccountAuthenticator() { public boolean hasGoogleAccountAuthenticator() {
AuthenticatorDescription[] descs = mAccountManager.getAuthenticatorTypes(); AuthenticatorDescription[] descs = mDelegate.getAuthenticatorTypes();
for (AuthenticatorDescription desc : descs) { for (AuthenticatorDescription desc : descs) {
if (GOOGLE_ACCOUNT_TYPE.equals(desc.type)) return true; if (GOOGLE_ACCOUNT_TYPE.equals(desc.type)) return true;
} }
...@@ -305,7 +301,7 @@ public class AccountManagerHelper { ...@@ -305,7 +301,7 @@ public class AccountManagerHelper {
ConnectionRetry.runAuthTask(new AuthTask<String>() { ConnectionRetry.runAuthTask(new AuthTask<String>() {
@Override @Override
public String run() throws AuthException { public String run() throws AuthException {
return mAccountManager.getAuthToken(account, authTokenType); return mDelegate.getAuthToken(account, authTokenType);
} }
@Override @Override
public void onSuccess(String token) { public void onSuccess(String token) {
...@@ -339,7 +335,7 @@ public class AccountManagerHelper { ...@@ -339,7 +335,7 @@ public class AccountManagerHelper {
ConnectionRetry.runAuthTask(new AuthTask<Boolean>() { ConnectionRetry.runAuthTask(new AuthTask<Boolean>() {
@Override @Override
public Boolean run() throws AuthException { public Boolean run() throws AuthException {
mAccountManager.invalidateAuthToken(authToken); mDelegate.invalidateAuthToken(authToken);
return true; return true;
} }
@Override @Override
...@@ -356,7 +352,7 @@ public class AccountManagerHelper { ...@@ -356,7 +352,7 @@ public class AccountManagerHelper {
} }
private boolean hasFeatures(Account account, String[] features) { private boolean hasFeatures(Account account, String[] features) {
return mAccountManager.hasFeatures(account, features); return mDelegate.hasFeatures(account, features);
} }
private void hasFeatures( private void hasFeatures(
...@@ -380,7 +376,7 @@ public class AccountManagerHelper { ...@@ -380,7 +376,7 @@ public class AccountManagerHelper {
*/ */
public void updateCredentials( public void updateCredentials(
Account account, Activity activity, @Nullable Callback<Boolean> callback) { Account account, Activity activity, @Nullable Callback<Boolean> callback) {
mAccountManager.updateCredentials(account, activity, callback); mDelegate.updateCredentials(account, activity, callback);
} }
private interface AuthTask<T> { private interface AuthTask<T> {
......
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