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

Side by Side Diff: base/prefs/persistent_pref_store.h

Issue 331433002: Pull GetMutableValue from Perisistent to WritablePrefStore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | base/prefs/value_map_pref_store.h » ('j') | base/prefs/writeable_pref_store.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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
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;
battre 2014/06/13 09:16:00 What do you think of moving this function as well?
gab 2014/06/13 14:42:34 SGTM.
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;
69 59
70 // Gets the read error. Only valid if IsInitializationComplete() returns true. 60 // Gets the read error. Only valid if IsInitializationComplete() returns true.
71 virtual PrefReadError GetReadError() const = 0; 61 virtual PrefReadError GetReadError() const = 0;
72 62
73 // Reads the preferences from disk. Notifies observers via 63 // Reads the preferences from disk. Notifies observers via
74 // "PrefStore::OnInitializationCompleted" when done. 64 // "PrefStore::OnInitializationCompleted" when done.
75 virtual PrefReadError ReadPrefs() = 0; 65 virtual PrefReadError ReadPrefs() = 0;
76 66
77 // Reads the preferences from disk asynchronously. Notifies observers via 67 // Reads the preferences from disk asynchronously. Notifies observers via
78 // "PrefStore::OnInitializationCompleted" when done. Also it fires 68 // "PrefStore::OnInitializationCompleted" when done. Also it fires
79 // |error_delegate| if it is not NULL and reading error has occurred. 69 // |error_delegate| if it is not NULL and reading error has occurred.
80 // Owns |error_delegate|. 70 // Owns |error_delegate|.
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_
OLDNEW
« no previous file with comments | « no previous file | base/prefs/value_map_pref_store.h » ('j') | base/prefs/writeable_pref_store.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698