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 CHROME_BROWSER_PREFS_TRACKED_PREF_SERVICE_HASH_STORE_CONTENTS_H_ | 5 #ifndef CHROME_BROWSER_PREFS_TRACKED_PREF_SERVICE_HASH_STORE_CONTENTS_H_ |
6 #define CHROME_BROWSER_PREFS_TRACKED_PREF_SERVICE_HASH_STORE_CONTENTS_H_ | 6 #define CHROME_BROWSER_PREFS_TRACKED_PREF_SERVICE_HASH_STORE_CONTENTS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "chrome/browser/prefs/tracked/hash_store_contents.h" | 12 #include "chrome/browser/prefs/tracked/hash_store_contents.h" |
13 | 13 |
14 class PrefRegistrySimple; | 14 class PrefRegistrySimple; |
15 class PrefService; | 15 class PrefService; |
16 | 16 |
17 // Implements HashStoreContents by storing hashes in a PrefService. Multiple | 17 // Implements HashStoreContents by storing hashes in a PrefService. Multiple |
18 // separate hash stores may coexist in the PrefService by using distinct hash | 18 // separate hash stores may coexist in the PrefService by using distinct hash |
19 // store IDs. | 19 // store IDs. |
20 class PrefServiceHashStoreContents : public HashStoreContents { | 20 class PrefServiceHashStoreContents : public HashStoreContents { |
gab
2014/06/17 02:00:06
Add a comment that this is a deprecated class; kep
erikwright (departed)
2014/06/17 19:07:24
Done.
| |
21 public: | 21 public: |
22 // Constructs a HashStoreContents that stores hashes in |pref_service|. | 22 // Constructs a HashStoreContents that stores hashes in |pref_service|. |
23 // Multiple hash stores can use the same |pref_service| with distinct | 23 // Multiple hash stores can use the same |pref_service| with distinct |
24 // |hash_store_id|s. | 24 // |hash_store_id|s. |
25 // | 25 // |
26 // |pref_service| must have previously been configured using |RegisterPrefs|. | 26 // |pref_service| must have previously been configured using |RegisterPrefs|. |
27 PrefServiceHashStoreContents(const std::string& hash_store_id, | 27 PrefServiceHashStoreContents(const std::string& hash_store_id, |
28 PrefService* pref_service); | 28 PrefService* pref_service); |
29 | 29 |
30 // A dictionary pref which maps profile names to dictionary values which hold | |
31 // hashes of profile prefs that we track to detect changes that happen outside | |
32 // of Chrome. | |
33 static const char kProfilePreferenceHashes[]; | |
34 | |
30 // The name of a dict that is stored as a child of | 35 // The name of a dict that is stored as a child of |
31 // |prefs::kProfilePreferenceHashes|. Each child node is a string whose name | 36 // |prefs::kProfilePreferenceHashes|. Each child node is a string whose name |
32 // is a hash store ID and whose value is the super MAC for the corresponding | 37 // is a hash store ID and whose value is the super MAC for the corresponding |
33 // hash store. | 38 // hash store. |
34 static const char kHashOfHashesDict[]; | 39 static const char kHashOfHashesDict[]; |
35 | 40 |
36 // The name of a dict that is stored as a child of | 41 // The name of a dict that is stored as a child of |
37 // |prefs::kProfilePreferenceHashes|. Each child node is a number whose name | 42 // |prefs::kProfilePreferenceHashes|. Each child node is a number whose name |
38 // is a hash store ID and whose value is the version of the corresponding | 43 // is a hash store ID and whose value is the version of the corresponding |
39 // hash store. | 44 // hash store. |
40 static const char kStoreVersionsDict[]; | 45 static const char kStoreVersionsDict[]; |
41 | 46 |
42 // Registers required preferences. | 47 // Registers required preferences. |
43 static void RegisterPrefs(PrefRegistrySimple* registry); | 48 static void RegisterPrefs(PrefRegistrySimple* registry); |
44 | 49 |
45 // Deletes stored hashes for all profiles from |pref_service|. | 50 // Deletes stored hashes for all profiles from |pref_service|. |
46 static void ResetAllPrefHashStores(PrefService* pref_service); | 51 static void ResetAllPrefHashStores(PrefService* pref_service); |
47 | 52 |
48 // HashStoreContents implementation | 53 // HashStoreContents implementation |
49 virtual std::string hash_store_id() const OVERRIDE; | 54 virtual std::string hash_store_id() const OVERRIDE; |
50 virtual void Reset() OVERRIDE; | 55 virtual void Reset() OVERRIDE; |
51 virtual bool IsInitialized() const OVERRIDE; | 56 virtual bool IsInitialized() const OVERRIDE; |
52 virtual const base::DictionaryValue* GetContents() const OVERRIDE; | 57 virtual const base::DictionaryValue* GetContents() const OVERRIDE; |
53 virtual scoped_ptr<MutableDictionary> GetMutableContents() OVERRIDE; | 58 virtual scoped_ptr<MutableDictionary> GetMutableContents() OVERRIDE; |
54 virtual std::string GetSuperMac() const OVERRIDE; | 59 virtual std::string GetSuperMac() const OVERRIDE; |
55 virtual void SetSuperMac(const std::string& super_mac) OVERRIDE; | 60 virtual void SetSuperMac(const std::string& super_mac) OVERRIDE; |
56 virtual void CommitPendingWrite() OVERRIDE; | |
57 | 61 |
58 private: | 62 private: |
59 const std::string hash_store_id_; | 63 const std::string hash_store_id_; |
60 PrefService* pref_service_; | 64 PrefService* pref_service_; |
61 | 65 |
62 DISALLOW_COPY_AND_ASSIGN(PrefServiceHashStoreContents); | 66 DISALLOW_COPY_AND_ASSIGN(PrefServiceHashStoreContents); |
63 }; | 67 }; |
64 | 68 |
65 #endif // CHROME_BROWSER_PREFS_TRACKED_PREF_SERVICE_HASH_STORE_CONTENTS_H_ | 69 #endif // CHROME_BROWSER_PREFS_TRACKED_PREF_SERVICE_HASH_STORE_CONTENTS_H_ |
OLD | NEW |