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

Unified Diff: components/browsing_data/core/counters/browsing_data_counter.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: components/browsing_data/core/counters/browsing_data_counter.cc
diff --git a/components/browsing_data/core/counters/browsing_data_counter.cc b/components/browsing_data/core/counters/browsing_data_counter.cc
index ec67193687bca28fc26a48e1a64ae508680f2fe6..8280472b5d4ac08922cc8bb1147d11a892f1c488 100644
--- a/components/browsing_data/core/counters/browsing_data_counter.cc
+++ b/components/browsing_data/core/counters/browsing_data_counter.cc
@@ -18,14 +18,15 @@ BrowsingDataCounter::BrowsingDataCounter() {}
BrowsingDataCounter::~BrowsingDataCounter() {}
void BrowsingDataCounter::Init(PrefService* pref_service,
+ ClearBrowsingDataPreferenceType pref_type,
const Callback& callback) {
DCHECK(!initialized_);
callback_ = callback;
- pref_service_ = pref_service;
- pref_.Init(GetPrefName(), pref_service_,
+ pref_type_ = pref_type;
+ pref_.Init(GetPrefName(), pref_service,
base::Bind(&BrowsingDataCounter::Restart, base::Unretained(this)));
period_.Init(
- browsing_data::prefs::kDeleteTimePeriod, pref_service_,
+ GetTimePeriodPrefName(), pref_service,
base::Bind(&BrowsingDataCounter::Restart, base::Unretained(this)));
initialized_ = true;
@@ -54,8 +55,14 @@ void BrowsingDataCounter::ReportResult(std::unique_ptr<Result> result) {
callback_.Run(std::move(result));
}
-PrefService* BrowsingDataCounter::GetPrefs() const {
- return pref_service_;
+const char* BrowsingDataCounter::GetTimePeriodPrefName() const {
+ return GetPrefType() == ClearBrowsingDataPreferenceType::BASIC
msramek 2017/02/08 10:55:56 This is already defined as browsing_data::GetTimeP
dullweber 2017/02/08 23:03:19 Thanks, I removed this method.
+ ? browsing_data::prefs::kDeleteTimePeriodBasic
+ : browsing_data::prefs::kDeleteTimePeriod;
+}
+
+ClearBrowsingDataPreferenceType BrowsingDataCounter::GetPrefType() const {
+ return pref_type_;
}
// BrowsingDataCounter::Result -------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698