Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: components/user_prefs/tracked/pref_hash_store.h

Issue 2304573002: Add ComputeMac and ComputeSplitMacs methods to pref_hash_store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove stray line break Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_PREFS_TRACKED_PREF_HASH_STORE_H_ 5 #ifndef COMPONENTS_PREFS_TRACKED_PREF_HASH_STORE_H_
6 #define COMPONENTS_PREFS_TRACKED_PREF_HASH_STORE_H_ 6 #define COMPONENTS_PREFS_TRACKED_PREF_HASH_STORE_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/values.h"
gab 2016/09/01 21:21:56 fwd-decl instead: namespace base { class Dictiona
proberge 2016/09/06 18:43:38 Done. This whole include vs fwd-decl is still very
gab 2016/09/06 20:08:04 The concept is known as IWUY (include-what-you-use
11
10 class HashStoreContents; 12 class HashStoreContents;
11 class PrefHashStoreTransaction; 13 class PrefHashStoreTransaction;
12 14
13 // Holds the configuration and implementation used to calculate and verify 15 // Holds the configuration and implementation used to calculate and verify
14 // preference MACs. 16 // preference MACs.
15 // TODO(gab): Rename this class as it is no longer a store. 17 // TODO(gab): Rename this class as it is no longer a store.
16 class PrefHashStore { 18 class PrefHashStore {
17 public: 19 public:
18 virtual ~PrefHashStore() {} 20 virtual ~PrefHashStore() {}
19 21
20 // Returns a PrefHashStoreTransaction which can be used to perform a series 22 // Returns a PrefHashStoreTransaction which can be used to perform a series
21 // of operations on the hash store. |storage| MAY be used as the backing store 23 // of operations on the hash store. |storage| MAY be used as the backing store
22 // depending on the implementation. Therefore the HashStoreContents used for 24 // depending on the implementation. Therefore the HashStoreContents used for
23 // related transactions should correspond to the same underlying data store. 25 // related transactions should correspond to the same underlying data store.
24 virtual std::unique_ptr<PrefHashStoreTransaction> BeginTransaction( 26 virtual std::unique_ptr<PrefHashStoreTransaction> BeginTransaction(
25 std::unique_ptr<HashStoreContents> storage) = 0; 27 std::unique_ptr<HashStoreContents> storage) = 0;
28
29 // Computes the MAC to be associated with |path| and |value| in this store.
30 // PrefHashStoreTransaction typically uses this internally but it's also
31 // exposed for users that want to compute MACs ahead of time for asynchronous
32 // operations.
33 virtual std::string ComputeMac(const std::string& path,
gab 2016/09/01 21:21:56 #include <string> (can't fwd-decl lib types)
proberge 2016/09/06 18:43:39 Done.
34 const base::Value* value) = 0;
35
36 // Computes the MAC to be associated with |path| and |split_values| in this
37 // store. PrefHashStoreTransaction typically uses this internally but it's
38 // also exposed for users that want to compute MACs ahead of time for
39 // asynchronous operations.
40 virtual std::unique_ptr<base::DictionaryValue> ComputeSplitMacs(
gab 2016/09/06 20:08:04 Also, based on above discussion I just realized th
proberge 2016/09/07 18:00:56 Done.
41 const std::string& path,
42 const base::DictionaryValue* split_values) = 0;
26 }; 43 };
27 44
28 #endif // COMPONENTS_PREFS_TRACKED_PREF_HASH_STORE_H_ 45 #endif // COMPONENTS_PREFS_TRACKED_PREF_HASH_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698