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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncCustomizationFragment.java

Issue 1698043006: Created the dialog offering the user to merge their account data or keep it (Closed) Base URL: maybelle.lon.corp.google.com:/usr/local/google/code/clankium/src@sync_settings
Patch Set: Created 4 years, 10 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: chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncCustomizationFragment.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncCustomizationFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncCustomizationFragment.java
index 4c43d3223e0af8f2513dcd8b2623e78268269149..6a55e61d35921fb9e288f2e998328eeabf6c8143 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncCustomizationFragment.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncCustomizationFragment.java
@@ -34,6 +34,7 @@ import org.chromium.chrome.browser.invalidation.InvalidationController;
import org.chromium.chrome.browser.preferences.ChromeSwitchPreference;
import org.chromium.chrome.browser.preferences.SyncedAccountPreference;
import org.chromium.chrome.browser.sync.ProfileSyncService;
+import org.chromium.chrome.browser.sync.SyncAccountSwitcher;
import org.chromium.sync.AndroidSyncSettings;
import org.chromium.sync.ModelType;
import org.chromium.sync.PassphraseType;
@@ -114,12 +115,13 @@ public class SyncCustomizationFragment extends PreferenceFragment
private Preference mSyncEncryption;
private Preference mManageSyncData;
private CheckBoxPreference[] mAllTypes;
+ private SyncedAccountPreference mSyncedAccountPreference;
private ProfileSyncService mProfileSyncService;
@Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
+ public View onCreateView(
+ LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mProfileSyncService = ProfileSyncService.get();
assert mProfileSyncService != null;
mIsBackendInitialized = mProfileSyncService.isBackendInitialized();
@@ -176,6 +178,11 @@ public class SyncCustomizationFragment extends PreferenceFragment
}
});
+ mSyncedAccountPreference =
+ (SyncedAccountPreference) findPreference(PREFERENCE_SYNC_ACCOUNT_LIST);
+ mSyncedAccountPreference.setOnPreferenceChangeListener(new SyncAccountSwitcher(
+ getActivity(), getFragmentManager(), mSyncedAccountPreference));
+
return view;
}
@@ -272,10 +279,9 @@ public class SyncCustomizationFragment extends PreferenceFragment
}
/**
- * Update the state of all settings from sync.
- *
- * This sets the state of the sync switch from external sync state and then calls
- * updateSyncStateFromSwitch, which uses that as its source of truth.
+ * Update the state of all settings from sync. This sets the state of the sync switch from
May 2016/02/17 14:22:11 I've had to revert a bunch of auto-formatted white
PEConn 2016/02/17 17:16:48 Acknowledged.
+ * external sync state and then calls updateSyncStateFromSwitch, which uses that as its source
+ * of truth.
*/
private void updateSyncState() {
boolean isSyncEnabled = AndroidSyncSettings.isSyncEnabled(getActivity());
@@ -285,9 +291,7 @@ public class SyncCustomizationFragment extends PreferenceFragment
}
private void updateSyncAccountsListState() {
- SyncedAccountPreference accountList =
- (SyncedAccountPreference) findPreference(PREFERENCE_SYNC_ACCOUNT_LIST);
- accountList.setEnabled(mSyncSwitchPreference.isChecked());
+ mSyncedAccountPreference.setEnabled(mSyncSwitchPreference.isChecked());
}
/**
@@ -301,12 +305,10 @@ public class SyncCustomizationFragment extends PreferenceFragment
}
/**
- * Update the encryption state.
- *
- * If sync's backend is initialized, the button is enabled and the dialog will present the
- * valid encryption options for the user. Otherwise, any encryption dialogs will be closed
- * and the button will be disabled because the backend is needed in order to know and
- * modify the encryption state.
+ * Update the encryption state. If sync's backend is initialized, the button is enabled and the
+ * dialog will present the valid encryption options for the user. Otherwise, any encryption
+ * dialogs will be closed and the button will be disabled because the backend is needed in order
+ * to know and modify the encryption state.
*/
private void updateEncryptionState() {
boolean isSyncEnabled = mSyncSwitchPreference.isChecked();
@@ -510,10 +512,8 @@ public class SyncCustomizationFragment extends PreferenceFragment
}
/**
- * Update the state of the sync everything switch.
- *
- * If sync is on, load the pref from native. Otherwise display sync everything as on but
- * disable the switch.
+ * Update the state of the sync everything switch. If sync is on, load the pref from native.
+ * Otherwise display sync everything as on but disable the switch.
*/
private void updateSyncEverythingState() {
boolean isSyncEnabled = mSyncSwitchPreference.isChecked();
@@ -523,11 +523,10 @@ public class SyncCustomizationFragment extends PreferenceFragment
}
/**
- * Update the data type switch state.
- *
- * If sync is on, load the prefs from native. Otherwise, all data types are disabled and
- * checked. Note that the Password data type will be shown as disabled and unchecked between
- * sync being turned on and the backend initialization completing.
+ * Update the data type switch state. If sync is on, load the prefs from native. Otherwise, all
+ * data types are disabled and checked. Note that the Password data type will be shown as
+ * disabled and unchecked between sync being turned on and the backend initialization
+ * completing.
*/
private void updateDataTypeState() {
boolean isSyncEnabled = mSyncSwitchPreference.isChecked();
@@ -565,10 +564,8 @@ public class SyncCustomizationFragment extends PreferenceFragment
}
/**
- * Listen to sync state changes.
- *
- * If the user has just turned on sync, this listener is needed in order to enable
- * the encryption settings once the backend has initialized.
+ * Listen to sync state changes. If the user has just turned on sync, this listener is needed in
+ * order to enable the encryption settings once the backend has initialized.
*/
@Override
public void syncStateChanged() {

Powered by Google App Engine
This is Rietveld 408576698