Chromium Code Reviews| Index: chrome/common/json_pref_store.h |
| diff --git a/chrome/common/json_pref_store.h b/chrome/common/json_pref_store.h |
| index 44f5c8cfc509b6e9b1621a0f1dbb172a29022bc0..fafcc43a8ca1791f0b69ce4d4cb134f9c42cf7d8 100644 |
| --- a/chrome/common/json_pref_store.h |
| +++ b/chrome/common/json_pref_store.h |
| @@ -8,8 +8,11 @@ |
| #include <string> |
| +#include "base/basictypes.h" |
| +#include "base/file_path.h" |
| +#include "base/observer_list.h" |
| #include "base/scoped_ptr.h" |
| -#include "chrome/common/pref_store.h" |
| +#include "chrome/common/persistent_pref_store.h" |
|
danno
2010/12/08 13:08:45
alpha
Mattias Nissler (ping if slow)
2010/12/09 10:20:20
Done.
|
| #include "chrome/common/important_file_writer.h" |
| namespace base { |
| @@ -18,8 +21,10 @@ class MessageLoopProxy; |
| class DictionaryValue; |
| class FilePath; |
| +class Value; |
| -class JsonPrefStore : public PrefStore, |
| +// A writable PrefStore implementation that is used for user preferences. |
| +class JsonPrefStore : public PersistentPrefStore, |
| public ImportantFileWriter::DataSerializer { |
| public: |
| // |file_message_loop_proxy| is the MessageLoopProxy for a thread on which |
| @@ -28,21 +33,26 @@ class JsonPrefStore : public PrefStore, |
| base::MessageLoopProxy* file_message_loop_proxy); |
| virtual ~JsonPrefStore(); |
| - // PrefStore methods: |
| - virtual bool ReadOnly() const { return read_only_; } |
| - |
| - virtual DictionaryValue* prefs() const { return prefs_.get(); } |
| + // PrefStore overrides: |
| + virtual ReadResult GetValue(const std::string& key, Value** result) const; |
| + // PersistentPrefStore overrides: |
| + virtual void SetValue(const std::string& key, Value* value); |
| + virtual void SetValueSilently(const std::string& key, Value* value); |
| + virtual void RemoveValue(const std::string& key); |
| + virtual bool ReadOnly() const { return read_only_; } |
| virtual PrefReadError ReadPrefs(); |
| - |
| virtual bool WritePrefs(); |
| - |
| virtual void ScheduleWritePrefs(); |
| - // ImportantFileWriter::DataSerializer methods: |
| - virtual bool SerializeData(std::string* data); |
| - |
| private: |
| + // Overriden from PrefStore. |
|
danno
2010/12/08 13:08:45
Why do you make these private? By upcasting you ca
Mattias Nissler (ping if slow)
2010/12/09 10:20:20
I don't care really, but I thought consumers shoul
|
| + virtual void AddObserver(PrefStore::ObserverInterface* observer); |
| + virtual void RemoveObserver(PrefStore::ObserverInterface* observer); |
| + |
| + // ImportantFileWriter::DataSerializer overrides: |
| + bool SerializeData(std::string* output); |
| + |
| FilePath path_; |
| scoped_ptr<DictionaryValue> prefs_; |
| @@ -51,6 +61,10 @@ class JsonPrefStore : public PrefStore, |
| // Helper for safely writing pref data. |
| ImportantFileWriter writer_; |
| + |
| + ObserverList<PrefStore::ObserverInterface, true> observers_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(JsonPrefStore); |
| }; |
| #endif // CHROME_COMMON_JSON_PREF_STORE_H_ |