| 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 COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_IMPL_H_ | 5 #ifndef COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_IMPL_H_ |
| 6 #define COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_IMPL_H_ | 6 #define COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "components/user_prefs/tracked/pref_hash_calculator.h" | 13 #include "components/user_prefs/tracked/pref_hash_calculator.h" |
| 14 #include "components/user_prefs/tracked/pref_hash_store.h" | 14 #include "components/user_prefs/tracked/pref_hash_store.h" |
| 15 | 15 |
| 16 class HashStoreContents; | 16 class HashStoreContents; |
| 17 class PrefHashStoreTransaction; | 17 class PrefHashStoreTransaction; |
| 18 | 18 |
| 19 namespace base { |
| 20 class DictionaryValue; |
| 21 class Value; |
| 22 } // namespace base |
| 23 |
| 19 // Implements PrefHashStoreImpl by storing preference hashes in a | 24 // Implements PrefHashStoreImpl by storing preference hashes in a |
| 20 // HashStoreContents. | 25 // HashStoreContents. |
| 21 class PrefHashStoreImpl : public PrefHashStore { | 26 class PrefHashStoreImpl : public PrefHashStore { |
| 22 public: | 27 public: |
| 23 enum StoreVersion { | 28 enum StoreVersion { |
| 24 // No hashes have been stored in this PrefHashStore yet. | 29 // No hashes have been stored in this PrefHashStore yet. |
| 25 VERSION_UNINITIALIZED = 0, | 30 VERSION_UNINITIALIZED = 0, |
| 26 // The hashes in this PrefHashStore were stored before the introduction | 31 // The hashes in this PrefHashStore were stored before the introduction |
| 27 // of a version number and should be re-initialized. | 32 // of a version number and should be re-initialized. |
| 28 VERSION_PRE_MIGRATION = 1, | 33 VERSION_PRE_MIGRATION = 1, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 40 bool use_super_mac); | 45 bool use_super_mac); |
| 41 | 46 |
| 42 ~PrefHashStoreImpl() override; | 47 ~PrefHashStoreImpl() override; |
| 43 | 48 |
| 44 // Clears the contents of this PrefHashStore. |IsInitialized()| will return | 49 // Clears the contents of this PrefHashStore. |IsInitialized()| will return |
| 45 // false after this call. | 50 // false after this call. |
| 46 void Reset(); | 51 void Reset(); |
| 47 | 52 |
| 48 // PrefHashStore implementation. | 53 // PrefHashStore implementation. |
| 49 std::unique_ptr<PrefHashStoreTransaction> BeginTransaction( | 54 std::unique_ptr<PrefHashStoreTransaction> BeginTransaction( |
| 50 std::unique_ptr<HashStoreContents> storage) override; | 55 HashStoreContents* storage) override; |
| 56 |
| 57 std::string ComputeMac(const std::string& path, |
| 58 const base::Value* new_value) override; |
| 59 |
| 60 std::unique_ptr<base::DictionaryValue> ComputeSplitMacs( |
| 61 const std::string& path, |
| 62 const base::DictionaryValue* split_values) override; |
| 51 | 63 |
| 52 private: | 64 private: |
| 53 class PrefHashStoreTransactionImpl; | 65 class PrefHashStoreTransactionImpl; |
| 54 | 66 |
| 55 const PrefHashCalculator pref_hash_calculator_; | 67 const PrefHashCalculator pref_hash_calculator_; |
| 56 bool use_super_mac_; | 68 bool use_super_mac_; |
| 57 | 69 |
| 58 DISALLOW_COPY_AND_ASSIGN(PrefHashStoreImpl); | 70 DISALLOW_COPY_AND_ASSIGN(PrefHashStoreImpl); |
| 59 }; | 71 }; |
| 60 | 72 |
| 61 #endif // COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_IMPL_H_ | 73 #endif // COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_IMPL_H_ |
| OLD | NEW |