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