| OLD | NEW |
| 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 namespace base { | 12 namespace base { |
| 13 class DictionaryValue; | 13 class DictionaryValue; |
| 14 class Value; | 14 class Value; |
| 15 } // namespace base | 15 } // namespace base |
| 16 | 16 |
| 17 enum class HashStoreContentsType : int32_t { |
| 18 DICTIONARY_HASH_STORE_CONTENTS = 1, |
| 19 REGISTRY_HASH_STORE_CONTENTS = 2 |
| 20 }; |
| 21 |
| 17 // Provides access to the contents of a preference hash store. The store | 22 // Provides access to the contents of a preference hash store. The store |
| 18 // contains the following data: | 23 // contains the following data: |
| 19 // Contents: a client-defined dictionary that should map preference names to | 24 // Contents: a client-defined dictionary that should map preference names to |
| 20 // MACs. | 25 // MACs. |
| 21 // Version: a client-defined version number for the format of Contents. | 26 // Version: a client-defined version number for the format of Contents. |
| 22 // Super MAC: a MAC that authenticates the entirety of Contents. | 27 // Super MAC: a MAC that authenticates the entirety of Contents. |
| 23 class HashStoreContents { | 28 class HashStoreContents { |
| 24 public: | 29 public: |
| 25 virtual ~HashStoreContents() {} | 30 virtual ~HashStoreContents() {} |
| 26 | 31 |
| 32 // Returns the type of the HashStoreContents. |
| 33 virtual HashStoreContentsType GetType() const = 0; |
| 34 |
| 27 // Discards all data related to this hash store. | 35 // Discards all data related to this hash store. |
| 28 virtual void Reset() = 0; | 36 virtual void Reset() = 0; |
| 29 | 37 |
| 30 // Outputs the MAC validating the preference at path. Returns true if a MAC | 38 // Outputs the MAC validating the preference at path. Returns true if a MAC |
| 31 // was successfully read and false otherwise. | 39 // was successfully read and false otherwise. |
| 32 virtual bool GetMac(const std::string& path, std::string* out_value) = 0; | 40 virtual bool GetMac(const std::string& path, std::string* out_value) = 0; |
| 33 | 41 |
| 34 // Outputs the MACS validating the split preference at path. Returns true if | 42 // Outputs the MACS validating the split preference at path. Returns true if |
| 35 // MACS were successfully read and false otherwise. | 43 // MACS were successfully read and false otherwise. |
| 36 virtual bool GetSplitMacs(const std::string& path, | 44 virtual bool GetSplitMacs(const std::string& path, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 65 // Retrieves the super MAC value previously stored by SetSuperMac. May be | 73 // Retrieves the super MAC value previously stored by SetSuperMac. May be |
| 66 // empty if no super MAC has been stored or if this store does not support | 74 // empty if no super MAC has been stored or if this store does not support |
| 67 // super MACs. | 75 // super MACs. |
| 68 virtual std::string GetSuperMac() const = 0; | 76 virtual std::string GetSuperMac() const = 0; |
| 69 | 77 |
| 70 // Stores a super MAC value for this hash store. | 78 // Stores a super MAC value for this hash store. |
| 71 virtual void SetSuperMac(const std::string& super_mac) = 0; | 79 virtual void SetSuperMac(const std::string& super_mac) = 0; |
| 72 }; | 80 }; |
| 73 | 81 |
| 74 #endif // COMPONENTS_USER_PREFS_TRACKED_HASH_STORE_CONTENTS_H_ | 82 #endif // COMPONENTS_USER_PREFS_TRACKED_HASH_STORE_CONTENTS_H_ |
| OLD | NEW |