| 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 c8d409cdc819b2cc38373f07c2cb165fb232b3e0..abe76c0ca6c313c01190ff52be3c0bea63772825 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,6 +52,8 @@
|
|
|
| private final AccountManagerDelegate mAccountManager;
|
|
|
| + private Context mApplicationContext;
|
| +
|
| /**
|
| * A simple callback for getAuthToken.
|
| */
|
| @@ -73,9 +75,11 @@
|
| }
|
|
|
| /**
|
| + * @param context the Android context
|
| * @param accountManager the account manager to use as a backend service
|
| */
|
| - private AccountManagerHelper(AccountManagerDelegate accountManager) {
|
| + private AccountManagerHelper(Context context, AccountManagerDelegate accountManager) {
|
| + mApplicationContext = context.getApplicationContext();
|
| mAccountManager = accountManager;
|
| }
|
|
|
| @@ -84,12 +88,14 @@
|
| * 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(AccountManagerDelegate delegate) {
|
| + public static void initializeAccountManagerHelper(
|
| + Context context, AccountManagerDelegate delegate) {
|
| synchronized (sLock) {
|
| assert sAccountManagerHelper == null;
|
| - sAccountManagerHelper = new AccountManagerHelper(delegate);
|
| + sAccountManagerHelper = new AccountManagerHelper(context, delegate);
|
| }
|
| }
|
|
|
| @@ -97,13 +103,14 @@
|
| * 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() {
|
| + public static AccountManagerHelper get(Context context) {
|
| synchronized (sLock) {
|
| if (sAccountManagerHelper == null) {
|
| - sAccountManagerHelper =
|
| - new AccountManagerHelper(new SystemAccountManagerDelegate());
|
| + sAccountManagerHelper = new AccountManagerHelper(
|
| + context, new SystemAccountManagerDelegate(context));
|
| }
|
| }
|
| return sAccountManagerHelper;
|
| @@ -121,7 +128,7 @@
|
| public static void overrideAccountManagerHelperForTests(
|
| Context context, AccountManagerDelegate delegate) {
|
| synchronized (sLock) {
|
| - sAccountManagerHelper = new AccountManagerHelper(delegate);
|
| + sAccountManagerHelper = new AccountManagerHelper(context, delegate);
|
| }
|
| }
|
|
|
|
|