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 BASE_PREFS_OVERLAY_USER_PREF_STORE_H_ | 5 #ifndef BASE_PREFS_OVERLAY_USER_PREF_STORE_H_ |
6 #define BASE_PREFS_OVERLAY_USER_PREF_STORE_H_ | 6 #define BASE_PREFS_OVERLAY_USER_PREF_STORE_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <map> | 10 #include <map> |
9 #include <string> | 11 #include <string> |
10 | 12 |
11 #include "base/basictypes.h" | 13 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
13 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
14 #include "base/prefs/base_prefs_export.h" | 16 #include "base/prefs/base_prefs_export.h" |
15 #include "base/prefs/persistent_pref_store.h" | 17 #include "base/prefs/persistent_pref_store.h" |
16 #include "base/prefs/pref_value_map.h" | 18 #include "base/prefs/pref_value_map.h" |
17 | 19 |
18 // PersistentPrefStore that directs all write operations into an in-memory | 20 // PersistentPrefStore that directs all write operations into an in-memory |
19 // PrefValueMap. Read operations are first answered by the PrefValueMap. | 21 // PrefValueMap. Read operations are first answered by the PrefValueMap. |
20 // If the PrefValueMap does not contain a value for the requested key, | 22 // If the PrefValueMap does not contain a value for the requested key, |
21 // the look-up is passed on to an underlying PersistentPrefStore |underlay_|. | 23 // the look-up is passed on to an underlying PersistentPrefStore |underlay_|. |
(...skipping 12 matching lines...) Expand all Loading... |
34 void RemoveObserver(PrefStore::Observer* observer) override; | 36 void RemoveObserver(PrefStore::Observer* observer) override; |
35 bool HasObservers() const override; | 37 bool HasObservers() const override; |
36 bool IsInitializationComplete() const override; | 38 bool IsInitializationComplete() const override; |
37 bool GetValue(const std::string& key, | 39 bool GetValue(const std::string& key, |
38 const base::Value** result) const override; | 40 const base::Value** result) const override; |
39 | 41 |
40 // Methods of PersistentPrefStore. | 42 // Methods of PersistentPrefStore. |
41 bool GetMutableValue(const std::string& key, base::Value** result) override; | 43 bool GetMutableValue(const std::string& key, base::Value** result) override; |
42 void SetValue(const std::string& key, | 44 void SetValue(const std::string& key, |
43 scoped_ptr<base::Value> value, | 45 scoped_ptr<base::Value> value, |
44 uint32 flags) override; | 46 uint32_t flags) override; |
45 void SetValueSilently(const std::string& key, | 47 void SetValueSilently(const std::string& key, |
46 scoped_ptr<base::Value> value, | 48 scoped_ptr<base::Value> value, |
47 uint32 flags) override; | 49 uint32_t flags) override; |
48 void RemoveValue(const std::string& key, uint32 flags) override; | 50 void RemoveValue(const std::string& key, uint32_t flags) override; |
49 bool ReadOnly() const override; | 51 bool ReadOnly() const override; |
50 PrefReadError GetReadError() const override; | 52 PrefReadError GetReadError() const override; |
51 PrefReadError ReadPrefs() override; | 53 PrefReadError ReadPrefs() override; |
52 void ReadPrefsAsync(ReadErrorDelegate* delegate) override; | 54 void ReadPrefsAsync(ReadErrorDelegate* delegate) override; |
53 void CommitPendingWrite() override; | 55 void CommitPendingWrite() override; |
54 void SchedulePendingLossyWrites() override; | 56 void SchedulePendingLossyWrites() override; |
55 void ReportValueChanged(const std::string& key, uint32 flags) override; | 57 void ReportValueChanged(const std::string& key, uint32_t flags) override; |
56 | 58 |
57 // Methods of PrefStore::Observer. | 59 // Methods of PrefStore::Observer. |
58 void OnPrefValueChanged(const std::string& key) override; | 60 void OnPrefValueChanged(const std::string& key) override; |
59 void OnInitializationCompleted(bool succeeded) override; | 61 void OnInitializationCompleted(bool succeeded) override; |
60 | 62 |
61 void RegisterOverlayPref(const std::string& key); | 63 void RegisterOverlayPref(const std::string& key); |
62 void RegisterOverlayPref(const std::string& overlay_key, | 64 void RegisterOverlayPref(const std::string& overlay_key, |
63 const std::string& underlay_key); | 65 const std::string& underlay_key); |
64 | 66 |
65 protected: | 67 protected: |
(...skipping 12 matching lines...) Expand all Loading... |
78 base::ObserverList<PrefStore::Observer, true> observers_; | 80 base::ObserverList<PrefStore::Observer, true> observers_; |
79 PrefValueMap overlay_; | 81 PrefValueMap overlay_; |
80 scoped_refptr<PersistentPrefStore> underlay_; | 82 scoped_refptr<PersistentPrefStore> underlay_; |
81 NamesMap overlay_to_underlay_names_map_; | 83 NamesMap overlay_to_underlay_names_map_; |
82 NamesMap underlay_to_overlay_names_map_; | 84 NamesMap underlay_to_overlay_names_map_; |
83 | 85 |
84 DISALLOW_COPY_AND_ASSIGN(OverlayUserPrefStore); | 86 DISALLOW_COPY_AND_ASSIGN(OverlayUserPrefStore); |
85 }; | 87 }; |
86 | 88 |
87 #endif // BASE_PREFS_OVERLAY_USER_PREF_STORE_H_ | 89 #endif // BASE_PREFS_OVERLAY_USER_PREF_STORE_H_ |
OLD | NEW |