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