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

Unified Diff: chrome/browser/android/preferences/pref_service_bridge.cc

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/browser/android/preferences/pref_service_bridge.cc
diff --git a/chrome/browser/android/preferences/pref_service_bridge.cc b/chrome/browser/android/preferences/pref_service_bridge.cc
index 1648ab1187c5a89c07fb8b2e265b98157d8e6499..63ed56913d8835df02877a8fc1be02c7d9098bd4 100644
--- a/chrome/browser/android/preferences/pref_service_bridge.cc
+++ b/chrome/browser/android/preferences/pref_service_bridge.cc
@@ -132,6 +132,15 @@ PrefService* GetPrefService() {
return GetOriginalProfile()->GetPrefs();
}
+browsing_data::ClearBrowsingDataPreferenceType ToPrefType(jint pref_type) {
+ DCHECK_GE(pref_type, 0);
+ DCHECK_LT(pref_type,
+ static_cast<int>(
+ browsing_data::ClearBrowsingDataPreferenceType::NUM_TYPES));
+
+ return static_cast<browsing_data::ClearBrowsingDataPreferenceType>(pref_type);
+}
+
} // namespace
// ----------------------------------------------------------------------------
@@ -539,7 +548,8 @@ class ClearBrowsingDataObserver : public BrowsingDataRemover::Observer {
static jboolean GetBrowsingDataDeletionPreference(
JNIEnv* env,
const JavaParamRef<jobject>& obj,
- jint data_type) {
+ jint data_type,
+ jint pref_type) {
DCHECK_GE(data_type, 0);
DCHECK_LT(data_type, browsing_data::NUM_TYPES);
@@ -549,44 +559,48 @@ static jboolean GetBrowsingDataDeletionPreference(
// data types for consistency.
std::string pref;
if (!browsing_data::GetDeletionPreferenceFromDataType(
- static_cast<browsing_data::BrowsingDataType>(data_type), &pref)) {
+ static_cast<browsing_data::BrowsingDataType>(data_type),
+ ToPrefType(pref_type), &pref)) {
return false;
}
return GetOriginalProfile()->GetPrefs()->GetBoolean(pref);
}
-static void SetBrowsingDataDeletionPreference(
- JNIEnv* env,
- const JavaParamRef<jobject>& obj,
- jint data_type,
- jboolean value) {
+static void SetBrowsingDataDeletionPreference(JNIEnv* env,
+ const JavaParamRef<jobject>& obj,
+ jint data_type,
+ jint pref_type,
+ jboolean value) {
DCHECK_GE(data_type, 0);
DCHECK_LT(data_type, browsing_data::NUM_TYPES);
std::string pref;
if (!browsing_data::GetDeletionPreferenceFromDataType(
- static_cast<browsing_data::BrowsingDataType>(data_type), &pref)) {
+ static_cast<browsing_data::BrowsingDataType>(data_type),
+ ToPrefType(pref_type), &pref)) {
return;
}
GetOriginalProfile()->GetPrefs()->SetBoolean(pref, value);
}
-static jint GetBrowsingDataDeletionTimePeriod(
- JNIEnv* env,
- const JavaParamRef<jobject>& obj) {
- return GetPrefService()->GetInteger(browsing_data::prefs::kDeleteTimePeriod);
+static jint GetBrowsingDataDeletionTimePeriod(JNIEnv* env,
+ const JavaParamRef<jobject>& obj,
+ jint pref_type) {
+ return GetPrefService()->GetInteger(
+ browsing_data::GetTimePeriodPreferenceName(ToPrefType(pref_type)));
}
-static void SetBrowsingDataDeletionTimePeriod(
- JNIEnv* env,
- const JavaParamRef<jobject>& obj,
- jint time_period) {
+static void SetBrowsingDataDeletionTimePeriod(JNIEnv* env,
+ const JavaParamRef<jobject>& obj,
+ jint pref_type,
+ jint time_period) {
DCHECK_GE(time_period, 0);
DCHECK_LE(time_period, browsing_data::TIME_PERIOD_LAST);
- GetPrefService()->SetInteger(browsing_data::prefs::kDeleteTimePeriod,
- time_period);
+ GetPrefService()->SetInteger(
+ browsing_data::GetTimePeriodPreferenceName(ToPrefType(pref_type)),
+ time_period);
}
static jint GetLastClearBrowsingDataTab(JNIEnv* env,
@@ -604,6 +618,11 @@ static void SetLastClearBrowsingDataTab(JNIEnv* env,
tab_index);
}
+static void MigrateBrowsingDataPreferences(JNIEnv* env,
+ const JavaParamRef<jobject>& obj) {
+ browsing_data::MigratePreferencesToBasic(GetOriginalProfile()->GetPrefs());
+}
+
static void ClearBrowsingData(
JNIEnv* env,
const JavaParamRef<jobject>& obj,

Powered by Google App Engine
This is Rietveld 408576698