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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataDialogFragment.java

Issue 1059453003: Revert of Respect prefs::kAllowDeletingBrowserHistory in the Clear History UI on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataDialogFragment.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataDialogFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataDialogFragment.java
index c339c91daf0673274b54c7fc5c549c4185f1b31d..fdaac2f632d31a8a3a548baf57b91763001faff6 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataDialogFragment.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataDialogFragment.java
@@ -17,10 +17,7 @@ import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.view.View;
import android.widget.Button;
-import android.widget.CheckedTextView;
-import android.widget.ListView;
import android.widget.TextView;
-import android.widget.Toast;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.preferences.PrefServiceBridge;
@@ -73,7 +70,6 @@ public class ClearBrowsingDataDialogFragment extends DialogFragment implements
private DialogOption[] mOptions;
private AlertDialog mDialog;
private ProgressDialog mProgressDialog;
- private boolean mCanDeleteBrowsingHistory;
protected final void clearBrowsingData(EnumSet<DialogOption> selectedOptions) {
PrefServiceBridge.getInstance().clearBrowsingData(this,
@@ -111,12 +107,8 @@ public class ClearBrowsingDataDialogFragment extends DialogFragment implements
* @return EnumSet containing dialog options to be selected.
*/
protected EnumSet<DialogOption> getDefaultDialogOptionsSelections() {
- EnumSet<DialogOption> defaultOptions = EnumSet.of(DialogOption.CLEAR_CACHE,
+ return EnumSet.of(DialogOption.CLEAR_HISTORY, DialogOption.CLEAR_CACHE,
DialogOption.CLEAR_COOKIES_AND_SITE_DATA);
- if (mCanDeleteBrowsingHistory) {
- defaultOptions.add(DialogOption.CLEAR_HISTORY);
- }
- return defaultOptions;
}
// Called when "clear browsing data" completes.
@@ -144,31 +136,16 @@ public class ClearBrowsingDataDialogFragment extends DialogFragment implements
@Override
public void onClick(DialogInterface dialog, int whichButton, boolean isChecked) {
- DialogOption clickedOption = mOptions[whichButton];
- CheckedTextView clickedCheckBox =
- (CheckedTextView) mDialog.getListView().getChildAt(whichButton);
- if (!mCanDeleteBrowsingHistory) {
- // Manually managing the Checkbox to handle disabled options.
- if (clickedOption == DialogOption.CLEAR_HISTORY) {
- Toast.makeText(getActivity(),
- R.string.can_not_clear_browsing_history_toast,
- Toast.LENGTH_SHORT).show();
- return;
- }
- clickedCheckBox.toggle();
- }
- // isChecked is always false when ListView does not manage the Checkbox.
- if (clickedCheckBox.isChecked()) {
- mSelectedOptions.add(clickedOption);
+ if (isChecked) {
+ mSelectedOptions.add(mOptions[whichButton]);
} else {
- mSelectedOptions.remove(clickedOption);
+ mSelectedOptions.remove(mOptions[whichButton]);
}
updateButtonState();
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
- mCanDeleteBrowsingHistory = PrefServiceBridge.getInstance().canDeleteBrowsingHistory();
DialogOption[] options = getDialogOptions();
mOptions = Arrays.copyOf(options, options.length);
mSelectedOptions = getDefaultDialogOptionsSelections();
@@ -216,19 +193,6 @@ public class ClearBrowsingDataDialogFragment extends DialogFragment implements
}
mDialog = builder.create();
- if (!mCanDeleteBrowsingHistory) {
- // Disable management of the Checkboxes by the ListView.
- mDialog.getListView().setChoiceMode(ListView.CHOICE_MODE_NONE);
- // Children views of the ListView are not created until it is drawn.
- mDialog.getListView().post(new Runnable() {
- @Override
- public void run() {
- int positionOfHistoryElement =
- Arrays.asList(mOptions).indexOf(DialogOption.CLEAR_HISTORY);
- mDialog.getListView().getChildAt(positionOfHistoryElement).setEnabled(false);
- }
- });
- }
return mDialog;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698