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

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

Issue 1745563002: Revert of 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/SyncAccountSwitcher.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncAccountSwitcher.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncAccountSwitcher.java
deleted file mode 100644
index bb70a3f233194fae703449a029e7cb5bcac771ed..0000000000000000000000000000000000000000
--- a/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncAccountSwitcher.java
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.chrome.browser.sync;
-
-import android.app.Activity;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.text.TextUtils;
-
-import org.chromium.chrome.browser.preferences.SyncedAccountPreference;
-import org.chromium.chrome.browser.signin.SigninManager;
-import org.chromium.chrome.browser.signin.SigninManager.SignInCallback;
-import org.chromium.chrome.browser.sync.ui.ConfirmImportSyncDataDialog;
-import org.chromium.chrome.browser.sync.ui.ConfirmImportSyncDataDialog.ImportSyncType;
-
-/**
- * A class that encapsulates the control flow of listeners and callbacks when switching sync
- * accounts.
- *
- * Control flows through the method in this order:
- * {@link OnPreferenceChangeListener#onPreferenceChange}
- * {@link ConfirmImportSyncDataDialog.Listener#onConfirm}
- * {@link SignInCallback#onSignInComplete}
- */
-public class SyncAccountSwitcher
- implements OnPreferenceChangeListener, ConfirmImportSyncDataDialog.Listener,
- SignInCallback {
- private static final String TAG = "SyncAccountSwitcher";
-
- private final SyncedAccountPreference mSyncedAccountPreference;
- private final Activity mActivity;
-
- private String mNewAccountName;
-
- /**
- * Sets up a SyncAccountSwitcher to be ready to accept callbacks.
- * @param activity Activity used to get the context for signin and get the fragmentManager
- * for the data sync fragment.
- * @param syncedAccountPreference The preference to update once signin has been completed.
- */
- public SyncAccountSwitcher(Activity activity, SyncedAccountPreference syncedAccountPreference) {
- mActivity = activity;
- mSyncedAccountPreference = syncedAccountPreference;
- }
-
- @Override
- public boolean onPreferenceChange(Preference p, Object newValue) {
- if (newValue == null) return false;
-
- mNewAccountName = (String) newValue;
- String currentAccount = mSyncedAccountPreference.getValue();
-
- if (TextUtils.equals(mNewAccountName, currentAccount)) return false;
-
- ConfirmImportSyncDataDialog.showNewInstance(currentAccount, mNewAccountName,
- ImportSyncType.SWITCHING_SYNC_ACCOUNTS, mActivity.getFragmentManager(), this);
-
- // Don't update the selected account in the preference. It will be updated by
- // the call to mSyncAccountListPreference.update() if everything succeeds.
- return false;
- }
-
- @Override
- public void onConfirm() {
- assert mNewAccountName != null;
- SigninManager.get(mActivity).signIn(mNewAccountName, mActivity, this);
- }
-
- @Override
- public void onSignInComplete() {
- // Update the Preference so it displays the correct account name.
- mSyncedAccountPreference.update();
- }
-
- @Override
- public void onSignInAborted() {
- // If the user aborted signin, there is nothing to do.
- }
-}

Powered by Google App Engine
This is Rietveld 408576698