| OLD | NEW |
| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 // Reloads the data from file. This should only be called when the importer | 159 // Reloads the data from file. This should only be called when the importer |
| 160 // is running during first run, and the main process may not change pref | 160 // is running during first run, and the main process may not change pref |
| 161 // values while the importer process is running. Returns true on success. | 161 // values while the importer process is running. Returns true on success. |
| 162 bool ReloadPersistentPrefs(); | 162 bool ReloadPersistentPrefs(); |
| 163 | 163 |
| 164 // Returns true if the preference for the given preference name is available | 164 // Returns true if the preference for the given preference name is available |
| 165 // and is managed. | 165 // and is managed. |
| 166 bool IsManagedPreference(const char* pref_name) const; | 166 bool IsManagedPreference(const char* pref_name) const; |
| 167 | 167 |
| 168 // Writes the data to disk. The return value only reflects whether | 168 // Lands pending writes to disk. This should only be used if we need to save |
| 169 // serialization was successful; we don't know whether the data actually made | 169 // immediately (basically, during shutdown). |
| 170 // it on disk (since it's on a different thread). This should only be used if | |
| 171 // we need to save immediately (basically, during shutdown). Otherwise, you | |
| 172 // should use ScheduleSavePersistentPrefs. | |
| 173 bool SavePersistentPrefs(); | |
| 174 | |
| 175 // Serializes the data and schedules save using ImportantFileWriter. | |
| 176 void ScheduleSavePersistentPrefs(); | |
| 177 | |
| 178 // Lands pending writes to disk. | |
| 179 void CommitPendingWrite(); | 170 void CommitPendingWrite(); |
| 180 | 171 |
| 181 // Make the PrefService aware of a pref. | 172 // Make the PrefService aware of a pref. |
| 182 // TODO(zea): split local state and profile prefs into their own subclasses. | 173 // TODO(zea): split local state and profile prefs into their own subclasses. |
| 183 // ---------- Local state prefs ---------- | 174 // ---------- Local state prefs ---------- |
| 184 void RegisterBooleanPref(const char* path, bool default_value); | 175 void RegisterBooleanPref(const char* path, bool default_value); |
| 185 void RegisterIntegerPref(const char* path, int default_value); | 176 void RegisterIntegerPref(const char* path, int default_value); |
| 186 void RegisterDoublePref(const char* path, double default_value); | 177 void RegisterDoublePref(const char* path, double default_value); |
| 187 void RegisterStringPref(const char* path, const std::string& default_value); | 178 void RegisterStringPref(const char* path, const std::string& default_value); |
| 188 void RegisterFilePathPref(const char* path, const FilePath& default_value); | 179 void RegisterFilePathPref(const char* path, const FilePath& default_value); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 // of registered preferences are. | 385 // of registered preferences are. |
| 395 mutable PreferenceSet prefs_; | 386 mutable PreferenceSet prefs_; |
| 396 | 387 |
| 397 // The model associator that maintains the links with the sync db. | 388 // The model associator that maintains the links with the sync db. |
| 398 scoped_ptr<PrefModelAssociator> pref_sync_associator_; | 389 scoped_ptr<PrefModelAssociator> pref_sync_associator_; |
| 399 | 390 |
| 400 DISALLOW_COPY_AND_ASSIGN(PrefService); | 391 DISALLOW_COPY_AND_ASSIGN(PrefService); |
| 401 }; | 392 }; |
| 402 | 393 |
| 403 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_H_ | 394 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_H_ |
| OLD | NEW |