OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 BASE_PREFS_PERSISTENT_PREF_STORE_H_ | 5 #ifndef BASE_PREFS_PERSISTENT_PREF_STORE_H_ |
6 #define BASE_PREFS_PERSISTENT_PREF_STORE_H_ | 6 #define BASE_PREFS_PERSISTENT_PREF_STORE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/prefs/base_prefs_export.h" | 10 #include "base/prefs/base_prefs_export.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 }; | 34 }; |
35 | 35 |
36 class ReadErrorDelegate { | 36 class ReadErrorDelegate { |
37 public: | 37 public: |
38 virtual ~ReadErrorDelegate() {} | 38 virtual ~ReadErrorDelegate() {} |
39 | 39 |
40 virtual void OnError(PrefReadError error) = 0; | 40 virtual void OnError(PrefReadError error) = 0; |
41 }; | 41 }; |
42 | 42 |
43 // Equivalent to PrefStore::GetValue but returns a mutable value. | 43 // Equivalent to PrefStore::GetValue but returns a mutable value. |
44 virtual ReadResult GetMutableValue(const std::string& key, | 44 virtual bool GetMutableValue(const std::string& key, |
45 base::Value** result) = 0; | 45 base::Value** result) = 0; |
46 | 46 |
47 // Triggers a value changed notification. This function needs to be called | 47 // Triggers a value changed notification. This function needs to be called |
48 // if one retrieves a list or dictionary with GetMutableValue and change its | 48 // if one retrieves a list or dictionary with GetMutableValue and change its |
49 // value. SetValue takes care of notifications itself. Note that | 49 // value. SetValue takes care of notifications itself. Note that |
50 // ReportValueChanged will trigger notifications even if nothing has changed. | 50 // ReportValueChanged will trigger notifications even if nothing has changed. |
51 virtual void ReportValueChanged(const std::string& key) = 0; | 51 virtual void ReportValueChanged(const std::string& key) = 0; |
52 | 52 |
53 // Sets a |value| for |key| in the store. Assumes ownership of |value|, which | 53 // Sets a |value| for |key| in the store. Assumes ownership of |value|, which |
54 // must be non-NULL. | 54 // must be non-NULL. |
55 virtual void SetValue(const std::string& key, base::Value* value) = 0; | 55 virtual void SetValue(const std::string& key, base::Value* value) = 0; |
(...skipping 30 matching lines...) Expand all Loading... |
86 virtual void ReadPrefsAsync(ReadErrorDelegate* error_delegate) = 0; | 86 virtual void ReadPrefsAsync(ReadErrorDelegate* error_delegate) = 0; |
87 | 87 |
88 // Lands any pending writes to disk. | 88 // Lands any pending writes to disk. |
89 virtual void CommitPendingWrite() = 0; | 89 virtual void CommitPendingWrite() = 0; |
90 | 90 |
91 protected: | 91 protected: |
92 virtual ~PersistentPrefStore() {} | 92 virtual ~PersistentPrefStore() {} |
93 }; | 93 }; |
94 | 94 |
95 #endif // BASE_PREFS_PERSISTENT_PREF_STORE_H_ | 95 #endif // BASE_PREFS_PERSISTENT_PREF_STORE_H_ |
OLD | NEW |