Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/child_accounts/ResetDataDialogFragment.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/child_accounts/ResetDataDialogFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/child_accounts/ResetDataDialogFragment.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..526aa26fc8e4e5ffe732e5153ab1b733a80363d4 |
| --- /dev/null |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/child_accounts/ResetDataDialogFragment.java |
| @@ -0,0 +1,65 @@ |
| +// Copyright 2015 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.child_accounts; |
| + |
| +import android.app.Dialog; |
| +import android.content.Context; |
| +import android.content.DialogInterface; |
| +import android.os.Bundle; |
| +import android.support.v4.app.DialogFragment; |
| +import android.support.v7.app.AlertDialog; |
| + |
| +import org.chromium.chrome.R; |
| + |
| +/** |
| + * A dialog that prompts the user to reset all data in Chrome, |
| + * as part of the child account setup. |
| + */ |
| +public class ResetDataDialogFragment extends DialogFragment { |
| + |
| + /** |
| + * Callback interface for the client of the dialog to be notified about the chosen user action. |
| + */ |
| + public interface DialogListener { |
| + void onResetData(DialogFragment dialog); |
| + void onKeepData(DialogFragment dialog); |
| + void onCancel(DialogFragment dialog); |
| + } |
| + |
| + private Context mContext; |
| + private DialogListener mDialogListener; |
| + |
| + public ResetDataDialogFragment(Context context, DialogListener listener) { |
| + mContext = context; |
| + mDialogListener = listener; |
| + } |
| + |
| + @Override |
| + public Dialog onCreateDialog(Bundle savedInstanceState) { |
| + return new AlertDialog.Builder(mContext) |
|
aurimas (slooooooooow)
2015/06/09 17:45:03
Use R.style.AlertDialogTheme to match the rest of
|
| + .setMessage(R.string.reset_data_dialog_title) |
| + .setPositiveButton(R.string.reset_data_dialog_reset_button, |
| + new DialogInterface.OnClickListener() { |
| + @Override |
| + public void onClick(DialogInterface dialog, int which) { |
| + mDialogListener.onResetData(ResetDataDialogFragment.this); |
| + } |
| + }) |
| + .setNegativeButton(R.string.reset_data_dialog_reset_button, |
| + new DialogInterface.OnClickListener() { |
| + @Override |
| + public void onClick(DialogInterface dialog, int which) { |
| + mDialogListener.onKeepData(ResetDataDialogFragment.this); |
| + } |
| + }).create(); |
| + } |
| + |
| + @Override |
| + public void onDismiss(DialogInterface dialog) { |
| + mDialogListener.onCancel(this); |
| + super.onDismiss(dialog); |
| + } |
| + |
| +} |