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

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

Issue 2671743002: Separate state of basic and advanced tab in CBD dialog (Closed)
Patch Set: fix .classpath file Created 3 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/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 800535b612bcbece1d2fc76476c443a19d9f6333..53486881a27a1ffbde4a87395be03f12a8c08165 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
@@ -19,6 +19,7 @@ import org.chromium.base.metrics.RecordUserAction;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.browsing_data.BrowsingDataType;
+import org.chromium.chrome.browser.browsing_data.ClearBrowsingDataPreferenceType;
import org.chromium.chrome.browser.browsing_data.TimePeriod;
import org.chromium.chrome.browser.help.HelpAndFeedback;
import org.chromium.chrome.browser.multiwindow.MultiWindowUtils;
@@ -66,7 +67,8 @@ public class ClearBrowsingDataPreferences extends PreferenceFragment
mParent = parent;
mOption = option;
mCheckbox = checkbox;
- mCounter = new BrowsingDataCounterBridge(this, mOption.getDataType());
+ mCounter = new BrowsingDataCounterBridge(
+ this, mOption.getDataType(), mParent.getPreferenceType());
mCheckbox.setOnPreferenceClickListener(this);
mCheckbox.setEnabled(enabled);
@@ -98,7 +100,7 @@ public class ClearBrowsingDataPreferences extends PreferenceFragment
mParent.updateButtonState();
mShouldAnnounceCounterResult = true;
PrefServiceBridge.getInstance().setBrowsingDataDeletionPreference(
- mOption.getDataType(), mCheckbox.isChecked());
+ mOption.getDataType(), mParent.getPreferenceType(), mCheckbox.isChecked());
return true;
}
@@ -299,6 +301,14 @@ public class ClearBrowsingDataPreferences extends PreferenceFragment
}
/**
+ * Returns whether this preference page is a basic or advanced tab in order to use separate
msramek 2017/02/08 10:55:55 // This method returns 1 or 2. int method() { retu
dullweber 2017/02/08 23:03:18 ahh right, that's stupid :D Should be solved now,
+ * preferences.
+ */
+ protected int getPreferenceType() {
+ return ClearBrowsingDataPreferenceType.DEFAULT;
+ }
+
+ /**
* Returns the Array of time periods. Options are displayed in the same order as they appear
* in the array.
*/
@@ -328,7 +338,7 @@ public class ClearBrowsingDataPreferences extends PreferenceFragment
*/
private boolean isOptionSelectedByDefault(DialogOption option) {
return PrefServiceBridge.getInstance().getBrowsingDataDeletionPreference(
- option.getDataType());
+ option.getDataType(), getPreferenceType());
}
/**
@@ -416,7 +426,7 @@ public class ClearBrowsingDataPreferences extends PreferenceFragment
}
PrefServiceBridge.getInstance().setBrowsingDataDeletionTimePeriod(
- ((TimePeriodSpinnerOption) value).getTimePeriod());
+ getPreferenceType(), ((TimePeriodSpinnerOption) value).getTimePeriod());
return true;
}
return false;
@@ -457,7 +467,8 @@ public class ClearBrowsingDataPreferences extends PreferenceFragment
&& !PrefServiceBridge.getInstance().canDeleteBrowsingHistory()) {
enabled = false;
PrefServiceBridge.getInstance().setBrowsingDataDeletionPreference(
- DialogOption.CLEAR_HISTORY.getDataType(), false);
+ DialogOption.CLEAR_HISTORY.getDataType(),
+ ClearBrowsingDataPreferenceType.DEFAULT, false);
}
mItems[i] = new Item(
@@ -480,8 +491,8 @@ public class ClearBrowsingDataPreferences extends PreferenceFragment
SpinnerPreference spinner = (SpinnerPreference) findPreference(PREF_TIME_RANGE);
spinner.setOnPreferenceChangeListener(this);
TimePeriodSpinnerOption[] spinnerOptions = getTimePeriodSpinnerOptions();
- int selectedTimePeriod =
- PrefServiceBridge.getInstance().getBrowsingDataDeletionTimePeriod();
+ int selectedTimePeriod = PrefServiceBridge.getInstance().getBrowsingDataDeletionTimePeriod(
+ getPreferenceType());
int spinnerOptionIndex = -1;
for (int i = 0; i < spinnerOptions.length; ++i) {
if (spinnerOptions[i].getTimePeriod() == selectedTimePeriod) {

Powered by Google App Engine
This is Rietveld 408576698