Index: chrome/browser/prefs/pref_hash_store.h |
diff --git a/chrome/browser/prefs/pref_hash_store.h b/chrome/browser/prefs/pref_hash_store.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..124f15087fdc4d7e7907e794a44571ebdbbaa613 |
--- /dev/null |
+++ b/chrome/browser/prefs/pref_hash_store.h |
@@ -0,0 +1,49 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_ |
+#define CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_ |
+ |
+#include <string> |
+ |
+#include "base/memory/scoped_ptr.h" |
+ |
+class PrefHashTracker; |
+ |
+namespace base { |
+class Value; |
+} // namespace base |
+ |
+// Stores hashes of and verifies preference values. To use, first call |
+// |InitializeTrackedValue| with each preference that should be tracked. Then |
+// call |OnPrefValueChanged| to update the hash store when preference values |
+// change. |
+class PrefHashStore { |
+ public: |
+ virtual ~PrefHashStore() {} |
gab
2013/12/06 17:23:38
I forget the C++ details, can you justify why it's
erikwright (departed)
2013/12/06 19:00:47
All classes in the class hierarchy must have destr
|
+ |
+ enum ValueState { |
+ // The preference value corresponds to its stored hash. |
+ UNCHANGED, |
+ // The preference has been cleared since the last hash. |
+ CLEARED, |
+ // The preference value corresponds to its stored hash, which was calculated |
+ // using a legacy hash algorithm. |
+ MIGRATED, |
+ // The preference value has been changed since the last hash. |
+ CHANGED, |
+ // No stored hash exists for the preference value. |
+ UNKNOWN_VALUE |
gab
2013/12/06 17:23:38
nit: add trailing comma
erikwright (departed)
2013/12/09 17:59:40
Done.
|
+ }; |
+ |
+ // Checks |initial_value| against the existing stored value hash. |
+ virtual ValueState CheckValue( |
+ const std::string& path, const base::Value* initial_value) = 0; |
+ |
+ // Stores the current value of the preference at |path|. |
+ virtual void StoreValue(const std::string& path, |
+ const base::Value* value) = 0; |
+}; |
+ |
+#endif // CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_ |