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..98403edc19dc80f69d71f49cedd0570b108014ad 100644 |
--- a/chrome/browser/prefs/pref_hash_filter.cc |
+++ b/chrome/browser/prefs/pref_hash_filter.cc |
@@ -6,11 +6,15 @@ |
#include "base/logging.h" |
#include "base/metrics/histogram.h" |
+#include "base/prefs/pref_registry_simple.h" |
+#include "base/prefs/pref_service.h" |
#include "base/prefs/pref_store.h" |
#include "base/time/time.h" |
#include "base/values.h" |
+#include "chrome/browser/browser_process.h" |
#include "chrome/browser/prefs/tracked/tracked_atomic_preference.h" |
#include "chrome/browser/prefs/tracked/tracked_split_preference.h" |
+#include "chrome/common/pref_names.h" |
PrefHashFilter::PrefHashFilter( |
scoped_ptr<PrefHashStore> pref_hash_store, |
@@ -63,6 +67,12 @@ PrefHashFilter::~PrefHashFilter() { |
DCHECK(changed_paths_.empty()); |
} |
+void PrefHashFilter::RegisterPrefs(PrefRegistrySimple* registry) { |
+ // Register the pref that maintains state about the last time a reset event |
+ // occurred. Used to decide whether to show UI. |
+ registry->RegisterInt64Pref(prefs::kProfilePreferenceResetTime, 0L); |
+} |
+ |
void PrefHashFilter::Initialize(PrefStore* pref_store) { |
UMA_HISTOGRAM_BOOLEAN( |
"Settings.TrackedPreferencesInitializedForUnloadedProfile", true); |
@@ -82,10 +92,15 @@ 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); |
+ did_reset = it->second->EnforceAndReport(pref_store_contents) || did_reset; |
gab
2014/02/06 20:40:11
I prefer
if (it->second->EnforceAndReport(pref_st
robertshield
2014/02/07 04:36:19
Done.
|
} |
+ |
+ if (did_reset) |
+ WriteResetEvent(); |
+ |
// 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. |
@@ -124,3 +139,9 @@ void PrefHashFilter::FilterSerializeData( |
base::TimeTicks::Now() - checkpoint); |
} |
} |
+ |
+void PrefHashFilter::WriteResetEvent() { |
+ g_browser_process->local_state()->SetInt64( |
+ prefs::kProfilePreferenceResetTime, |
+ base::Time::Now().ToInternalValue()); |
+} |