win: Make asan work with isolates.
[chromium-blink-merge.git] / base / prefs / writeable_pref_store.h
blob5ebab6428235015fdf8e5f29f8bd6311bd0da56c
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
3 // found in the LICENSE file.
5 #ifndef BASE_PREFS_WRITEABLE_PREF_STORE_H_
6 #define BASE_PREFS_WRITEABLE_PREF_STORE_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/prefs/pref_store.h"
13 namespace base {
14 class Value;
17 // A pref store that can be written to as well as read from.
18 class BASE_PREFS_EXPORT WriteablePrefStore : public PrefStore {
19 public:
20 WriteablePrefStore() {}
22 // Sets a |value| for |key| in the store. Assumes ownership of |value|, which
23 // must be non-NULL.
24 virtual void SetValue(const std::string& key, base::Value* value) = 0;
26 // Removes the value for |key|.
27 virtual void RemoveValue(const std::string& key) = 0;
29 // Equivalent to PrefStore::GetValue but returns a mutable value.
30 virtual bool GetMutableValue(const std::string& key,
31 base::Value** result) = 0;
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;
39 // Same as SetValue, but doesn't generate notifications. This is used by
40 // PrefService::GetMutableUserPref() in order to put empty entries
41 // into the user pref store. Using SetValue is not an option since existing
42 // tests rely on the number of notifications generated.
43 virtual void SetValueSilently(const std::string& key, base::Value* value) = 0;
45 protected:
46 ~WriteablePrefStore() override {}
48 private:
49 DISALLOW_COPY_AND_ASSIGN(WriteablePrefStore);
52 #endif // BASE_PREFS_WRITEABLE_PREF_STORE_H_