| 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 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 // PrefStore overrides: | 36 // PrefStore overrides: |
| 37 virtual ReadResult GetValue(const std::string& key, Value** result) const; | 37 virtual ReadResult GetValue(const std::string& key, Value** result) const; |
| 38 virtual void AddObserver(PrefStore::Observer* observer); | 38 virtual void AddObserver(PrefStore::Observer* observer); |
| 39 virtual void RemoveObserver(PrefStore::Observer* observer); | 39 virtual void RemoveObserver(PrefStore::Observer* observer); |
| 40 | 40 |
| 41 // PersistentPrefStore overrides: | 41 // PersistentPrefStore overrides: |
| 42 virtual void SetValue(const std::string& key, Value* value); | 42 virtual void SetValue(const std::string& key, Value* value); |
| 43 virtual void SetValueSilently(const std::string& key, Value* value); | 43 virtual void SetValueSilently(const std::string& key, Value* value); |
| 44 virtual void RemoveValue(const std::string& key); | 44 virtual void RemoveValue(const std::string& key); |
| 45 virtual bool ReadOnly() const { return read_only_; } | 45 virtual bool ReadOnly() const; |
| 46 virtual PrefReadError ReadPrefs(); | 46 virtual PrefReadError ReadPrefs(); |
| 47 virtual bool WritePrefs(); | 47 virtual bool WritePrefs(); |
| 48 virtual void ScheduleWritePrefs(); | 48 virtual void ScheduleWritePrefs(); |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 // ImportantFileWriter::DataSerializer overrides: | 51 // ImportantFileWriter::DataSerializer overrides: |
| 52 bool SerializeData(std::string* output); | 52 bool SerializeData(std::string* output); |
| 53 | 53 |
| 54 FilePath path_; | 54 FilePath path_; |
| 55 | 55 |
| 56 scoped_ptr<DictionaryValue> prefs_; | 56 scoped_ptr<DictionaryValue> prefs_; |
| 57 | 57 |
| 58 bool read_only_; | 58 bool read_only_; |
| 59 | 59 |
| 60 // Helper for safely writing pref data. | 60 // Helper for safely writing pref data. |
| 61 ImportantFileWriter writer_; | 61 ImportantFileWriter writer_; |
| 62 | 62 |
| 63 ObserverList<PrefStore::Observer, true> observers_; | 63 ObserverList<PrefStore::Observer, true> observers_; |
| 64 | 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(JsonPrefStore); | 65 DISALLOW_COPY_AND_ASSIGN(JsonPrefStore); |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 #endif // CHROME_COMMON_JSON_PREF_STORE_H_ | 68 #endif // CHROME_COMMON_JSON_PREF_STORE_H_ |
| OLD | NEW |