diff options
Diffstat (limited to 'chrome/common/json_pref_store.h')
-rw-r--r-- | chrome/common/json_pref_store.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/chrome/common/json_pref_store.h b/chrome/common/json_pref_store.h index b2a1f53..d8da37d 100644 --- a/chrome/common/json_pref_store.h +++ b/chrome/common/json_pref_store.h @@ -27,6 +27,11 @@ class Value; class JsonPrefStore : public PersistentPrefStore, public ImportantFileWriter::DataSerializer { public: + class Delegate { + public: + virtual void OnPrefsRead(PrefReadError error, bool no_dir) = 0; + }; + // |file_message_loop_proxy| is the MessageLoopProxy for a thread on which // file I/O can be done. JsonPrefStore(const FilePath& pref_filename, @@ -46,11 +51,17 @@ class JsonPrefStore : public PersistentPrefStore, virtual void RemoveValue(const std::string& key); virtual bool ReadOnly() const; virtual PrefReadError ReadPrefs(); + // todo(altimofeev): move it to the PersistentPrefStore inteface. + void ReadPrefs(Delegate* delegate); virtual bool WritePrefs(); virtual void ScheduleWritePrefs(); virtual void CommitPendingWrite(); virtual void ReportValueChanged(const std::string& key); + // This method is called after JSON file has been read. Method takes + // ownership of the |value| pointer. + void OnFileRead(Value* value_owned, PrefReadError error, bool no_dir); + private: // ImportantFileWriter::DataSerializer overrides: virtual bool SerializeData(std::string* output); @@ -66,6 +77,8 @@ class JsonPrefStore : public PersistentPrefStore, ObserverList<PrefStore::Observer, true> observers_; + Delegate* delegate_; + DISALLOW_COPY_AND_ASSIGN(JsonPrefStore); }; |