Commit 52740c72 authored by Boris Sazonov's avatar Boris Sazonov Committed by Commit Bot

[Signin][Android] Remove sign-out dialog from ConfirmManagedSyncDataDialog

Removes the sign-out dialog implementation from
ConfirmManagedSyncDataDialog and calls to it from
AccountManagementFragment, as the correct sign-out dialog for managed
accounts is implemented by SignOutDialogFragment.

Bug: 1007250
Change-Id: I73fad2459efac5b0a2f27575a2e63adcf8cdf3d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1738698
Commit-Queue: Boris Sazonov <bsazonov@chromium.org>
Commit-Queue: Alex Ilin <alexilin@chromium.org>
Auto-Submit: Boris Sazonov <bsazonov@chromium.org>
Reviewed-by: default avatarAlex Ilin <alexilin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699455}
parent 6ac7a6bb
......@@ -36,7 +36,6 @@ import org.chromium.chrome.browser.preferences.PrefServiceBridge;
import org.chromium.chrome.browser.preferences.PreferencesLauncher;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileAccountManagementMetrics;
import org.chromium.chrome.browser.signin.ConfirmManagedSyncDataDialog;
import org.chromium.chrome.browser.signin.IdentityServicesProvider;
import org.chromium.chrome.browser.signin.ProfileDataCache;
import org.chromium.chrome.browser.signin.SignOutDialogFragment;
......@@ -62,8 +61,7 @@ import java.util.List;
* Note: This can be triggered from a web page, e.g. a GAIA sign-in page.
*/
public class AccountManagementFragment extends PreferenceFragmentCompat
implements SignOutDialogListener, SignInStateObserver,
ConfirmManagedSyncDataDialog.Listener, ProfileDataCache.Observer {
implements SignOutDialogListener, SignInStateObserver, ProfileDataCache.Observer {
private static final String TAG = "AcctManagementPref";
public static final String SIGN_OUT_DIALOG_TAG = "sign_out_dialog_tag";
......@@ -213,24 +211,13 @@ public class AccountManagementFragment extends PreferenceFragmentCompat
SigninUtils.logEvent(
ProfileAccountManagementMetrics.TOGGLE_SIGNOUT, mGaiaServiceType);
String managementDomain =
IdentityServicesProvider.getSigninManager().getManagementDomain();
if (managementDomain != null) {
// Show the 'You are signing out of a managed account' dialog.
ConfirmManagedSyncDataDialog.showSignOutFromManagedAccountDialog(
AccountManagementFragment.this, getFragmentManager(),
getResources(), managementDomain);
} else {
// Show the 'You are signing out' dialog.
SignOutDialogFragment signOutFragment = new SignOutDialogFragment();
Bundle args = new Bundle();
args.putInt(SHOW_GAIA_SERVICE_TYPE_EXTRA, mGaiaServiceType);
signOutFragment.setArguments(args);
signOutFragment.setTargetFragment(AccountManagementFragment.this, 0);
signOutFragment.show(getFragmentManager(), SIGN_OUT_DIALOG_TAG);
}
SignOutDialogFragment signOutFragment = new SignOutDialogFragment();
Bundle args = new Bundle();
args.putInt(SHOW_GAIA_SERVICE_TYPE_EXTRA, mGaiaServiceType);
signOutFragment.setArguments(args);
signOutFragment.setTargetFragment(AccountManagementFragment.this, 0);
signOutFragment.show(getFragmentManager(), SIGN_OUT_DIALOG_TAG);
return true;
}
......@@ -415,17 +402,6 @@ public class AccountManagementFragment extends PreferenceFragmentCompat
}
}
// ConfirmManagedSyncDataDialog.Listener implementation
@Override
public void onConfirm() {
onSignOutClicked(false);
}
@Override
public void onCancel() {
onSignOutDialogDismissed(false);
}
// SignInStateObserver implementation:
@Override
......
......@@ -66,22 +66,6 @@ public class ConfirmManagedSyncDataDialog extends DialogFragment
String desc = resources.getString(R.string.sign_in_managed_account_description, domain);
showNewInstance(title, desc, positive, negative, fragmentManager, callback);
}
/**
* Create the dialog to show when signing out of a managed account (but not switching from a
* managed account).
* @param callback Callback for result.
* @param fragmentManager FragmentManaged to display the dialog.
* @param resources Resources to load the strings.
* @param domain The domain of the managed account.
*/
public static void showSignOutFromManagedAccountDialog(Listener callback,
FragmentManager fragmentManager, Resources resources, String domain) {
String title = resources.getString(R.string.sign_out_managed_account);
String positive = resources.getString(R.string.accept_and_sign_out);
String negative = resources.getString(R.string.cancel);
String desc = resources.getString(R.string.sign_out_managed_account_description, domain);
showNewInstance(title, desc, positive, negative, fragmentManager, callback);
}
/**
* Create the dialog to show when switching from a managed account.
......
......@@ -1636,15 +1636,9 @@ Your Google account may have other forms of browsing history like searches and a
<message name="IDS_SIGN_IN_MANAGED_ACCOUNT_DESCRIPTION" desc="Description for signing in to managed accounts">
You are signing in with an account managed by <ph name="MANAGED_DOMAIN">%1$s<ex>Google</ex></ph> and giving its administrator control over your Chrome data. Your data will become permanently tied to this account. Signing out of Chrome will delete your data from this device, but it will remain stored in your Google Account.
</message>
<message name="IDS_SIGN_OUT_MANAGED_ACCOUNT_DESCRIPTION" desc="Description for signing out of a managed account">
You are signing out of an account managed by <ph name="MANAGED_DOMAIN">%1$s<ex>Google</ex></ph>. This will delete your Chrome data from this device, but your data will remain in your Google Account.
</message>
<message name="IDS_SWITCH_FROM_MANAGED_ACCOUNT_DESCRIPTION" desc="Description for switching from a managed account">
You are switching sync accounts from <ph name="ACCOUNT_EMAIL_OLD">%1$s<ex>user@example.com</ex></ph> to <ph name="ACCOUNT_EMAIL_NEW">%2$s<ex>user@example.com</ex></ph>. Your existing Chrome data is managed by <ph name="MANAGED_DOMAIN">%3$s<ex>Google</ex></ph>. This will delete your data from this device, but your data will remain in <ph name="ACCOUNT_EMAIL_OLD">%1$s<ex>user@example.com</ex></ph>.
</message>
<message name="IDS_ACCEPT_AND_SIGN_OUT" desc="Button displayed for user to confirm and sign out of a managed account">
Accept and sign out
</message>
<message name="IDS_ACCEPT_AND_SWITCH_ACCOUNTS" desc="Button displayed for user to confirm and switch from a managed account">
Accept and switch accounts
</message>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment