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 <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 uint32 flags) override; | 44 uint32 flags) override; |
45 void SetValueSilently(const std::string& key, | 45 void SetValueSilently(const std::string& key, |
46 base::Value* value, | 46 base::Value* value, |
47 uint32 flags) override; | 47 uint32 flags) override; |
48 void RemoveValue(const std::string& key, uint32 flags) override; | 48 void RemoveValue(const std::string& key, uint32 flags) override; |
49 bool ReadOnly() const override; | 49 bool ReadOnly() const override; |
50 PrefReadError GetReadError() const override; | 50 PrefReadError GetReadError() const override; |
51 PrefReadError ReadPrefs() override; | 51 PrefReadError ReadPrefs() override; |
52 void ReadPrefsAsync(ReadErrorDelegate* delegate) override; | 52 void ReadPrefsAsync(ReadErrorDelegate* delegate) override; |
53 void CommitPendingWrite() override; | 53 void CommitPendingWrite() override; |
| 54 void SchedulePendingLossyWrites() override; |
54 void ReportValueChanged(const std::string& key, uint32 flags) override; | 55 void ReportValueChanged(const std::string& key, uint32 flags) override; |
55 | 56 |
56 // Methods of PrefStore::Observer. | 57 // Methods of PrefStore::Observer. |
57 void OnPrefValueChanged(const std::string& key) override; | 58 void OnPrefValueChanged(const std::string& key) override; |
58 void OnInitializationCompleted(bool succeeded) override; | 59 void OnInitializationCompleted(bool succeeded) override; |
59 | 60 |
60 void RegisterOverlayPref(const std::string& key); | 61 void RegisterOverlayPref(const std::string& key); |
61 void RegisterOverlayPref(const std::string& overlay_key, | 62 void RegisterOverlayPref(const std::string& overlay_key, |
62 const std::string& underlay_key); | 63 const std::string& underlay_key); |
63 | 64 |
64 protected: | 65 protected: |
65 ~OverlayUserPrefStore() override; | 66 ~OverlayUserPrefStore() override; |
66 | 67 |
67 private: | 68 private: |
68 typedef std::map<std::string, std::string> NamesMap; | 69 typedef std::map<std::string, std::string> NamesMap; |
69 | 70 |
70 const std::string& GetOverlayKey(const std::string& underlay_key) const; | 71 const std::string& GetOverlayKey(const std::string& underlay_key) const; |
71 const std::string& GetUnderlayKey(const std::string& overlay_key) const; | 72 const std::string& GetUnderlayKey(const std::string& overlay_key) const; |
72 | 73 |
73 // Returns true if |key| corresponds to a preference that shall be stored in | 74 // Returns true if |key| corresponds to a preference that shall be stored in |
74 // an in-memory PrefStore that is not persisted to disk. | 75 // an in-memory PrefStore that is not persisted to disk. |
75 bool ShallBeStoredInOverlay(const std::string& key) const; | 76 bool ShallBeStoredInOverlay(const std::string& key) const; |
76 | 77 |
77 ObserverList<PrefStore::Observer, true> observers_; | 78 base::ObserverList<PrefStore::Observer, true> observers_; |
78 PrefValueMap overlay_; | 79 PrefValueMap overlay_; |
79 scoped_refptr<PersistentPrefStore> underlay_; | 80 scoped_refptr<PersistentPrefStore> underlay_; |
80 NamesMap overlay_to_underlay_names_map_; | 81 NamesMap overlay_to_underlay_names_map_; |
81 NamesMap underlay_to_overlay_names_map_; | 82 NamesMap underlay_to_overlay_names_map_; |
82 | 83 |
83 DISALLOW_COPY_AND_ASSIGN(OverlayUserPrefStore); | 84 DISALLOW_COPY_AND_ASSIGN(OverlayUserPrefStore); |
84 }; | 85 }; |
85 | 86 |
86 #endif // BASE_PREFS_OVERLAY_USER_PREF_STORE_H_ | 87 #endif // BASE_PREFS_OVERLAY_USER_PREF_STORE_H_ |
OLD | NEW |