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 |
(...skipping 23 matching lines...) Expand all Loading... |
34 // |seed| and |device_id| and stores them in |contents|. | 34 // |seed| and |device_id| and stores them in |contents|. |
35 // | 35 // |
36 // The same |seed| and |device_id| must be used to load and validate | 36 // The same |seed| and |device_id| must be used to load and validate |
37 // previously stored hashes in |contents|. | 37 // previously stored hashes in |contents|. |
38 PrefHashStoreImpl(const std::string& seed, | 38 PrefHashStoreImpl(const std::string& seed, |
39 const std::string& device_id, | 39 const std::string& device_id, |
40 bool use_super_mac); | 40 bool use_super_mac); |
41 | 41 |
42 ~PrefHashStoreImpl() override; | 42 ~PrefHashStoreImpl() override; |
43 | 43 |
44 // Provides an external HashStoreContents implementation to be used. | |
45 // BeginTransaction() will ignore |storage| if this is provided. | |
46 void set_legacy_hash_store_contents( | |
47 std::unique_ptr<HashStoreContents> legacy_hash_store_contents); | |
48 | |
49 // Clears the contents of this PrefHashStore. |IsInitialized()| will return | 44 // Clears the contents of this PrefHashStore. |IsInitialized()| will return |
50 // false after this call. | 45 // false after this call. |
51 void Reset(); | 46 void Reset(); |
52 | 47 |
53 // PrefHashStore implementation. | 48 // PrefHashStore implementation. |
54 std::unique_ptr<PrefHashStoreTransaction> BeginTransaction( | 49 std::unique_ptr<PrefHashStoreTransaction> BeginTransaction( |
55 std::unique_ptr<HashStoreContents> storage) override; | 50 std::unique_ptr<HashStoreContents> storage) override; |
56 | 51 |
57 private: | 52 private: |
58 class PrefHashStoreTransactionImpl; | 53 class PrefHashStoreTransactionImpl; |
59 | 54 |
60 const PrefHashCalculator pref_hash_calculator_; | 55 const PrefHashCalculator pref_hash_calculator_; |
61 std::unique_ptr<HashStoreContents> legacy_hash_store_contents_; | |
62 bool use_super_mac_; | 56 bool use_super_mac_; |
63 | 57 |
64 DISALLOW_COPY_AND_ASSIGN(PrefHashStoreImpl); | 58 DISALLOW_COPY_AND_ASSIGN(PrefHashStoreImpl); |
65 }; | 59 }; |
66 | 60 |
67 #endif // COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_IMPL_H_ | 61 #endif // COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_IMPL_H_ |
OLD | NEW |