OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PERSISTENT_PREF_STORE_H_ | 5 #ifndef CHROME_COMMON_PERSISTENT_PREF_STORE_H_ |
6 #define CHROME_COMMON_PERSISTENT_PREF_STORE_H_ | 6 #define CHROME_COMMON_PERSISTENT_PREF_STORE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 class ReadErrorDelegate { | 37 class ReadErrorDelegate { |
38 public: | 38 public: |
39 virtual ~ReadErrorDelegate() {} | 39 virtual ~ReadErrorDelegate() {} |
40 | 40 |
41 virtual void OnError(PrefReadError error) = 0; | 41 virtual void OnError(PrefReadError error) = 0; |
42 }; | 42 }; |
43 | 43 |
44 // Equivalent to PrefStore::GetValue but returns a mutable value. | 44 // Equivalent to PrefStore::GetValue but returns a mutable value. |
45 virtual ReadResult GetMutableValue(const std::string& key, | 45 virtual ReadResult GetMutableValue(const std::string& key, |
46 Value** result) = 0; | 46 base::Value** result) = 0; |
47 | 47 |
48 // Triggers a value changed notification. This function needs to be called | 48 // Triggers a value changed notification. This function needs to be called |
49 // if one retrieves a list or dictionary with GetMutableValue and change its | 49 // if one retrieves a list or dictionary with GetMutableValue and change its |
50 // value. SetValue takes care of notifications itself. Note that | 50 // value. SetValue takes care of notifications itself. Note that |
51 // ReportValueChanged will trigger notifications even if nothing has changed. | 51 // ReportValueChanged will trigger notifications even if nothing has changed. |
52 virtual void ReportValueChanged(const std::string& key) = 0; | 52 virtual void ReportValueChanged(const std::string& key) = 0; |
53 | 53 |
54 // Sets a |value| for |key| in the store. Assumes ownership of |value|, which | 54 // Sets a |value| for |key| in the store. Assumes ownership of |value|, which |
55 // must be non-NULL. | 55 // must be non-NULL. |
56 virtual void SetValue(const std::string& key, Value* value) = 0; | 56 virtual void SetValue(const std::string& key, base::Value* value) = 0; |
57 | 57 |
58 // Same as SetValue, but doesn't generate notifications. This is used by | 58 // Same as SetValue, but doesn't generate notifications. This is used by |
59 // PrefService::GetMutableUserPref() in order to put empty entries | 59 // PrefService::GetMutableUserPref() in order to put empty entries |
60 // into the user pref store. Using SetValue is not an option since existing | 60 // into the user pref store. Using SetValue is not an option since existing |
61 // tests rely on the number of notifications generated. | 61 // tests rely on the number of notifications generated. |
62 virtual void SetValueSilently(const std::string& key, Value* value) = 0; | 62 virtual void SetValueSilently(const std::string& key, base::Value* value) = 0; |
63 | 63 |
64 // Removes the value for |key|. | 64 // Removes the value for |key|. |
65 virtual void RemoveValue(const std::string& key) = 0; | 65 virtual void RemoveValue(const std::string& key) = 0; |
66 | 66 |
67 // Whether the store is in a pseudo-read-only mode where changes are not | 67 // Whether the store is in a pseudo-read-only mode where changes are not |
68 // actually persisted to disk. This happens in some cases when there are | 68 // actually persisted to disk. This happens in some cases when there are |
69 // read errors during startup. | 69 // read errors during startup. |
70 virtual bool ReadOnly() const = 0; | 70 virtual bool ReadOnly() const = 0; |
71 | 71 |
72 // Reads the preferences from disk. Notifies observers via | 72 // Reads the preferences from disk. Notifies observers via |
(...skipping 10 matching lines...) Expand all Loading... |
83 virtual bool WritePrefs() = 0; | 83 virtual bool WritePrefs() = 0; |
84 | 84 |
85 // Schedules an asynchronous write operation. | 85 // Schedules an asynchronous write operation. |
86 virtual void ScheduleWritePrefs() = 0; | 86 virtual void ScheduleWritePrefs() = 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 | 91 |
92 #endif // CHROME_COMMON_PERSISTENT_PREF_STORE_H_ | 92 #endif // CHROME_COMMON_PERSISTENT_PREF_STORE_H_ |
OLD | NEW |