Add GCMChannelStatusSyncer to schedule requests and enable/disable GCM
[chromium-blink-merge.git] / chrome / browser / prefs / tracked / pref_service_hash_store_contents.h
blobd7a36ba8a9baeea8e3680a6525c1b27ffc72d777
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.
5 #ifndef CHROME_BROWSER_PREFS_TRACKED_PREF_SERVICE_HASH_STORE_CONTENTS_H_
6 #define CHROME_BROWSER_PREFS_TRACKED_PREF_SERVICE_HASH_STORE_CONTENTS_H_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "base/macros.h"
12 #include "chrome/browser/prefs/tracked/hash_store_contents.h"
14 class PrefRegistrySimple;
15 class PrefService;
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.
29 // |pref_service| must have previously been configured using |RegisterPrefs|.
30 PrefServiceHashStoreContents(const std::string& hash_store_id,
31 PrefService* pref_service);
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[];
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[];
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[];
50 // Registers required preferences.
51 static void RegisterPrefs(PrefRegistrySimple* registry);
53 // Deletes stored hashes for all profiles from |pref_service|.
54 static void ResetAllPrefHashStores(PrefService* pref_service);
56 // HashStoreContents implementation
57 virtual std::string hash_store_id() const OVERRIDE;
58 virtual void Reset() OVERRIDE;
59 virtual bool IsInitialized() const OVERRIDE;
60 virtual const base::DictionaryValue* GetContents() const OVERRIDE;
61 virtual scoped_ptr<MutableDictionary> GetMutableContents() OVERRIDE;
62 virtual std::string GetSuperMac() const OVERRIDE;
63 virtual void SetSuperMac(const std::string& super_mac) OVERRIDE;
65 private:
66 const std::string hash_store_id_;
67 PrefService* pref_service_;
69 DISALLOW_COPY_AND_ASSIGN(PrefServiceHashStoreContents);
72 #endif // CHROME_BROWSER_PREFS_TRACKED_PREF_SERVICE_HASH_STORE_CONTENTS_H_