Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_ | |
| 6 #define CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 | |
| 12 class PrefHashTracker; | |
| 13 | |
| 14 namespace base { | |
| 15 class Value; | |
| 16 } // namespace base | |
| 17 | |
| 18 // Stores hashes of and verifies preference values. To use, first call | |
| 19 // |InitializeTrackedValue| with each preference that should be tracked. Then | |
| 20 // call |OnPrefValueChanged| to update the hash store when preference values | |
| 21 // change. | |
| 22 class PrefHashStore { | |
| 23 public: | |
| 24 virtual ~PrefHashStore() {} | |
| 25 | |
| 26 enum ValueState { | |
| 27 // The preference value corresponds to its stored hash. | |
| 28 UNCHANGED, | |
| 29 // The preference has been cleared since the last hash. | |
| 30 CLEARED, | |
| 31 // The preference value corresponds to its stored hash, which was calculated | |
| 32 // using a legacy hash algorithm. | |
| 33 MIGRATED, | |
| 34 // The preference value has been changed since the last hash. | |
| 35 CHANGED, | |
| 36 // No stored hash exists for the preference value. | |
| 37 UNKNOWN_VALUE, | |
| 38 }; | |
| 39 | |
| 40 // Checks |initial_value| against the existing stored value hash. | |
|
gab
2013/12/13 16:54:25
nit: Add mention of |path| in above comment.
| |
| 41 virtual ValueState CheckValue( | |
|
gab
2013/12/13 16:54:25
How about "CheckHash" here too:
1) To be consisten
| |
| 42 const std::string& path, const base::Value* initial_value) const = 0; | |
| 43 | |
| 44 // Stores a hash of the current value of the preference at |path|. | |
| 45 virtual void StoreHash(const std::string& path, | |
| 46 const base::Value* value) = 0; | |
| 47 }; | |
| 48 | |
| 49 #endif // CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_ | |
| OLD | NEW |