Chromium Code Reviews| Index: chrome/browser/prefs/pref_hash_store_impl.h |
| diff --git a/chrome/browser/prefs/pref_hash_store_impl.h b/chrome/browser/prefs/pref_hash_store_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f0bc919fdee9a2d5f627ff07b3f6990012e54717 |
| --- /dev/null |
| +++ b/chrome/browser/prefs/pref_hash_store_impl.h |
| @@ -0,0 +1,56 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_ |
| +#define CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/basictypes.h" |
| +#include "base/compiler_specific.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "chrome/browser/prefs/pref_hash_calculator.h" |
| +#include "chrome/browser/prefs/pref_hash_store.h" |
| + |
| +class PrefRegistrySimple; |
| +class PrefService; |
| + |
| +namespace base { |
| +class Value; |
| +} // namespace base |
| + |
| +// Implements PrefHashStoreImpl by storing preference hashes in a PrefService. |
| +class PrefHashStoreImpl : public PrefHashStore { |
|
Bernhard Bauer
2013/12/10 16:52:07
Are you sure that it's worth using an abstract int
erikwright (departed)
2013/12/12 15:53:30
There is another implementation, in the newly adde
Bernhard Bauer
2013/12/13 19:35:50
FWIW, you could use a TestingPrefStore, which is f
|
| + public: |
| + // Constructs a PrefHashStoreImpl that calculates hashes using |
| + // |seed| and |device_id| and stores them in |local_state|. Multiple hash |
| + // stores can use the same |local_state| with distinct |hash_store_id|s. |
| + // |
| + // The same |seed|, |device_id|, and |hash_store_id| must be used to load and |
| + // validate previously stored hashes in |local_state|. |
| + // |
| + // |local_state| must have previously been passed to |RegisterPrefs|. |
| + PrefHashStoreImpl(const std::string& hash_store_id, |
| + const std::string& seed, |
| + const std::string& device_id, |
| + PrefService* local_state); |
| + |
| + // Registers required local state preferences. |
| + static void RegisterPrefs(PrefRegistrySimple* registry); |
| + |
| + // PrefHashStore implementation. |
| + virtual ValueState CheckValue(const std::string& path, |
| + const base::Value* value) const OVERRIDE; |
| + virtual void StoreValue(const std::string& path, |
| + const base::Value* value) OVERRIDE; |
| + |
| + private: |
| + std::string hash_store_id_; |
| + PrefHashCalculator pref_hash_calculator_; |
| + PrefService* local_state_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PrefHashStoreImpl); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_ |