Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/SyncedAccountPreference.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/SyncedAccountPreference.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/SyncedAccountPreference.java |
| index 9a7f8ff9fe92613900b8c53c4bca72bec681b0fb..d182d6d60c838540cd0cf2f7d68dcbb58ae1c2ea 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/SyncedAccountPreference.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/SyncedAccountPreference.java |
| @@ -20,6 +20,7 @@ import org.chromium.sync.signin.ChromeSigninController; |
| * account to use for syncing |
| */ |
| public class SyncedAccountPreference extends ListPreference { |
| + private static final String TAG = "SyncedAccountPreference"; |
| /** |
| * Constructor for inflating from XML |
| @@ -30,6 +31,10 @@ public class SyncedAccountPreference extends ListPreference { |
| updateAccountsList(); |
| } |
| + public void update() { |
|
Yusuf
2016/02/18 19:16:16
javadoc
PEConn
2016/02/19 18:10:10
Done.
|
| + updateAccountsList(); |
| + } |
| + |
| private void updateAccountsList() { |
| boolean syncEnabled = AndroidSyncSettings.isSyncEnabled(getContext()); |
| if (!syncEnabled) { |
| @@ -57,13 +62,19 @@ public class SyncedAccountPreference extends ListPreference { |
| setEntries(accountNames); |
| setEntryValues(accountValues); |
| - setDefaultValue(signedInSettingsKey); |
| + setValue(signedInSettingsKey); |
| setSummary(signedInAccountName); |
| } |
| + public String valueToEntry(String value) { |
|
Yusuf
2016/02/18 19:16:16
Can we add this as a TODO somewhere in the class d
PEConn
2016/02/19 18:10:10
I simplified the code and got rid of this.
|
| + // It is useful to have a way of mapping from values (the data the SyncedAccountPreference |
| + // stores) to entries (the data displayed to the user). At the moment they are the same |
| + // but this may change and it's neater to keep the logic in this class. |
| + return value; |
| + } |
| + |
| @Override |
| protected void onDialogClosed(boolean positiveResult) { |
| super.onDialogClosed(positiveResult); |
| - // TODO(crbug/557786): Add switching sync accounts |
| } |
| } |