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

Side by Side Diff: chrome/browser/prefs/pref_value_store.h

Issue 6894020: Adds async interface method to PersistentPrefStore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 2010->2011 Created 9 years, 7 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 (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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 void Initialize(PrefValueStore* store, 148 void Initialize(PrefValueStore* store,
149 PrefStore* pref_store, 149 PrefStore* pref_store,
150 PrefStoreType type); 150 PrefStoreType type);
151 151
152 PrefStore* store() { return pref_store_.get(); } 152 PrefStore* store() { return pref_store_.get(); }
153 const PrefStore* store() const { return pref_store_.get(); } 153 const PrefStore* store() const { return pref_store_.get(); }
154 154
155 private: 155 private:
156 // PrefStore::Observer implementation. 156 // PrefStore::Observer implementation.
157 virtual void OnPrefValueChanged(const std::string& key); 157 virtual void OnPrefValueChanged(const std::string& key);
158 virtual void OnInitializationCompleted(); 158 virtual void OnInitializationCompleted(bool succeeded);
159 159
160 // PrefValueStore this keeper is part of. 160 // PrefValueStore this keeper is part of.
161 PrefValueStore* pref_value_store_; 161 PrefValueStore* pref_value_store_;
162 162
163 // The PrefStore managed by this keeper. 163 // The PrefStore managed by this keeper.
164 scoped_refptr<PrefStore> pref_store_; 164 scoped_refptr<PrefStore> pref_store_;
165 165
166 // Type of the pref store. 166 // Type of the pref store.
167 PrefStoreType type_; 167 PrefStoreType type_;
168 168
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // the user-visible pref value has changed. Triggers the change notification 207 // the user-visible pref value has changed. Triggers the change notification
208 // if the effective value of the preference has changed, or if the store 208 // if the effective value of the preference has changed, or if the store
209 // controlling the pref has changed. 209 // controlling the pref has changed.
210 void NotifyPrefChanged(const char* path, PrefStoreType new_store); 210 void NotifyPrefChanged(const char* path, PrefStoreType new_store);
211 211
212 // Called from the PrefStoreKeeper implementation when a pref value for |key| 212 // Called from the PrefStoreKeeper implementation when a pref value for |key|
213 // changed in the pref store for |type|. 213 // changed in the pref store for |type|.
214 void OnPrefValueChanged(PrefStoreType type, const std::string& key); 214 void OnPrefValueChanged(PrefStoreType type, const std::string& key);
215 215
216 // Handle the event that the store for |type| has completed initialization. 216 // Handle the event that the store for |type| has completed initialization.
217 void OnInitializationCompleted(PrefStoreType type); 217 void OnInitializationCompleted(PrefStoreType type, bool succeeded);
218 218
219 // Initializes a pref store keeper. Sets up a PrefStoreKeeper that will take 219 // Initializes a pref store keeper. Sets up a PrefStoreKeeper that will take
220 // ownership of the passed |pref_store|. 220 // ownership of the passed |pref_store|.
221 void InitPrefStore(PrefStoreType type, PrefStore* pref_store); 221 void InitPrefStore(PrefStoreType type, PrefStore* pref_store);
222 222
223 // Checks whether initialization is completed and tells the notifier if that 223 // Checks whether initialization is completed and tells the notifier if that
224 // is the case. 224 // is the case.
225 void CheckInitializationCompleted(); 225 void CheckInitializationCompleted();
226 226
227 // Get the PrefStore pointer for the given type. May return NULL if there is 227 // Get the PrefStore pointer for the given type. May return NULL if there is
(...skipping 12 matching lines...) Expand all
240 PrefModelAssociator* pref_sync_associator_; 240 PrefModelAssociator* pref_sync_associator_;
241 241
242 // Used for generating PREF_CHANGED and PREF_INITIALIZATION_COMPLETED 242 // Used for generating PREF_CHANGED and PREF_INITIALIZATION_COMPLETED
243 // notifications. This is a weak reference, since the notifier is owned by the 243 // notifications. This is a weak reference, since the notifier is owned by the
244 // corresponding PrefService. 244 // corresponding PrefService.
245 PrefNotifier* pref_notifier_; 245 PrefNotifier* pref_notifier_;
246 246
247 // A mapping of preference names to their registered types. 247 // A mapping of preference names to their registered types.
248 PrefTypeMap pref_types_; 248 PrefTypeMap pref_types_;
249 249
250 // True if not all of the PrefStores were initialized successfully.
251 bool initialization_failed_;
252
250 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); 253 DISALLOW_COPY_AND_ASSIGN(PrefValueStore);
251 }; 254 };
252 255
253 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ 256 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_service_mock_builder.cc ('k') | chrome/browser/prefs/pref_value_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698