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

Side by Side Diff: base/prefs/writeable_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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_WRITEABLE_PREF_STORE_H_ 5 #ifndef BASE_PREFS_WRITEABLE_PREF_STORE_H_
6 #define BASE_PREFS_WRITEABLE_PREF_STORE_H_ 6 #define BASE_PREFS_WRITEABLE_PREF_STORE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/prefs/pref_store.h" 11 #include "base/prefs/pref_store.h"
12 12
13 namespace base { 13 namespace base {
14 class Value; 14 class Value;
15 } 15 }
16 16
17 // A pref store that can be written to as well as read from. 17 // A pref store that can be written to as well as read from.
18 class BASE_PREFS_EXPORT WriteablePrefStore : public PrefStore { 18 class BASE_PREFS_EXPORT WriteablePrefStore : public PrefStore {
19 public: 19 public:
20 WriteablePrefStore() {} 20 WriteablePrefStore() {}
21 21
22 // Sets a |value| for |key| in the store. Assumes ownership of |value|, which 22 // Sets a |value| for |key| in the store. Assumes ownership of |value|, which
23 // must be non-NULL. 23 // must be non-NULL.
24 virtual void SetValue(const std::string& key, base::Value* value) = 0; 24 virtual void SetValue(const std::string& key, base::Value* value) = 0;
25 25
26 // Removes the value for |key|. 26 // Removes the value for |key|.
27 virtual void RemoveValue(const std::string& key) = 0; 27 virtual void RemoveValue(const std::string& key) = 0;
28 28
29 // Equivalent to PrefStore::GetValue but returns a mutable value.
30 virtual bool GetMutableValue(const std::string& key,
31 base::Value** result) = 0;
32
33 // Triggers a value changed notification. This function needs to be called
34 // if one retrieves a list or dictionary with GetMutableValue and change its
35 // value. SetValue takes care of notifications itself. Note that
36 // ReportValueChanged will trigger notifications even if nothing has changed.
37 virtual void ReportValueChanged(const std::string& key) = 0;
38
39
battre 2014/06/13 09:16:00 Nit: one blank line too much.
29 protected: 40 protected:
30 virtual ~WriteablePrefStore() {} 41 virtual ~WriteablePrefStore() {}
31 42
32 private: 43 private:
33 DISALLOW_COPY_AND_ASSIGN(WriteablePrefStore); 44 DISALLOW_COPY_AND_ASSIGN(WriteablePrefStore);
34 }; 45 };
35 46
36 #endif // BASE_PREFS_WRITEABLE_PREF_STORE_H_ 47 #endif // BASE_PREFS_WRITEABLE_PREF_STORE_H_
OLDNEW
« base/prefs/persistent_pref_store.h ('K') | « base/prefs/value_map_pref_store.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698