Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(405)

Side by Side Diff: chrome/browser/prefs/tracked/pref_service_hash_store_contents.h

Issue 1227973003: Componentize //chrome/browser/prefs/tracked. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_SERVICE_HASH_STORE_CONTENTS_H_
6 #define CHROME_BROWSER_PREFS_TRACKED_PREF_SERVICE_HASH_STORE_CONTENTS_H_
7
8 #include <string>
9
10 #include "base/compiler_specific.h"
11 #include "base/macros.h"
12 #include "chrome/browser/prefs/tracked/hash_store_contents.h"
13
14 class PrefRegistrySimple;
15 class PrefService;
16
17 // Implements HashStoreContents by storing hashes in a PrefService. Multiple
18 // separate hash stores may coexist in the PrefService by using distinct hash
19 // store IDs.
20 // TODO(erikwright): This class is only used to recreate preference state as in
21 // M35, to test migration behaviour. Remove this class when
22 // ProfilePrefStoreManagerTest no longer depends on it.
23 class PrefServiceHashStoreContents : public HashStoreContents {
24 public:
25 // Constructs a HashStoreContents that stores hashes in |pref_service|.
26 // Multiple hash stores can use the same |pref_service| with distinct
27 // |hash_store_id|s.
28 //
29 // |pref_service| must have previously been configured using |RegisterPrefs|.
30 PrefServiceHashStoreContents(const std::string& hash_store_id,
31 PrefService* pref_service);
32
33 // A dictionary pref which maps profile names to dictionary values which hold
34 // hashes of profile prefs that we track to detect changes that happen outside
35 // of Chrome.
36 static const char kProfilePreferenceHashes[];
37
38 // The name of a dict that is stored as a child of
39 // |prefs::kProfilePreferenceHashes|. Each child node is a string whose name
40 // is a hash store ID and whose value is the super MAC for the corresponding
41 // hash store.
42 static const char kHashOfHashesDict[];
43
44 // The name of a dict that is stored as a child of
45 // |prefs::kProfilePreferenceHashes|. Each child node is a number whose name
46 // is a hash store ID and whose value is the version of the corresponding
47 // hash store.
48 static const char kStoreVersionsDict[];
49
50 // Registers required preferences.
51 static void RegisterPrefs(PrefRegistrySimple* registry);
52
53 // Deletes stored hashes for all profiles from |pref_service|.
54 static void ResetAllPrefHashStores(PrefService* pref_service);
55
56 // HashStoreContents implementation
57 std::string hash_store_id() const override;
58 void Reset() override;
59 bool IsInitialized() const override;
60 const base::DictionaryValue* GetContents() const override;
61 scoped_ptr<MutableDictionary> GetMutableContents() override;
62 std::string GetSuperMac() const override;
63 void SetSuperMac(const std::string& super_mac) override;
64
65 private:
66 const std::string hash_store_id_;
67 PrefService* pref_service_;
68
69 DISALLOW_COPY_AND_ASSIGN(PrefServiceHashStoreContents);
70 };
71
72 #endif // CHROME_BROWSER_PREFS_TRACKED_PREF_SERVICE_HASH_STORE_CONTENTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698