| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 // Same as SetValue, but doesn't generate notifications. This is used by | 57 // Same as SetValue, but doesn't generate notifications. This is used by |
| 58 // PrefService::GetMutableUserPref() in order to put empty entries | 58 // PrefService::GetMutableUserPref() in order to put empty entries |
| 59 // into the user pref store. Using SetValue is not an option since existing | 59 // into the user pref store. Using SetValue is not an option since existing |
| 60 // tests rely on the number of notifications generated. | 60 // tests rely on the number of notifications generated. |
| 61 virtual void SetValueSilently(const std::string& key, base::Value* value) = 0; | 61 virtual void SetValueSilently(const std::string& key, base::Value* value) = 0; |
| 62 | 62 |
| 63 // Removes the value for |key|. | 63 // Removes the value for |key|. |
| 64 virtual void RemoveValue(const std::string& key) = 0; | 64 virtual void RemoveValue(const std::string& key) = 0; |
| 65 | 65 |
| 66 // Marks that the |key| with empty ListValue/DictionaryValue needs to be | |
| 67 // persisted. | |
| 68 virtual void MarkNeedsEmptyValue(const std::string& key) = 0; | |
| 69 | |
| 70 // Whether the store is in a pseudo-read-only mode where changes are not | 66 // Whether the store is in a pseudo-read-only mode where changes are not |
| 71 // actually persisted to disk. This happens in some cases when there are | 67 // actually persisted to disk. This happens in some cases when there are |
| 72 // read errors during startup. | 68 // read errors during startup. |
| 73 virtual bool ReadOnly() const = 0; | 69 virtual bool ReadOnly() const = 0; |
| 74 | 70 |
| 75 // Gets the read error. Only valid if IsInitializationComplete() returns true. | 71 // Gets the read error. Only valid if IsInitializationComplete() returns true. |
| 76 virtual PrefReadError GetReadError() const = 0; | 72 virtual PrefReadError GetReadError() const = 0; |
| 77 | 73 |
| 78 // Reads the preferences from disk. Notifies observers via | 74 // Reads the preferences from disk. Notifies observers via |
| 79 // "PrefStore::OnInitializationCompleted" when done. | 75 // "PrefStore::OnInitializationCompleted" when done. |
| 80 virtual PrefReadError ReadPrefs() = 0; | 76 virtual PrefReadError ReadPrefs() = 0; |
| 81 | 77 |
| 82 // Reads the preferences from disk asynchronously. Notifies observers via | 78 // Reads the preferences from disk asynchronously. Notifies observers via |
| 83 // "PrefStore::OnInitializationCompleted" when done. Also it fires | 79 // "PrefStore::OnInitializationCompleted" when done. Also it fires |
| 84 // |error_delegate| if it is not NULL and reading error has occurred. | 80 // |error_delegate| if it is not NULL and reading error has occurred. |
| 85 // Owns |error_delegate|. | 81 // Owns |error_delegate|. |
| 86 virtual void ReadPrefsAsync(ReadErrorDelegate* error_delegate) = 0; | 82 virtual void ReadPrefsAsync(ReadErrorDelegate* error_delegate) = 0; |
| 87 | 83 |
| 88 // Lands any pending writes to disk. | 84 // Lands any pending writes to disk. |
| 89 virtual void CommitPendingWrite() = 0; | 85 virtual void CommitPendingWrite() = 0; |
| 90 | 86 |
| 91 protected: | 87 protected: |
| 92 virtual ~PersistentPrefStore() {} | 88 virtual ~PersistentPrefStore() {} |
| 93 }; | 89 }; |
| 94 | 90 |
| 95 #endif // BASE_PREFS_PERSISTENT_PREF_STORE_H_ | 91 #endif // BASE_PREFS_PERSISTENT_PREF_STORE_H_ |
| OLD | NEW |