OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_ | 5 #ifndef CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_ |
6 #define CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_ | 6 #define CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 #include <vector> |
10 #include "base/memory/scoped_ptr.h" | |
11 | 10 |
12 namespace base { | 11 namespace base { |
| 12 class DictionaryValue; |
13 class Value; | 13 class Value; |
14 } // namespace base | 14 } // namespace base |
15 | 15 |
16 namespace internals { | 16 namespace internals { |
17 | 17 |
18 // Hash of hashes for each profile, used to validate the existing hashes when | 18 // Hash of hashes for each profile, used to validate the existing hashes when |
19 // debating whether an unknown value is to be trusted, will be stored as a | 19 // debating whether an unknown value is to be trusted, will be stored as a |
20 // string under | 20 // string under |
21 // |kProfilePreferenceHashes|.|kHashOfHashesPref|.|hash_stored_id_|. | 21 // |kProfilePreferenceHashes|.|kHashOfHashesPref|.|hash_stored_id_|. |
22 const char kHashOfHashesPref[] = "hash_of_hashes"; | 22 const char kHashOfHashesPref[] = "hash_of_hashes"; |
(...skipping 28 matching lines...) Expand all Loading... |
51 TRUSTED_UNKNOWN_VALUE, | 51 TRUSTED_UNKNOWN_VALUE, |
52 }; | 52 }; |
53 | 53 |
54 // Checks |initial_value| against the existing stored value hash. | 54 // Checks |initial_value| against the existing stored value hash. |
55 virtual ValueState CheckValue( | 55 virtual ValueState CheckValue( |
56 const std::string& path, const base::Value* initial_value) const = 0; | 56 const std::string& path, const base::Value* initial_value) const = 0; |
57 | 57 |
58 // Stores a hash of the current |value| of the preference at |path|. | 58 // Stores a hash of the current |value| of the preference at |path|. |
59 virtual void StoreHash(const std::string& path, | 59 virtual void StoreHash(const std::string& path, |
60 const base::Value* value) = 0; | 60 const base::Value* value) = 0; |
| 61 |
| 62 // Checks |initial_value| against the existing stored hashes for the split |
| 63 // preference at |path|. |initial_split_value| being an empty dictionary or |
| 64 // NULL is equivalent. |invalid_keys| must initially be empty. |invalid_keys| |
| 65 // will not be mofified unless the return value is CHANGED, in which case it |
| 66 // will be filled with the keys that are considered invalid (unknown or |
| 67 // changed). |
| 68 virtual ValueState CheckSplitValue( |
| 69 const std::string& path, |
| 70 const base::DictionaryValue* initial_split_value, |
| 71 std::vector<std::string>* invalid_keys) const = 0; |
| 72 |
| 73 // Stores hashes for the |value| of the split preference at |path|. |
| 74 // |split_value| being an empty dictionary or NULL is equivalent. |
| 75 virtual void StoreSplitHash( |
| 76 const std::string& path, |
| 77 const base::DictionaryValue* split_value) = 0; |
61 }; | 78 }; |
62 | 79 |
63 #endif // CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_ | 80 #endif // CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_ |
OLD | NEW |