OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_PREFS_TRACKED_PREF_STORE_HASH_STORE_CONTENTS_H_ |
| 6 #define CHROME_BROWSER_PREFS_TRACKED_PREF_STORE_HASH_STORE_CONTENTS_H_ |
| 7 |
| 8 #include <string> |
| 9 #include "base/compiler_specific.h" |
| 10 #include "base/macros.h" |
| 11 #include "chrome/browser/prefs/tracked/hash_store_contents.h" |
| 12 |
| 13 namespace user_prefs { |
| 14 class PrefRegistrySyncable; |
| 15 } // namespace user_prefs |
| 16 |
| 17 class PersistentPrefStore; |
| 18 class WriteablePrefStore; |
| 19 |
| 20 class PrefStoreHashStoreContents : public HashStoreContents { |
| 21 public: |
| 22 // A super MAC used to validate the hash store contents when determining |
| 23 // whether |
| 24 // an unknown value is to be trusted is stored as a string under |
| 25 // |kSuperMacPref| |
| 26 static const char kSuperMacPref[]; |
| 27 |
| 28 // Does not increment the reference count on |pref_store|. Assumes that |
| 29 // |pref_store| indirectly owns this HashStoreContents. |
| 30 explicit PrefStoreHashStoreContents(PersistentPrefStore* pref_store); |
| 31 |
| 32 // Does not increment the reference count on |pref_store|. Assumes that |
| 33 // |pref_store| indirectly owns this HashStoreContents. Ignores calls to |
| 34 // CommitPendingWrite() because this is not supported by the (presumably |
| 35 // in-memory) WriteablePrefStore. |
| 36 explicit PrefStoreHashStoreContents(WriteablePrefStore* pref_store); |
| 37 |
| 38 // Registers required preferences. |
| 39 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 40 |
| 41 // HashStoreContents implementation |
| 42 virtual std::string hash_store_id() const OVERRIDE; |
| 43 virtual void Reset() OVERRIDE; |
| 44 virtual bool IsInitialized() const OVERRIDE; |
| 45 virtual const base::DictionaryValue* GetContents() const OVERRIDE; |
| 46 virtual scoped_ptr<MutableDictionary> GetMutableContents() OVERRIDE; |
| 47 virtual std::string GetSuperMac() const OVERRIDE; |
| 48 virtual void SetSuperMac(const std::string& super_mac) OVERRIDE; |
| 49 virtual void CommitPendingWrite() OVERRIDE; |
| 50 |
| 51 private: |
| 52 WriteablePrefStore* const pref_store_; |
| 53 PersistentPrefStore* const persistent_pref_store_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(PrefStoreHashStoreContents); |
| 56 }; |
| 57 |
| 58 #endif // CHROME_BROWSER_PREFS_TRACKED_PREF_STORE_HASH_STORE_CONTENTS_H_ |
OLD | NEW |