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 28 matching lines...) Expand all Loading... |
39 PREF_READ_ERROR_MAX_ENUM | 39 PREF_READ_ERROR_MAX_ENUM |
40 }; | 40 }; |
41 | 41 |
42 class ReadErrorDelegate { | 42 class ReadErrorDelegate { |
43 public: | 43 public: |
44 virtual ~ReadErrorDelegate() {} | 44 virtual ~ReadErrorDelegate() {} |
45 | 45 |
46 virtual void OnError(PrefReadError error) = 0; | 46 virtual void OnError(PrefReadError error) = 0; |
47 }; | 47 }; |
48 | 48 |
49 // Equivalent to PrefStore::GetValue but returns a mutable value. | |
50 virtual bool GetMutableValue(const std::string& key, | |
51 base::Value** result) = 0; | |
52 | |
53 // Triggers a value changed notification. This function needs to be called | |
54 // if one retrieves a list or dictionary with GetMutableValue and change its | |
55 // value. SetValue takes care of notifications itself. Note that | |
56 // ReportValueChanged will trigger notifications even if nothing has changed. | |
57 virtual void ReportValueChanged(const std::string& key) = 0; | |
58 | |
59 // Same as SetValue, but doesn't generate notifications. This is used by | 49 // Same as SetValue, but doesn't generate notifications. This is used by |
60 // PrefService::GetMutableUserPref() in order to put empty entries | 50 // PrefService::GetMutableUserPref() in order to put empty entries |
61 // into the user pref store. Using SetValue is not an option since existing | 51 // into the user pref store. Using SetValue is not an option since existing |
62 // tests rely on the number of notifications generated. | 52 // tests rely on the number of notifications generated. |
63 virtual void SetValueSilently(const std::string& key, base::Value* value) = 0; | 53 virtual void SetValueSilently(const std::string& key, base::Value* value) = 0; |
64 | 54 |
65 // Whether the store is in a pseudo-read-only mode where changes are not | 55 // Whether the store is in a pseudo-read-only mode where changes are not |
66 // actually persisted to disk. This happens in some cases when there are | 56 // actually persisted to disk. This happens in some cases when there are |
67 // read errors during startup. | 57 // read errors during startup. |
68 virtual bool ReadOnly() const = 0; | 58 virtual bool ReadOnly() const = 0; |
(...skipping 12 matching lines...) Expand all Loading... |
81 virtual void ReadPrefsAsync(ReadErrorDelegate* error_delegate) = 0; | 71 virtual void ReadPrefsAsync(ReadErrorDelegate* error_delegate) = 0; |
82 | 72 |
83 // Lands any pending writes to disk. | 73 // Lands any pending writes to disk. |
84 virtual void CommitPendingWrite() = 0; | 74 virtual void CommitPendingWrite() = 0; |
85 | 75 |
86 protected: | 76 protected: |
87 virtual ~PersistentPrefStore() {} | 77 virtual ~PersistentPrefStore() {} |
88 }; | 78 }; |
89 | 79 |
90 #endif // BASE_PREFS_PERSISTENT_PREF_STORE_H_ | 80 #endif // BASE_PREFS_PERSISTENT_PREF_STORE_H_ |
OLD | NEW |