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

Side by Side Diff: base/prefs/pref_service.h

Issue 254473002: Add support for int64 and uint64 in values.h's API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test compile Created 6 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 | Annotate | Revision Log
« no previous file with comments | « base/prefs/pref_registry_simple.cc ('k') | base/prefs/pref_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This provides a way to access the application's current preferences. 5 // This provides a way to access the application's current preferences.
6 6
7 // Chromium settings and storage represent user-selected preferences and 7 // Chromium settings and storage represent user-selected preferences and
8 // information and MUST not be extracted, overwritten or modified except 8 // information and MUST not be extracted, overwritten or modified except
9 // through Chromium defined APIs. 9 // through Chromium defined APIs.
10 10
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // registered. 166 // registered.
167 const PrefService::Preference* FindPreference(const char* path) const; 167 const PrefService::Preference* FindPreference(const char* path) const;
168 168
169 // If the path is valid and the value at the end of the path matches the type 169 // If the path is valid and the value at the end of the path matches the type
170 // specified, it will return the specified value. Otherwise, the default 170 // specified, it will return the specified value. Otherwise, the default
171 // value (set when the pref was registered) will be returned. 171 // value (set when the pref was registered) will be returned.
172 bool GetBoolean(const char* path) const; 172 bool GetBoolean(const char* path) const;
173 int GetInteger(const char* path) const; 173 int GetInteger(const char* path) const;
174 double GetDouble(const char* path) const; 174 double GetDouble(const char* path) const;
175 std::string GetString(const char* path) const; 175 std::string GetString(const char* path) const;
176 int64 GetInt64(const char* path) const;
177 uint64 GetUint64(const char* path) const;
176 base::FilePath GetFilePath(const char* path) const; 178 base::FilePath GetFilePath(const char* path) const;
177 179
178 // Returns the branch if it exists, or the registered default value otherwise. 180 // Returns the branch if it exists, or the registered default value otherwise.
179 // Note that |path| must point to a registered preference. In that case, these 181 // Note that |path| must point to a registered preference. In that case, these
180 // functions will never return NULL. 182 // functions will never return NULL.
181 const base::DictionaryValue* GetDictionary( 183 const base::DictionaryValue* GetDictionary(
182 const char* path) const; 184 const char* path) const;
183 const base::ListValue* GetList(const char* path) const; 185 const base::ListValue* GetList(const char* path) const;
184 186
185 // Removes a user pref and restores the pref to its default value. 187 // Removes a user pref and restores the pref to its default value.
186 void ClearPref(const char* path); 188 void ClearPref(const char* path);
187 189
188 // If the path is valid (i.e., registered), update the pref value in the user 190 // If the path is valid (i.e., registered), update the pref value in the user
189 // prefs. 191 // prefs.
190 // To set the value of dictionary or list values in the pref tree use 192 // To set the value of dictionary or list values in the pref tree use
191 // Set(), but to modify the value of a dictionary or list use either 193 // Set(), but to modify the value of a dictionary or list use either
192 // ListPrefUpdate or DictionaryPrefUpdate from scoped_user_pref_update.h. 194 // ListPrefUpdate or DictionaryPrefUpdate from scoped_user_pref_update.h.
193 void Set(const char* path, const base::Value& value); 195 void Set(const char* path, const base::Value& value);
194 void SetBoolean(const char* path, bool value); 196 void SetBoolean(const char* path, bool value);
195 void SetInteger(const char* path, int value); 197 void SetInteger(const char* path, int value);
196 void SetDouble(const char* path, double value); 198 void SetDouble(const char* path, double value);
197 void SetString(const char* path, const std::string& value); 199 void SetString(const char* path, const std::string& value);
200 void SetInt64(const char* path, int64 value);
201 void SetUint64(const char* path, uint64 value);
198 void SetFilePath(const char* path, const base::FilePath& value); 202 void SetFilePath(const char* path, const base::FilePath& value);
199 203
200 // Int64 helper methods that actually store the given value as a string.
201 // Note that if obtaining the named value via GetDictionary or GetList, the
202 // Value type will be TYPE_STRING.
203 void SetInt64(const char* path, int64 value);
204 int64 GetInt64(const char* path) const;
205
206 // As above, but for unsigned values.
207 void SetUint64(const char* path, uint64 value);
208 uint64 GetUint64(const char* path) const;
209
210 // Returns the value of the given preference, from the user pref store. If 204 // Returns the value of the given preference, from the user pref store. If
211 // the preference is not set in the user pref store, returns NULL. 205 // the preference is not set in the user pref store, returns NULL.
212 const base::Value* GetUserPrefValue(const char* path) const; 206 const base::Value* GetUserPrefValue(const char* path) const;
213 207
214 // Changes the default value for a preference. Takes ownership of |value|. 208 // Changes the default value for a preference. Takes ownership of |value|.
215 // 209 //
216 // Will cause a pref change notification to be fired if this causes 210 // Will cause a pref change notification to be fired if this causes
217 // the effective value to change. 211 // the effective value to change.
218 void SetDefaultPrefValue(const char* path, base::Value* value); 212 void SetDefaultPrefValue(const char* path, base::Value* value);
219 213
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 344
351 // Local cache of registered Preference objects. The pref_registry_ 345 // Local cache of registered Preference objects. The pref_registry_
352 // is authoritative with respect to what the types and default values 346 // is authoritative with respect to what the types and default values
353 // of registered preferences are. 347 // of registered preferences are.
354 mutable PreferenceMap prefs_map_; 348 mutable PreferenceMap prefs_map_;
355 349
356 DISALLOW_COPY_AND_ASSIGN(PrefService); 350 DISALLOW_COPY_AND_ASSIGN(PrefService);
357 }; 351 };
358 352
359 #endif // BASE_PREFS_PREF_SERVICE_H_ 353 #endif // BASE_PREFS_PREF_SERVICE_H_
OLDNEW
« no previous file with comments | « base/prefs/pref_registry_simple.cc ('k') | base/prefs/pref_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698