Chromium Code Reviews

Unified Diff: chrome/browser/prefs/pref_hash_filter.cc

Issue 151003004: Add an automatic settings reset banner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase on top of transaction patch. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « chrome/browser/prefs/pref_hash_filter.h ('k') | chrome/browser/prefs/pref_hash_filter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/pref_hash_filter.cc
diff --git a/chrome/browser/prefs/pref_hash_filter.cc b/chrome/browser/prefs/pref_hash_filter.cc
index 5a2dc7c8410c4f0294c28fcf002cc67382e8e964..36392ce05e929a467ecd06502d7df3fd213289e7 100644
--- a/chrome/browser/prefs/pref_hash_filter.cc
+++ b/chrome/browser/prefs/pref_hash_filter.cc
@@ -20,8 +20,10 @@ PrefHashFilter::PrefHashFilter(
const TrackedPreferenceMetadata tracked_preferences[],
size_t tracked_preferences_size,
size_t reporting_ids_count,
- EnforcementLevel enforcement_level) :
- pref_hash_store_(pref_hash_store.Pass()) {
+ EnforcementLevel enforcement_level,
+ const base::Closure& reset_callback)
+ : pref_hash_store_(pref_hash_store.Pass()),
+ reset_callback_(reset_callback) {
DCHECK(pref_hash_store_);
DCHECK_GE(reporting_ids_count, tracked_preferences_size);
@@ -78,15 +80,23 @@ void PrefHashFilter::Initialize(const PrefStore& pref_store) {
void PrefHashFilter::FilterOnLoad(base::DictionaryValue* pref_store_contents) {
DCHECK(pref_store_contents);
base::TimeTicks checkpoint = base::TimeTicks::Now();
+
+ bool did_reset = false;
{
scoped_ptr<PrefHashStoreTransaction> hash_store_transaction(
pref_hash_store_->BeginTransaction());
for (TrackedPreferencesMap::const_iterator it = tracked_paths_.begin();
it != tracked_paths_.end(); ++it) {
- it->second->EnforceAndReport(pref_store_contents,
- hash_store_transaction.get());
+ if (it->second->EnforceAndReport(pref_store_contents,
+ hash_store_transaction.get())) {
+ did_reset = true;
+ }
}
}
+
+ if (did_reset)
+ reset_callback_.Run();
+
// TODO(gab): Remove this histogram by Feb 21 2014; after sufficient timing
// data has been gathered from the wild to be confident this doesn't
// significantly affect startup.
« no previous file with comments | « chrome/browser/prefs/pref_hash_filter.h ('k') | chrome/browser/prefs/pref_hash_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine