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

Unified Diff: components/signin/core/browser/android/java/src/org/chromium/components/signin/AccountManagerHelper.java

Issue 2784353002: Android: Remove GetApplicationContext part 2 (Closed)
Patch Set: Fix tests Created 3 years, 8 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: components/signin/core/browser/android/java/src/org/chromium/components/signin/AccountManagerHelper.java
diff --git a/components/signin/core/browser/android/java/src/org/chromium/components/signin/AccountManagerHelper.java b/components/signin/core/browser/android/java/src/org/chromium/components/signin/AccountManagerHelper.java
index abe76c0ca6c313c01190ff52be3c0bea63772825..c8d409cdc819b2cc38373f07c2cb165fb232b3e0 100644
--- a/components/signin/core/browser/android/java/src/org/chromium/components/signin/AccountManagerHelper.java
+++ b/components/signin/core/browser/android/java/src/org/chromium/components/signin/AccountManagerHelper.java
@@ -52,8 +52,6 @@ public class AccountManagerHelper {
private final AccountManagerDelegate mAccountManager;
- private Context mApplicationContext;
-
/**
* A simple callback for getAuthToken.
*/
@@ -75,11 +73,9 @@ public class AccountManagerHelper {
}
/**
- * @param context the Android context
* @param accountManager the account manager to use as a backend service
*/
- private AccountManagerHelper(Context context, AccountManagerDelegate accountManager) {
- mApplicationContext = context.getApplicationContext();
+ private AccountManagerHelper(AccountManagerDelegate accountManager) {
mAccountManager = accountManager;
}
@@ -88,14 +84,12 @@ public class AccountManagerHelper {
* Ensures that the singleton AccountManagerHelper hasn't been created yet.
* This can be overriden in tests using the overrideAccountManagerHelperForTests method.
*
- * @param context the applicationContext is retrieved from the context used as an argument.
* @param delegate the custom AccountManagerDelegate to use.
*/
- public static void initializeAccountManagerHelper(
- Context context, AccountManagerDelegate delegate) {
+ public static void initializeAccountManagerHelper(AccountManagerDelegate delegate) {
synchronized (sLock) {
assert sAccountManagerHelper == null;
- sAccountManagerHelper = new AccountManagerHelper(context, delegate);
+ sAccountManagerHelper = new AccountManagerHelper(delegate);
}
}
@@ -103,14 +97,13 @@ public class AccountManagerHelper {
* A getter method for AccountManagerHelper singleton which also initializes it if not wasn't
* already initialized.
*
- * @param context the applicationContext is retrieved from the context used as an argument.
* @return a singleton instance of the AccountManagerHelper
*/
- public static AccountManagerHelper get(Context context) {
+ public static AccountManagerHelper get() {
synchronized (sLock) {
if (sAccountManagerHelper == null) {
- sAccountManagerHelper = new AccountManagerHelper(
- context, new SystemAccountManagerDelegate(context));
+ sAccountManagerHelper =
+ new AccountManagerHelper(new SystemAccountManagerDelegate());
}
}
return sAccountManagerHelper;
@@ -128,7 +121,7 @@ public class AccountManagerHelper {
public static void overrideAccountManagerHelperForTests(
Context context, AccountManagerDelegate delegate) {
synchronized (sLock) {
- sAccountManagerHelper = new AccountManagerHelper(context, delegate);
+ sAccountManagerHelper = new AccountManagerHelper(delegate);
}
}

Powered by Google App Engine
This is Rietveld 408576698