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_VALUE_STORE_H_ | 5 #ifndef BASE_PREFS_PREF_VALUE_STORE_H_ |
6 #define BASE_PREFS_PREF_VALUE_STORE_H_ | 6 #define BASE_PREFS_PREF_VALUE_STORE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 // Gets the value for the given preference name that has the specified value | 76 // Gets the value for the given preference name that has the specified value |
77 // type. Values stored in a PrefStore that have the matching |name| but | 77 // type. Values stored in a PrefStore that have the matching |name| but |
78 // a non-matching |type| are silently skipped. Returns true if a valid value | 78 // a non-matching |type| are silently skipped. Returns true if a valid value |
79 // was found in any of the available PrefStores. Most callers should use | 79 // was found in any of the available PrefStores. Most callers should use |
80 // Preference::GetValue() instead of calling this method directly. | 80 // Preference::GetValue() instead of calling this method directly. |
81 bool GetValue(const std::string& name, | 81 bool GetValue(const std::string& name, |
82 base::Value::Type type, | 82 base::Value::Type type, |
83 const base::Value** out_value) const; | 83 const base::Value** out_value) const; |
84 | 84 |
| 85 // Gets the value set by the user for the given preference name that has the |
| 86 // specified value type. A value stored in the user PrefStore that has |
| 87 // the matching |name| but a non-matching |type| is silently ignored. Returns |
| 88 // true if a valid value was found. Most callers should use |
| 89 // Preference::GetUserValue() instead of calling this method directly. |
| 90 bool GetUserValue(const std::string& name, |
| 91 base::Value::Type type, |
| 92 const base::Value** out_value) const; |
| 93 |
85 // Gets the recommended value for the given preference name that has the | 94 // Gets the recommended value for the given preference name that has the |
86 // specified value type. A value stored in the recommended PrefStore that has | 95 // specified value type. A value stored in the recommended PrefStore that has |
87 // the matching |name| but a non-matching |type| is silently ignored. Returns | 96 // the matching |name| but a non-matching |type| is silently ignored. Returns |
88 // true if a valid value was found. Most callers should use | 97 // true if a valid value was found. Most callers should use |
89 // Preference::GetRecommendedValue() instead of calling this method directly. | 98 // Preference::GetRecommendedValue() instead of calling this method directly. |
90 bool GetRecommendedValue(const std::string& name, | 99 bool GetRecommendedValue(const std::string& name, |
91 base::Value::Type type, | 100 base::Value::Type type, |
92 const base::Value** out_value) const; | 101 const base::Value** out_value) const; |
93 | 102 |
94 // These methods return true if a preference with the given name is in the | 103 // These methods return true if a preference with the given name is in the |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 // A mapping of preference names to their registered types. | 267 // A mapping of preference names to their registered types. |
259 PrefTypeMap pref_types_; | 268 PrefTypeMap pref_types_; |
260 | 269 |
261 // True if not all of the PrefStores were initialized successfully. | 270 // True if not all of the PrefStores were initialized successfully. |
262 bool initialization_failed_; | 271 bool initialization_failed_; |
263 | 272 |
264 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); | 273 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); |
265 }; | 274 }; |
266 | 275 |
267 #endif // BASE_PREFS_PREF_VALUE_STORE_H_ | 276 #endif // BASE_PREFS_PREF_VALUE_STORE_H_ |
OLD | NEW |