Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Side by Side Diff: chrome/common/persistent_pref_store.h

Issue 10055003: Keep emtpy List/Dictionary pref value with non-empty default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 the |key| with empty ListValue/DictionaryValue need to be persisted.
battre 2012/04/11 21:55:51 grammar: the |key| (singular) vs. need (plural) M
xiyuan 2012/04/11 22:36:46 Done.
69 virtual void MarkNeedsEmptyValue(const std::string& key) = 0;
70
68 // Whether the store is in a pseudo-read-only mode where changes are not 71 // 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 72 // actually persisted to disk. This happens in some cases when there are
70 // read errors during startup. 73 // read errors during startup.
71 virtual bool ReadOnly() const = 0; 74 virtual bool ReadOnly() const = 0;
72 75
73 // Gets the read error. Only valid if IsInitializationComplete() returns true. 76 // Gets the read error. Only valid if IsInitializationComplete() returns true.
74 virtual PrefReadError GetReadError() const = 0; 77 virtual PrefReadError GetReadError() const = 0;
75 78
76 // Reads the preferences from disk. Notifies observers via 79 // Reads the preferences from disk. Notifies observers via
77 // "PrefStore::OnInitializationCompleted" when done. 80 // "PrefStore::OnInitializationCompleted" when done.
78 virtual PrefReadError ReadPrefs() = 0; 81 virtual PrefReadError ReadPrefs() = 0;
79 82
80 // Reads the preferences from disk asynchronously. Notifies observers via 83 // Reads the preferences from disk asynchronously. Notifies observers via
81 // "PrefStore::OnInitializationCompleted" when done. Also it fires 84 // "PrefStore::OnInitializationCompleted" when done. Also it fires
82 // |error_delegate| if it is not NULL and reading error has occurred. 85 // |error_delegate| if it is not NULL and reading error has occurred.
83 // Owns |error_delegate|. 86 // Owns |error_delegate|.
84 virtual void ReadPrefsAsync(ReadErrorDelegate* error_delegate) = 0; 87 virtual void ReadPrefsAsync(ReadErrorDelegate* error_delegate) = 0;
85 88
86 // Lands any pending writes to disk. 89 // Lands any pending writes to disk.
87 virtual void CommitPendingWrite() = 0; 90 virtual void CommitPendingWrite() = 0;
88 }; 91 };
89 92
90 #endif // CHROME_COMMON_PERSISTENT_PREF_STORE_H_ 93 #endif // CHROME_COMMON_PERSISTENT_PREF_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698