| Index: chrome/browser/pref_service.h
|
| diff --git a/chrome/browser/pref_service.h b/chrome/browser/pref_service.h
|
| index 85dd42ca8f7858ef2e18d44814ea8e9bc49b56bb..7a79286ee994fdacd919490116a611203cceb447 100644
|
| --- a/chrome/browser/pref_service.h
|
| +++ b/chrome/browser/pref_service.h
|
| @@ -184,7 +184,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);
|
| @@ -201,6 +217,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.
|
| @@ -216,6 +239,11 @@ class PrefService : public NonThreadSafe,
|
| PrefObserverMap;
|
| PrefObserverMap pref_observers_;
|
|
|
| + // 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);
|
| };
|
|
|
|
|