| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_TRANSACTION_H_ | 5 #ifndef COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_TRANSACTION_H_ |
| 6 #define COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_TRANSACTION_H_ | 6 #define COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_TRANSACTION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 enum class HashStoreContentsType : int32_t; |
| 12 |
| 11 namespace base { | 13 namespace base { |
| 12 class DictionaryValue; | 14 class DictionaryValue; |
| 13 class Value; | 15 class Value; |
| 14 } // namespace base | 16 } // namespace base |
| 15 | 17 |
| 16 // Used to perform a series of checks/transformations on a PrefHashStore. | 18 // Used to perform a series of checks/transformations on a PrefHashStore. |
| 17 class PrefHashStoreTransaction { | 19 class PrefHashStoreTransaction { |
| 18 public: | 20 public: |
| 19 enum ValueState { | 21 enum ValueState { |
| 20 // The preference value corresponds to its stored hash. | 22 // The preference value corresponds to its stored hash. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 34 // happens when all hashes are already properly seeded and a newly | 36 // happens when all hashes are already properly seeded and a newly |
| 35 // tracked value needs to be seeded). | 37 // tracked value needs to be seeded). |
| 36 TRUSTED_UNKNOWN_VALUE, | 38 TRUSTED_UNKNOWN_VALUE, |
| 37 // NULL values are inherently trusted. | 39 // NULL values are inherently trusted. |
| 38 TRUSTED_NULL_VALUE, | 40 TRUSTED_NULL_VALUE, |
| 39 }; | 41 }; |
| 40 | 42 |
| 41 // Finalizes any remaining work after the transaction has been performed. | 43 // Finalizes any remaining work after the transaction has been performed. |
| 42 virtual ~PrefHashStoreTransaction() {} | 44 virtual ~PrefHashStoreTransaction() {} |
| 43 | 45 |
| 46 // Returns the type of the store contained in this transaction. |
| 47 virtual std::string GetStoreUMASuffix() const = 0; |
| 48 |
| 44 // Checks |initial_value| against the existing stored value hash. | 49 // Checks |initial_value| against the existing stored value hash. |
| 45 virtual ValueState CheckValue(const std::string& path, | 50 virtual ValueState CheckValue(const std::string& path, |
| 46 const base::Value* initial_value) const = 0; | 51 const base::Value* initial_value) const = 0; |
| 47 | 52 |
| 48 // Stores a hash of the current |value| of the preference at |path|. | 53 // Stores a hash of the current |value| of the preference at |path|. |
| 49 virtual void StoreHash(const std::string& path, const base::Value* value) = 0; | 54 virtual void StoreHash(const std::string& path, const base::Value* value) = 0; |
| 50 | 55 |
| 51 // Checks |initial_value| against the existing stored hashes for the split | 56 // Checks |initial_value| against the existing stored hashes for the split |
| 52 // preference at |path|. |initial_split_value| being an empty dictionary or | 57 // preference at |path|. |initial_split_value| being an empty dictionary or |
| 53 // NULL is equivalent. |invalid_keys| must initially be empty. |invalid_keys| | 58 // NULL is equivalent. |invalid_keys| must initially be empty. |invalid_keys| |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // Indicates whether the super MAC was successfully verified at the beginning | 90 // Indicates whether the super MAC was successfully verified at the beginning |
| 86 // of this transaction. | 91 // of this transaction. |
| 87 virtual bool IsSuperMACValid() const = 0; | 92 virtual bool IsSuperMACValid() const = 0; |
| 88 | 93 |
| 89 // Forces a valid super MAC to be stored when this transaction terminates. | 94 // Forces a valid super MAC to be stored when this transaction terminates. |
| 90 // Returns true if this results in a change to the store contents. | 95 // Returns true if this results in a change to the store contents. |
| 91 virtual bool StampSuperMac() = 0; | 96 virtual bool StampSuperMac() = 0; |
| 92 }; | 97 }; |
| 93 | 98 |
| 94 #endif // COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_TRANSACTION_H_ | 99 #endif // COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_TRANSACTION_H_ |
| OLD | NEW |