OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.signin; | 5 package org.chromium.chrome.browser.signin; |
6 | 6 |
7 import android.accounts.Account; | 7 import android.accounts.Account; |
| 8 import android.annotation.SuppressLint; |
8 import android.content.Context; | 9 import android.content.Context; |
9 import android.os.AsyncTask; | 10 import android.os.AsyncTask; |
10 | 11 |
11 import com.google.android.gms.auth.AccountChangeEvent; | 12 import com.google.android.gms.auth.AccountChangeEvent; |
12 import com.google.android.gms.auth.GoogleAuthException; | 13 import com.google.android.gms.auth.GoogleAuthException; |
13 import com.google.android.gms.auth.GoogleAuthUtil; | 14 import com.google.android.gms.auth.GoogleAuthUtil; |
14 | 15 |
15 import org.chromium.base.ContextUtils; | 16 import org.chromium.base.ContextUtils; |
16 import org.chromium.base.Log; | 17 import org.chromium.base.Log; |
17 import org.chromium.base.VisibleForTesting; | 18 import org.chromium.base.VisibleForTesting; |
(...skipping 28 matching lines...) Expand all Loading... |
46 | 47 |
47 // Key to the shared pref that holds the new account's name if the currently
signed | 48 // Key to the shared pref that holds the new account's name if the currently
signed |
48 // in account has been renamed. | 49 // in account has been renamed. |
49 private static final String ACCOUNT_RENAMED_PREFS_KEY = "prefs_sync_account_
renamed"; | 50 private static final String ACCOUNT_RENAMED_PREFS_KEY = "prefs_sync_account_
renamed"; |
50 | 51 |
51 // Key to the shared pref that holds the last read index of all the account
changed | 52 // Key to the shared pref that holds the last read index of all the account
changed |
52 // events of the current signed in account. | 53 // events of the current signed in account. |
53 private static final String ACCOUNT_RENAME_EVENT_INDEX_PREFS_KEY = | 54 private static final String ACCOUNT_RENAME_EVENT_INDEX_PREFS_KEY = |
54 "prefs_sync_account_rename_event_index"; | 55 "prefs_sync_account_rename_event_index"; |
55 | 56 |
| 57 @SuppressLint("StaticFieldLeak") |
56 private static SigninHelper sInstance; | 58 private static SigninHelper sInstance; |
57 | 59 |
58 /** | 60 /** |
59 * Retrieve more detailed information from account changed intents. | 61 * Retrieve more detailed information from account changed intents. |
60 */ | 62 */ |
61 public static interface AccountChangeEventChecker { | 63 public static interface AccountChangeEventChecker { |
62 public List<String> getAccountChangeEvents( | 64 public List<String> getAccountChangeEvents( |
63 Context context, int index, String accountName); | 65 Context context, int index, String accountName); |
64 } | 66 } |
65 | 67 |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 .getBoolean(ACCOUNTS_CHANGED_PREFS_KEY, false)) { | 374 .getBoolean(ACCOUNTS_CHANGED_PREFS_KEY, false)) { |
373 // Clear the value in prefs. | 375 // Clear the value in prefs. |
374 ContextUtils.getAppSharedPreferences() | 376 ContextUtils.getAppSharedPreferences() |
375 .edit().putBoolean(ACCOUNTS_CHANGED_PREFS_KEY, false).apply(
); | 377 .edit().putBoolean(ACCOUNTS_CHANGED_PREFS_KEY, false).apply(
); |
376 return true; | 378 return true; |
377 } else { | 379 } else { |
378 return false; | 380 return false; |
379 } | 381 } |
380 } | 382 } |
381 } | 383 } |
OLD | NEW |