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

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

Issue 2204943002: Integrate registry_hash_store_contents with the rest of tracked prefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased and added important_file_writer CL as dependent patchset 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 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_HASH_STORE_CONTENTS_H_ 5 #ifndef COMPONENTS_USER_PREFS_TRACKED_HASH_STORE_CONTENTS_H_
6 #define COMPONENTS_USER_PREFS_TRACKED_HASH_STORE_CONTENTS_H_ 6 #define COMPONENTS_USER_PREFS_TRACKED_HASH_STORE_CONTENTS_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 11
12 #include "base/strings/string_piece.h" 12 #include "base/strings/string_piece.h"
13 13
14 namespace base { 14 namespace base {
15 class DictionaryValue; 15 class DictionaryValue;
16 class Value; 16 class Value;
17 } // namespace base 17 } // namespace base
18 18
19 // Provides access to the contents of a preference hash store. The store 19 // Provides access to the contents of a preference hash store. The store
20 // contains the following data: 20 // contains the following data:
21 // Contents: a client-defined dictionary that should map preference names to 21 // Contents: a client-defined dictionary that should map preference names to
22 // MACs. 22 // MACs.
23 // Version: a client-defined version number for the format of Contents. 23 // Version: a client-defined version number for the format of Contents.
24 // Super MAC: a MAC that authenticates the entirety of Contents. 24 // Super MAC: a MAC that authenticates the entirety of Contents.
25 class HashStoreContents { 25 class HashStoreContents {
26 public: 26 public:
27 virtual ~HashStoreContents() {} 27 virtual ~HashStoreContents() {}
28 28
29 // Returns true if this implementation of HashStoreContents can be copied via
30 // MakeCopy().
31 virtual bool IsCopyable() const = 0;
32
33 // Returns a copy of this HashStoreContents. Must only be called on
34 // lightweight implementations(which return true from IsCopyable()) and only
gab 2016/09/16 19:47:32 Space between word and '('
proberge 2016/09/20 21:35:44 Done.
35 // in scenarios where a copy cannot be avoided.
36 virtual std::unique_ptr<HashStoreContents> MakeCopy() const = 0;
37
29 // Returns the suffix to be appended to UMA histograms for this store type. 38 // Returns the suffix to be appended to UMA histograms for this store type.
30 // The returned value must either be an empty string or one of the values in 39 // The returned value must either be an empty string or one of the values in
31 // histograms.xml's TrackedPreferencesExternalValidators. 40 // histograms.xml's TrackedPreferencesExternalValidators.
32 virtual base::StringPiece GetUMASuffix() const = 0; 41 virtual base::StringPiece GetUMASuffix() const = 0;
33 42
34 // Discards all data related to this hash store. 43 // Discards all data related to this hash store.
35 virtual void Reset() = 0; 44 virtual void Reset() = 0;
36 45
37 // Outputs the MAC validating the preference at path. Returns true if a MAC 46 // Outputs the MAC validating the preference at path. Returns true if a MAC
38 // was successfully read and false otherwise. 47 // was successfully read and false otherwise.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // Retrieves the super MAC value previously stored by SetSuperMac. May be 81 // Retrieves the super MAC value previously stored by SetSuperMac. May be
73 // empty if no super MAC has been stored or if this store does not support 82 // empty if no super MAC has been stored or if this store does not support
74 // super MACs. 83 // super MACs.
75 virtual std::string GetSuperMac() const = 0; 84 virtual std::string GetSuperMac() const = 0;
76 85
77 // Stores a super MAC value for this hash store. 86 // Stores a super MAC value for this hash store.
78 virtual void SetSuperMac(const std::string& super_mac) = 0; 87 virtual void SetSuperMac(const std::string& super_mac) = 0;
79 }; 88 };
80 89
81 #endif // COMPONENTS_USER_PREFS_TRACKED_HASH_STORE_CONTENTS_H_ 90 #endif // COMPONENTS_USER_PREFS_TRACKED_HASH_STORE_CONTENTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698