OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ | 5 #ifndef CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ |
6 #define CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ | 6 #define CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 void Initialize(PrefValueStore* store, | 145 void Initialize(PrefValueStore* store, |
146 PrefStore* pref_store, | 146 PrefStore* pref_store, |
147 PrefStoreType type); | 147 PrefStoreType type); |
148 | 148 |
149 PrefStore* store() { return pref_store_.get(); } | 149 PrefStore* store() { return pref_store_.get(); } |
150 const PrefStore* store() const { return pref_store_.get(); } | 150 const PrefStore* store() const { return pref_store_.get(); } |
151 | 151 |
152 private: | 152 private: |
153 // PrefStore::Observer implementation. | 153 // PrefStore::Observer implementation. |
154 virtual void OnPrefValueChanged(const std::string& key); | 154 virtual void OnPrefValueChanged(const std::string& key); |
155 virtual void OnInitializationCompleted(); | 155 virtual void OnInitializationCompleted(bool succeeded); |
156 | 156 |
157 // PrefValueStore this keeper is part of. | 157 // PrefValueStore this keeper is part of. |
158 PrefValueStore* pref_value_store_; | 158 PrefValueStore* pref_value_store_; |
159 | 159 |
160 // The PrefStore managed by this keeper. | 160 // The PrefStore managed by this keeper. |
161 scoped_refptr<PrefStore> pref_store_; | 161 scoped_refptr<PrefStore> pref_store_; |
162 | 162 |
163 // Type of the pref store. | 163 // Type of the pref store. |
164 PrefStoreType type_; | 164 PrefStoreType type_; |
165 | 165 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // the user-visible pref value has changed. Triggers the change notification | 204 // the user-visible pref value has changed. Triggers the change notification |
205 // if the effective value of the preference has changed, or if the store | 205 // if the effective value of the preference has changed, or if the store |
206 // controlling the pref has changed. | 206 // controlling the pref has changed. |
207 void NotifyPrefChanged(const char* path, PrefStoreType new_store); | 207 void NotifyPrefChanged(const char* path, PrefStoreType new_store); |
208 | 208 |
209 // Called from the PrefStoreKeeper implementation when a pref value for |key| | 209 // Called from the PrefStoreKeeper implementation when a pref value for |key| |
210 // changed in the pref store for |type|. | 210 // changed in the pref store for |type|. |
211 void OnPrefValueChanged(PrefStoreType type, const std::string& key); | 211 void OnPrefValueChanged(PrefStoreType type, const std::string& key); |
212 | 212 |
213 // Handle the event that the store for |type| has completed initialization. | 213 // Handle the event that the store for |type| has completed initialization. |
214 void OnInitializationCompleted(PrefStoreType type); | 214 void OnInitializationCompleted(PrefStoreType type, bool succeeded); |
215 | 215 |
216 // Initializes a pref store keeper. Sets up a PrefStoreKeeper that will take | 216 // Initializes a pref store keeper. Sets up a PrefStoreKeeper that will take |
217 // ownership of the passed |pref_store|. | 217 // ownership of the passed |pref_store|. |
218 void InitPrefStore(PrefStoreType type, PrefStore* pref_store); | 218 void InitPrefStore(PrefStoreType type, PrefStore* pref_store); |
219 | 219 |
220 // Checks whether initialization is completed and tells the notifier if that | 220 // Checks whether initialization is completed and tells the notifier if that |
221 // is the case. | 221 // is the case. |
222 void CheckInitializationCompleted(); | 222 void CheckInitializationCompleted(); |
223 | 223 |
224 // Get the PrefStore pointer for the given type. May return NULL if there is | 224 // Get the PrefStore pointer for the given type. May return NULL if there is |
(...skipping 13 matching lines...) Expand all Loading... |
238 // corresponding PrefService. | 238 // corresponding PrefService. |
239 PrefNotifier* pref_notifier_; | 239 PrefNotifier* pref_notifier_; |
240 | 240 |
241 // A mapping of preference names to their registered types. | 241 // A mapping of preference names to their registered types. |
242 PrefTypeMap pref_types_; | 242 PrefTypeMap pref_types_; |
243 | 243 |
244 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); | 244 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); |
245 }; | 245 }; |
246 | 246 |
247 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ | 247 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ |
OLD | NEW |