OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_PREFS_TRACKED_PREF_HASH_STORE_H_ | |
6 #define COMPONENTS_PREFS_TRACKED_PREF_HASH_STORE_H_ | |
7 | |
8 #include <memory> | |
9 #include <string> | |
10 | |
11 #include "base/values.h" | |
12 #include "components/user_prefs/tracked/pref_hash_store_transaction.h" | |
13 | |
14 class HashStoreContents; | |
15 class PrefHashStoreTransaction; | |
16 | |
17 // Holds the configuration and implementation used to calculate and verify | |
18 // preference MACs. | |
19 // TODO(gab): Rename this class as it is no longer a store. | |
20 class PrefHashStore { | |
21 public: | |
22 virtual ~PrefHashStore() {} | |
23 | |
24 // Returns a PrefHashStoreTransaction which can be used to perform a series | |
25 // of operations on the hash store. |storage| MAY be used as the backing store | |
26 // depending on the implementation. Therefore the HashStoreContents used for | |
27 // related transactions should correspond to the same underlying data store. | |
28 // |storage| must outlive the returned transaction. | |
29 virtual std::unique_ptr<PrefHashStoreTransaction> BeginTransaction( | |
30 HashStoreContents* storage) = 0; | |
31 | |
32 // Computes the MAC to be associated with |path| and |value| in this store. | |
33 // PrefHashStoreTransaction typically uses this internally but it's also | |
34 // exposed for users that want to compute MACs ahead of time for asynchronous | |
35 // operations. | |
36 virtual std::string ComputeMac(const std::string& path, | |
37 const base::Value* value) = 0; | |
38 | |
39 // Computes the MAC to be associated with |path| and |split_values| in this | |
40 // store. PrefHashStoreTransaction typically uses this internally but it's | |
41 // also exposed for users that want to compute MACs ahead of time for | |
42 // asynchronous operations. | |
43 virtual std::unique_ptr<base::DictionaryValue> ComputeSplitMacs( | |
44 const std::string& path, | |
45 const base::DictionaryValue* split_values) = 0; | |
46 }; | |
47 | |
48 #endif // COMPONENTS_PREFS_TRACKED_PREF_HASH_STORE_H_ | |
OLD | NEW |