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

Side by Side Diff: components/user_prefs/tracked/dictionary_hash_store_contents.h

Issue 2782803002: Move tracked prefs into services/preferences/tracked. (Closed)
Patch Set: rebase Created 3 years, 8 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 COMPONENTS_USER_PREFS_TRACKED_DICTIONARY_HASH_STORE_CONTENTS_H_
6 #define COMPONENTS_USER_PREFS_TRACKED_DICTIONARY_HASH_STORE_CONTENTS_H_
7
8 #include "base/macros.h"
9 #include "components/user_prefs/tracked/hash_store_contents.h"
10
11 namespace base {
12 class DictionaryValue;
13 class Value;
14 } // namespace base
15
16 namespace user_prefs {
17 class PrefRegistrySyncable;
18 } // namespace user_prefs
19
20 // Implements HashStoreContents by storing MACs in a DictionaryValue. The
21 // DictionaryValue is presumed to be the contents of a PrefStore.
22 // RegisterProfilePrefs() may be used to register all of the preferences used by
23 // this object.
24 class DictionaryHashStoreContents : public HashStoreContents {
25 public:
26 // Constructs a DictionaryHashStoreContents that reads from and writes to
27 // |storage|.
28 explicit DictionaryHashStoreContents(base::DictionaryValue* storage);
29
30 // Registers required preferences.
31 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
32
33 // HashStoreContents implementation
34 bool IsCopyable() const override;
35 std::unique_ptr<HashStoreContents> MakeCopy() const override;
36 base::StringPiece GetUMASuffix() const override;
37 void Reset() override;
38 bool GetMac(const std::string& path, std::string* out_value) override;
39 bool GetSplitMacs(const std::string& path,
40 std::map<std::string, std::string>* split_macs) override;
41 void SetMac(const std::string& path, const std::string& value) override;
42 void SetSplitMac(const std::string& path,
43 const std::string& split_path,
44 const std::string& value) override;
45 void ImportEntry(const std::string& path,
46 const base::Value* in_value) override;
47 bool RemoveEntry(const std::string& path) override;
48 const base::DictionaryValue* GetContents() const override;
49 std::string GetSuperMac() const override;
50 void SetSuperMac(const std::string& super_mac) override;
51
52 private:
53 base::DictionaryValue* storage_;
54
55 // Helper function to get a mutable version of the macs from |storage_|,
56 // creating it if needed and |create_if_null| is true.
57 base::DictionaryValue* GetMutableContents(bool create_if_null);
58
59 DISALLOW_COPY_AND_ASSIGN(DictionaryHashStoreContents);
60 };
61
62 #endif // COMPONENTS_USER_PREFS_TRACKED_DICTIONARY_HASH_STORE_CONTENTS_H_
OLDNEW
« no previous file with comments | « components/user_prefs/tracked/device_id_win.cc ('k') | components/user_prefs/tracked/dictionary_hash_store_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698