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

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: Gab's nits. Created 6 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/prefs/pref_hash_filter.cc
diff --git a/chrome/browser/prefs/pref_hash_filter.cc b/chrome/browser/prefs/pref_hash_filter.cc
index 1935708f9e22ca39964f2580d8dd402d1d39d9b9..a40b28a0e6dbd3e34c372b511f924a50fce767dc 100644
--- a/chrome/browser/prefs/pref_hash_filter.cc
+++ b/chrome/browser/prefs/pref_hash_filter.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/prefs/pref_hash_filter.h"
+#include "base/callback.h"
gab 2014/02/10 04:02:21 Don't include this; already included in header.
robertshield 2014/02/10 13:56:15 Done.
#include "base/logging.h"
#include "base/metrics/histogram.h"
#include "base/prefs/pref_store.h"
@@ -17,7 +18,8 @@ PrefHashFilter::PrefHashFilter(
const TrackedPreferenceMetadata tracked_preferences[],
size_t tracked_preferences_size,
size_t reporting_ids_count,
- EnforcementLevel enforcement_level) {
+ EnforcementLevel enforcement_level,
+ const base::Closure& reset_callback) : reset_callback_(reset_callback) {
DCHECK(pref_hash_store);
DCHECK_GE(reporting_ids_count, tracked_preferences_size);
@@ -82,10 +84,16 @@ void PrefHashFilter::Initialize(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;
for (TrackedPreferencesMap::const_iterator it = tracked_paths_.begin();
it != tracked_paths_.end(); ++it) {
- it->second->EnforceAndReport(pref_store_contents);
+ if (it->second->EnforceAndReport(pref_store_contents))
+ 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.

Powered by Google App Engine
This is Rietveld 408576698