Index: chrome/common/json_pref_store.h |
diff --git a/chrome/common/json_pref_store.h b/chrome/common/json_pref_store.h |
index d8da37d08f1c5b34906c1334c7372a6f96a0f6ae..70d274bd68d3b0363fc44140de465ed57c20346d 100644 |
--- a/chrome/common/json_pref_store.h |
+++ b/chrome/common/json_pref_store.h |
@@ -27,11 +27,6 @@ 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, |
@@ -51,15 +46,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 void ReadPrefsAsync(); |
+ virtual void GetErrors(PrefReadError* error, bool* is_fatal); |
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. |
+ // ownership of the |value| pointer. Note, this method is used with |
+ // asynchronous file reading, so class exposes it only for the internal needs. |
+ // (read: do not call it manually). |
void OnFileRead(Value* value_owned, PrefReadError error, bool no_dir); |
private: |
@@ -67,6 +64,7 @@ class JsonPrefStore : public PersistentPrefStore, |
virtual bool SerializeData(std::string* output); |
FilePath path_; |
+ scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy_; |
scoped_ptr<DictionaryValue> prefs_; |
@@ -77,7 +75,8 @@ class JsonPrefStore : public PersistentPrefStore, |
ObserverList<PrefStore::Observer, true> observers_; |
- Delegate* delegate_; |
+ PrefReadError error_; |
+ bool is_fatal_; |
DISALLOW_COPY_AND_ASSIGN(JsonPrefStore); |
}; |