#ifndef SERVICES_PREFERENCES_TRACKED_PREF_HASH_STORE_IMPL_H_
#define SERVICES_PREFERENCES_TRACKED_PREF_HASH_STORE_IMPL_H_
#include "base/compiler_specific.h"
#include "base/values.h"
#include "services/preferences/tracked/pref_hash_calculator.h"
#include "services/preferences/tracked/pref_hash_store.h"
class PrefHashStoreImpl : public PrefHashStore {
public:
enum StoreVersion {
VERSION_UNINITIALIZED = 0,
VERSION_PRE_MIGRATION = 1,
VERSION_LATEST = 2,
};
using PrefHashStore::BeginTransaction;
PrefHashStoreImpl(const std::string& seed,
bool use_super_mac);
PrefHashStoreImpl(const PrefHashStoreImpl&) = delete;
PrefHashStoreImpl& operator=(const PrefHashStoreImpl&) = delete;
~PrefHashStoreImpl() override;
void Reset();
std::unique_ptr<PrefHashStoreTransaction> BeginTransaction(
HashStoreContents* storage,
const os_crypt_async::Encryptor* encryptor) override;
std::string ComputeMac(const std::string& path,
const base::Value* new_value) override;
base::Value::Dict ComputeSplitMacs(
const std::string& path,
const base::Value::Dict* split_values) override;
std::string ComputeEncryptedHash(
const std::string& path,
const base::Value* value,
const os_crypt_async::Encryptor* encryptor) override;
std::string ComputeEncryptedHash(
const std::string& path,
const base::Value::Dict* dict,
const os_crypt_async::Encryptor* encryptor) override;
base::Value::Dict ComputeSplitEncryptedHashes(
const std::string& path,
const base::Value::Dict* split_values,
const os_crypt_async::Encryptor* encryptor) override;
private:
friend class PrefHashStoreImplEncryptedTest;
class PrefHashStoreTransactionImpl;
std::string ComputeMac(const std::string& path,
const base::Value::Dict* new_dict);
const PrefHashCalculator pref_hash_calculator_;
bool use_super_mac_;
};
#endif