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

Side by Side Diff: chrome/browser/prefs/pref_service.h

Issue 6248026: Rename Real* to Double* in values.* and dependent files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More renames Created 9 years, 10 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_PREFS_PREF_SERVICE_H_ 7 #ifndef CHROME_BROWSER_PREFS_PREF_SERVICE_H_
8 #define CHROME_BROWSER_PREFS_PREF_SERVICE_H_ 8 #define CHROME_BROWSER_PREFS_PREF_SERVICE_H_
9 #pragma once 9 #pragma once
10 10
(...skipping 20 matching lines...) Expand all
31 class PrefMemberBase; 31 class PrefMemberBase;
32 }; 32 };
33 33
34 class PrefService : public base::NonThreadSafe { 34 class PrefService : public base::NonThreadSafe {
35 public: 35 public:
36 // A helper class to store all the information associated with a preference. 36 // A helper class to store all the information associated with a preference.
37 class Preference { 37 class Preference {
38 public: 38 public:
39 39
40 // The type of the preference is determined by the type with which it is 40 // The type of the preference is determined by the type with which it is
41 // registered. This type needs to be a boolean, integer, real, string, 41 // registered. This type needs to be a boolean, integer, double, string,
42 // dictionary (a branch), or list. You shouldn't need to construct this on 42 // dictionary (a branch), or list. You shouldn't need to construct this on
43 // your own; use the PrefService::Register*Pref methods instead. 43 // your own; use the PrefService::Register*Pref methods instead.
44 Preference(const PrefService* service, 44 Preference(const PrefService* service,
45 const char* name, 45 const char* name,
46 Value::ValueType type); 46 Value::ValueType type);
47 ~Preference() {} 47 ~Preference() {}
48 48
49 // Returns the name of the Preference (i.e., the key, e.g., 49 // Returns the name of the Preference (i.e., the key, e.g.,
50 // browser.window_placement). 50 // browser.window_placement).
51 const std::string name() const { return name_; } 51 const std::string name() const { return name_; }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // we need to save immediately (basically, during shutdown). Otherwise, you 135 // we need to save immediately (basically, during shutdown). Otherwise, you
136 // should use ScheduleSavePersistentPrefs. 136 // should use ScheduleSavePersistentPrefs.
137 bool SavePersistentPrefs(); 137 bool SavePersistentPrefs();
138 138
139 // Serializes the data and schedules save using ImportantFileWriter. 139 // Serializes the data and schedules save using ImportantFileWriter.
140 void ScheduleSavePersistentPrefs(); 140 void ScheduleSavePersistentPrefs();
141 141
142 // Make the PrefService aware of a pref. 142 // Make the PrefService aware of a pref.
143 void RegisterBooleanPref(const char* path, bool default_value); 143 void RegisterBooleanPref(const char* path, bool default_value);
144 void RegisterIntegerPref(const char* path, int default_value); 144 void RegisterIntegerPref(const char* path, int default_value);
145 void RegisterRealPref(const char* path, double default_value); 145 void RegisterDoublePref(const char* path, double default_value);
146 void RegisterStringPref(const char* path, const std::string& default_value); 146 void RegisterStringPref(const char* path, const std::string& default_value);
147 void RegisterFilePathPref(const char* path, const FilePath& default_value); 147 void RegisterFilePathPref(const char* path, const FilePath& default_value);
148 void RegisterListPref(const char* path); 148 void RegisterListPref(const char* path);
149 void RegisterDictionaryPref(const char* path); 149 void RegisterDictionaryPref(const char* path);
150 150
151 // These variants use a default value from the locale dll instead. 151 // These variants use a default value from the locale dll instead.
152 void RegisterLocalizedBooleanPref(const char* path, 152 void RegisterLocalizedBooleanPref(const char* path,
153 int locale_default_message_id); 153 int locale_default_message_id);
154 void RegisterLocalizedIntegerPref(const char* path, 154 void RegisterLocalizedIntegerPref(const char* path,
155 int locale_default_message_id); 155 int locale_default_message_id);
156 void RegisterLocalizedRealPref(const char* path, 156 void RegisterLocalizedDoublePref(const char* path,
157 int locale_default_message_id); 157 int locale_default_message_id);
158 void RegisterLocalizedStringPref(const char* path, 158 void RegisterLocalizedStringPref(const char* path,
159 int locale_default_message_id); 159 int locale_default_message_id);
160 160
161 // If the path is valid and the value at the end of the path matches the type 161 // If the path is valid and the value at the end of the path matches the type
162 // specified, it will return the specified value. Otherwise, the default 162 // specified, it will return the specified value. Otherwise, the default
163 // value (set when the pref was registered) will be returned. 163 // value (set when the pref was registered) will be returned.
164 bool GetBoolean(const char* path) const; 164 bool GetBoolean(const char* path) const;
165 int GetInteger(const char* path) const; 165 int GetInteger(const char* path) const;
166 double GetReal(const char* path) const; 166 double GetDouble(const char* path) const;
167 std::string GetString(const char* path) const; 167 std::string GetString(const char* path) const;
168 FilePath GetFilePath(const char* path) const; 168 FilePath GetFilePath(const char* path) const;
169 169
170 // Returns the branch if it exists. If it's not a branch or the branch does 170 // Returns the branch if it exists. If it's not a branch or the branch does
171 // not exist, returns NULL. 171 // not exist, returns NULL.
172 const DictionaryValue* GetDictionary(const char* path) const; 172 const DictionaryValue* GetDictionary(const char* path) const;
173 const ListValue* GetList(const char* path) const; 173 const ListValue* GetList(const char* path) const;
174 174
175 // Removes a user pref and restores the pref to its default value. 175 // Removes a user pref and restores the pref to its default value.
176 void ClearPref(const char* path); 176 void ClearPref(const char* path);
177 177
178 // If the path is valid (i.e., registered), update the pref value in the user 178 // If the path is valid (i.e., registered), update the pref value in the user
179 // prefs. Seting a null value on a preference of List or Dictionary type is 179 // prefs. Seting a null value on a preference of List or Dictionary type is
180 // equivalent to removing the user value for that preference, allowing the 180 // equivalent to removing the user value for that preference, allowing the
181 // default value to take effect unless another value takes precedence. 181 // default value to take effect unless another value takes precedence.
182 void Set(const char* path, const Value& value); 182 void Set(const char* path, const Value& value);
183 void SetBoolean(const char* path, bool value); 183 void SetBoolean(const char* path, bool value);
184 void SetInteger(const char* path, int value); 184 void SetInteger(const char* path, int value);
185 void SetReal(const char* path, double value); 185 void SetDouble(const char* path, double value);
186 void SetString(const char* path, const std::string& value); 186 void SetString(const char* path, const std::string& value);
187 void SetFilePath(const char* path, const FilePath& value); 187 void SetFilePath(const char* path, const FilePath& value);
188 188
189 // Int64 helper methods that actually store the given value as a string. 189 // Int64 helper methods that actually store the given value as a string.
190 // Note that if obtaining the named value via GetDictionary or GetList, the 190 // Note that if obtaining the named value via GetDictionary or GetList, the
191 // Value type will be TYPE_STRING. 191 // Value type will be TYPE_STRING.
192 void SetInt64(const char* path, int64 value); 192 void SetInt64(const char* path, int64 value);
193 int64 GetInt64(const char* path) const; 193 int64 GetInt64(const char* path) const;
194 void RegisterInt64Pref(const char* path, int64 default_value); 194 void RegisterInt64Pref(const char* path, int64 default_value);
195 195
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 296
297 // Local cache of registered Preference objects. The default_store_ 297 // Local cache of registered Preference objects. The default_store_
298 // is authoritative with respect to what the types and default values 298 // is authoritative with respect to what the types and default values
299 // of registered preferences are. 299 // of registered preferences are.
300 mutable PreferenceSet prefs_; 300 mutable PreferenceSet prefs_;
301 301
302 DISALLOW_COPY_AND_ASSIGN(PrefService); 302 DISALLOW_COPY_AND_ASSIGN(PrefService);
303 }; 303 };
304 304
305 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_H_ 305 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698