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() {} | |
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
| |
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 | |
gab
2013/12/06 17:23:38
nit: add trailing comma
erikwright (departed)
2013/12/09 17:59:40
Done.
| |
38 }; | |
39 | |
40 // Checks |initial_value| against the existing stored value hash. | |
41 virtual ValueState CheckValue( | |
42 const std::string& path, const base::Value* initial_value) = 0; | |
43 | |
44 // Stores the current value of the preference at |path|. | |
45 virtual void StoreValue(const std::string& path, | |
46 const base::Value* value) = 0; | |
47 }; | |
48 | |
49 #endif // CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_ | |
OLD | NEW |