| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_COMMON_JSON_PREF_STORE_H_ | 5 #ifndef CHROME_COMMON_JSON_PREF_STORE_H_ |
| 6 #define CHROME_COMMON_JSON_PREF_STORE_H_ | 6 #define CHROME_COMMON_JSON_PREF_STORE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class JsonPrefStore : public PrefStore, | 22 class JsonPrefStore : public PrefStore, |
| 23 public ImportantFileWriter::DataSerializer { | 23 public ImportantFileWriter::DataSerializer { |
| 24 public: | 24 public: |
| 25 // |file_message_loop_proxy| is the MessageLoopProxy for a thread on which | 25 // |file_message_loop_proxy| is the MessageLoopProxy for a thread on which |
| 26 // file I/O can be done. | 26 // file I/O can be done. |
| 27 JsonPrefStore(const FilePath& pref_filename, | 27 JsonPrefStore(const FilePath& pref_filename, |
| 28 base::MessageLoopProxy* file_message_loop_proxy); | 28 base::MessageLoopProxy* file_message_loop_proxy); |
| 29 virtual ~JsonPrefStore(); | 29 virtual ~JsonPrefStore(); |
| 30 | 30 |
| 31 // PrefStore methods: | 31 // PrefStore methods: |
| 32 virtual bool ReadOnly() const { return read_only_; } | 32 virtual bool ReadOnly() const; |
| 33 | 33 |
| 34 virtual DictionaryValue* prefs() const { return prefs_.get(); } | 34 virtual DictionaryValue* prefs() const; |
| 35 | 35 |
| 36 virtual PrefReadError ReadPrefs(); | 36 virtual PrefReadError ReadPrefs(); |
| 37 | 37 |
| 38 virtual bool WritePrefs(); | 38 virtual bool WritePrefs(); |
| 39 | 39 |
| 40 virtual void ScheduleWritePrefs(); | 40 virtual void ScheduleWritePrefs(); |
| 41 | 41 |
| 42 // ImportantFileWriter::DataSerializer methods: | 42 // ImportantFileWriter::DataSerializer methods: |
| 43 virtual bool SerializeData(std::string* data); | 43 virtual bool SerializeData(std::string* data); |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 FilePath path_; | 46 FilePath path_; |
| 47 | 47 |
| 48 scoped_ptr<DictionaryValue> prefs_; | 48 scoped_ptr<DictionaryValue> prefs_; |
| 49 | 49 |
| 50 bool read_only_; | 50 bool read_only_; |
| 51 | 51 |
| 52 // Helper for safely writing pref data. | 52 // Helper for safely writing pref data. |
| 53 ImportantFileWriter writer_; | 53 ImportantFileWriter writer_; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 #endif // CHROME_COMMON_JSON_PREF_STORE_H_ | 56 #endif // CHROME_COMMON_JSON_PREF_STORE_H_ |
| OLD | NEW |