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 COMPONENTS_PREFS_PREF_REGISTRY_H_ | 5 #ifndef COMPONENTS_PREFS_PREF_REGISTRY_H_ |
6 #define COMPONENTS_PREFS_PREF_REGISTRY_H_ | 6 #define COMPONENTS_PREFS_PREF_REGISTRY_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include <memory> |
| 11 |
10 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
11 #include "base/macros.h" | 13 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
13 #include "components/prefs/base_prefs_export.h" | 15 #include "components/prefs/base_prefs_export.h" |
14 #include "components/prefs/pref_value_map.h" | 16 #include "components/prefs/pref_value_map.h" |
15 | 17 |
16 namespace base { | 18 namespace base { |
17 class Value; | 19 class Value; |
18 } | 20 } |
19 | 21 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // |pref_name| must be a previously registered preference. | 70 // |pref_name| must be a previously registered preference. |
69 void SetDefaultPrefValue(const std::string& pref_name, base::Value* value); | 71 void SetDefaultPrefValue(const std::string& pref_name, base::Value* value); |
70 | 72 |
71 protected: | 73 protected: |
72 friend class base::RefCounted<PrefRegistry>; | 74 friend class base::RefCounted<PrefRegistry>; |
73 virtual ~PrefRegistry(); | 75 virtual ~PrefRegistry(); |
74 | 76 |
75 // Used by subclasses to register a default value and registration flags for | 77 // Used by subclasses to register a default value and registration flags for |
76 // a preference. |flags| is a bitmask of |PrefRegistrationFlags|. | 78 // a preference. |flags| is a bitmask of |PrefRegistrationFlags|. |
77 void RegisterPreference(const std::string& path, | 79 void RegisterPreference(const std::string& path, |
78 base::Value* default_value, | 80 std::unique_ptr<base::Value> default_value, |
79 uint32_t flags); | 81 uint32_t flags); |
80 | 82 |
81 scoped_refptr<DefaultPrefStore> defaults_; | 83 scoped_refptr<DefaultPrefStore> defaults_; |
82 | 84 |
83 // A map of pref name to a bitmask of PrefRegistrationFlags. | 85 // A map of pref name to a bitmask of PrefRegistrationFlags. |
84 PrefRegistrationFlagsMap registration_flags_; | 86 PrefRegistrationFlagsMap registration_flags_; |
85 | 87 |
86 private: | 88 private: |
87 DISALLOW_COPY_AND_ASSIGN(PrefRegistry); | 89 DISALLOW_COPY_AND_ASSIGN(PrefRegistry); |
88 }; | 90 }; |
89 | 91 |
90 #endif // COMPONENTS_PREFS_PREF_REGISTRY_H_ | 92 #endif // COMPONENTS_PREFS_PREF_REGISTRY_H_ |
OLD | NEW |