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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // Determines if the hash store has been initialized (contains any values). | 54 // Determines if the hash store has been initialized (contains any values). |
55 virtual bool IsInitialized() const = 0; | 55 virtual bool IsInitialized() const = 0; |
56 | 56 |
57 // Checks |initial_value| against the existing stored value hash. | 57 // Checks |initial_value| against the existing stored value hash. |
58 virtual ValueState CheckValue( | 58 virtual ValueState CheckValue( |
59 const std::string& path, const base::Value* initial_value) const = 0; | 59 const std::string& path, const base::Value* initial_value) const = 0; |
60 | 60 |
61 // Stores a hash of the current |value| of the preference at |path|. | 61 // Stores a hash of the current |value| of the preference at |path|. |
62 virtual void StoreHash(const std::string& path, | 62 virtual void StoreHash(const std::string& path, |
63 const base::Value* value) = 0; | 63 const base::Value* value) = 0; |
| 64 |
| 65 // Checks |initial_value| against the existing stored hashes for the split |
| 66 // preference at |path|. |initial_split_value| being an empty dictionary or |
| 67 // NULL is equivalent. |invalid_keys| must initially be empty. |invalid_keys| |
| 68 // will not be modified unless the return value is CHANGED, in which case it |
| 69 // will be filled with the keys that are considered invalid (unknown or |
| 70 // changed). |
| 71 virtual ValueState CheckSplitValue( |
| 72 const std::string& path, |
| 73 const base::DictionaryValue* initial_split_value, |
| 74 std::vector<std::string>* invalid_keys) const = 0; |
| 75 |
| 76 // Stores hashes for the |value| of the split preference at |path|. |
| 77 // |split_value| being an empty dictionary or NULL is equivalent. |
| 78 virtual void StoreSplitHash( |
| 79 const std::string& path, |
| 80 const base::DictionaryValue* split_value) = 0; |
64 }; | 81 }; |
65 | 82 |
66 #endif // CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_ | 83 #endif // CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_ |
OLD | NEW |