Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferences.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferences.java |
| index 138850528e849021be56a42698744cfef6088bea..009c32111a052ee82010f27d47236bf2242826fc 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferences.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferences.java |
| @@ -274,14 +274,30 @@ public class ClearBrowsingDataPreferences extends PreferenceFragment |
| option.getDataType()); |
| } |
| - // Called when "clear browsing data" completes. |
| - // Implements the ChromePreferences.OnClearBrowsingDataListener interface. |
| + private OtherFormsOfHistoryDialogFragment mDialogAboutOtherFormsOfBrowsingHistory; |
| + private boolean mDialogAboutOtherFormsOfBrowsingHistoryEnabled; |
|
gone
2016/04/07 21:05:26
Group these new member fields with the other ones
msramek
2016/04/08 11:20:42
Done.
|
| + |
| + /** |
| + * Called when clearing browsing data completes. |
| + * Implements the ChromePreferences.OnClearBrowsingDataListener interface. |
| + */ |
| @Override |
| public void onBrowsingDataCleared() { |
| if (getActivity() == null) return; |
| - dismissProgressDialog(); |
| - getActivity().finish(); |
| + // If the user deleted their browsing history, the dialog about other forms of history |
| + // is enabled, and it has never been shown before, show it. Otherwise, just close this |
| + // preference screen. |
| + if (getSelectedOptions().contains(DialogOption.CLEAR_HISTORY) |
| + && mDialogAboutOtherFormsOfBrowsingHistoryEnabled |
| + && !OtherFormsOfHistoryDialogFragment.wasDialogShown(getActivity())) { |
| + mDialogAboutOtherFormsOfBrowsingHistory = |
| + OtherFormsOfHistoryDialogFragment.show(getActivity()); |
| + dismissProgressDialog(); |
| + } else { |
| + dismissProgressDialog(); |
| + getActivity().finish(); |
| + } |
| } |
| @Override |
| @@ -455,4 +471,22 @@ public class ClearBrowsingDataPreferences extends PreferenceFragment |
| google_summary.setSummary( |
| R.string.clear_browsing_data_footnote_signed_and_other_forms_of_history); |
| } |
| + |
| + /** |
| + * Enables the dialog about other forms of browsing history that will be shown to the user |
| + * after deleting their Chrome history. To be called by the web history service when the |
| + * conditions for showing the dialog are met. |
| + */ |
| + @VisibleForTesting |
| + public void enableDialogAboutOtherFormsOfBrowsingHistory() { |
|
gone
2016/04/07 21:05:26
...BrowsingHistoryForTests() to make it explicit.
msramek
2016/04/08 11:20:42
They are currently used only in tests, because the
|
| + mDialogAboutOtherFormsOfBrowsingHistoryEnabled = true; |
|
gone
2016/04/07 21:05:26
mIsDialogAboutOtherFormsOfBrowsingHistoryEnabled?
msramek
2016/04/08 11:20:42
Done.
|
| + } |
| + |
| + /** |
| + * Used only to access the dialog about other forms of browsing history from tests. |
| + */ |
| + @VisibleForTesting |
| + OtherFormsOfHistoryDialogFragment getDialogAboutOtherFormsOfBrowsingHistory() { |
|
gone
2016/04/07 21:05:26
...BrowsingHistoryForTests()
msramek
2016/04/08 11:20:42
Ditto as above.
|
| + return mDialogAboutOtherFormsOfBrowsingHistory; |
| + } |
| } |