OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 BASE_PREFS_PREF_REGISTRY_SIMPLE_H_ | 5 // TODO(brettw) remove this forwarding header when prefs is completely moved to |
6 #define BASE_PREFS_PREF_REGISTRY_SIMPLE_H_ | 6 // components. |
7 | 7 #include "components/prefs/pref_registry_simple.h" |
8 #include <stdint.h> | |
9 | |
10 #include <string> | |
11 | |
12 #include "base/macros.h" | |
13 #include "base/prefs/base_prefs_export.h" | |
14 #include "base/prefs/pref_registry.h" | |
15 | |
16 namespace base { | |
17 class DictionaryValue; | |
18 class FilePath; | |
19 class ListValue; | |
20 } | |
21 | |
22 // A simple implementation of PrefRegistry. | |
23 class BASE_PREFS_EXPORT PrefRegistrySimple : public PrefRegistry { | |
24 public: | |
25 PrefRegistrySimple(); | |
26 | |
27 void RegisterBooleanPref(const std::string& path, bool default_value); | |
28 void RegisterIntegerPref(const std::string& path, int default_value); | |
29 void RegisterDoublePref(const std::string& path, double default_value); | |
30 void RegisterStringPref(const std::string& path, | |
31 const std::string& default_value); | |
32 void RegisterFilePathPref(const std::string& path, | |
33 const base::FilePath& default_value); | |
34 void RegisterListPref(const std::string& path); | |
35 void RegisterDictionaryPref(const std::string& path); | |
36 void RegisterListPref(const std::string& path, | |
37 base::ListValue* default_value); | |
38 void RegisterDictionaryPref(const std::string& path, | |
39 base::DictionaryValue* default_value); | |
40 void RegisterInt64Pref(const std::string& path, int64_t default_value); | |
41 void RegisterUint64Pref(const std::string&, uint64_t default_value); | |
42 | |
43 // Versions of registration functions that accept PrefRegistrationFlags. | |
44 // |flags| is a bitmask of PrefRegistrationFlags. | |
45 void RegisterBooleanPref(const std::string&, | |
46 bool default_value, | |
47 uint32_t flags); | |
48 void RegisterIntegerPref(const std::string&, | |
49 int default_value, | |
50 uint32_t flags); | |
51 void RegisterDoublePref(const std::string&, | |
52 double default_value, | |
53 uint32_t flags); | |
54 void RegisterStringPref(const std::string&, | |
55 const std::string& default_value, | |
56 uint32_t flags); | |
57 void RegisterFilePathPref(const std::string&, | |
58 const base::FilePath& default_value, | |
59 uint32_t flags); | |
60 void RegisterListPref(const std::string&, uint32_t flags); | |
61 void RegisterDictionaryPref(const std::string&, uint32_t flags); | |
62 void RegisterListPref(const std::string&, | |
63 base::ListValue* default_value, | |
64 uint32_t flags); | |
65 void RegisterDictionaryPref(const std::string&, | |
66 base::DictionaryValue* default_value, | |
67 uint32_t flags); | |
68 void RegisterInt64Pref(const std::string&, | |
69 int64_t default_value, | |
70 uint32_t flags); | |
71 void RegisterUint64Pref(const std::string&, | |
72 uint64_t default_value, | |
73 uint32_t flags); | |
74 | |
75 protected: | |
76 ~PrefRegistrySimple() override; | |
77 | |
78 // Allows subclasses to hook into pref registration. | |
79 virtual void OnPrefRegistered(const std::string&, | |
80 base::Value* default_value, | |
81 uint32_t flags); | |
82 | |
83 private: | |
84 void RegisterPrefAndNotify(const std::string&, | |
85 base::Value* default_value, | |
86 uint32_t flags); | |
87 | |
88 DISALLOW_COPY_AND_ASSIGN(PrefRegistrySimple); | |
89 }; | |
90 | |
91 #endif // BASE_PREFS_PREF_REGISTRY_SIMPLE_H_ | |
OLD | NEW |