diff options
Diffstat (limited to 'chrome/browser/pref_service.h')
-rw-r--r-- | chrome/browser/pref_service.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/chrome/browser/pref_service.h b/chrome/browser/pref_service.h index f1819ad..75d829e 100644 --- a/chrome/browser/pref_service.h +++ b/chrome/browser/pref_service.h @@ -186,7 +186,23 @@ class PrefService : public NonThreadSafe, // ImportantFileWriter::DataSerializer virtual bool SerializeData(std::string* output); + bool read_only() const { return read_only_; } + private: + // Unique integer code for each type of error so we can report them + // distinctly in a histogram. + // NOTE: Don't change the order here as it will change the server's meaning + // of the histogram. + enum PrefReadError { + PREF_READ_ERROR_NONE = 0, + PREF_READ_ERROR_JSON_PARSE, + PREF_READ_ERROR_JSON_TYPE, + PREF_READ_ERROR_ACCESS_DENIED, + PREF_READ_ERROR_FILE_OTHER, + PREF_READ_ERROR_FILE_LOCKED, + PREF_READ_ERROR_NO_FILE, + }; + // Add a preference to the PreferenceMap. If the pref already exists, return // false. This method takes ownership of |pref|. void RegisterPreference(Preference* pref); @@ -203,6 +219,13 @@ class PrefService : public NonThreadSafe, void FireObserversIfChanged(const wchar_t* pref_name, const Value* old_value); + // Load from disk. Returns a non-zero error code on failure. + PrefReadError LoadPersistentPrefs(); + + // Load preferences from disk, attempting to diagnose and handle errors. + // This should only be called from the constructor. + void InitFromDisk(); + scoped_ptr<DictionaryValue> persistent_; // Helper for safe writing pref data. @@ -220,6 +243,11 @@ class PrefService : public NonThreadSafe, friend class ScopedPrefUpdate; + // Whether the service is in a pseudo-read-only mode where changes are not + // actually persisted to disk. This happens in some cases when there are + // read errors during startup. + bool read_only_; + DISALLOW_COPY_AND_ASSIGN(PrefService); }; |