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

Unified Diff: chrome/browser/prefs/pref_service.h

Issue 6894020: Adds async interface method to PersistentPrefStore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use Notifications. Created 9 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/prefs/pref_service.h
diff --git a/chrome/browser/prefs/pref_service.h b/chrome/browser/prefs/pref_service.h
index f9d415f3ec3e9567b575c9bdedc0d1d0ce587b5a..29d06de10711463da7a34e29ff5280509d49f028 100644
--- a/chrome/browser/prefs/pref_service.h
+++ b/chrome/browser/prefs/pref_service.h
@@ -35,13 +35,8 @@ class ScopedUserPrefUpdateBase;
class PrefService;
-class PrefServiceDelegate {
- public:
- virtual void OnPrefsLoaded(PrefService* prefs, bool success) = 0;
-};
-
class PrefService : public base::NonThreadSafe,
- public JsonPrefStore::Delegate {
+ public PrefStore::Observer {
public:
// A helper class to store all the information associated with a preference.
class Preference {
@@ -120,26 +115,19 @@ class PrefService : public base::NonThreadSafe,
DISALLOW_COPY_AND_ASSIGN(Preference);
};
- // JsonPrefStore::Delegate implementaion.
- virtual void OnPrefsRead(PersistentPrefStore::PrefReadError error,
- bool no_dir);
-
// Factory method that creates a new instance of a PrefService with the
// applicable PrefStores. The |pref_filename| points to the user preference
// file. The |profile| is the one to which these preferences apply; it may be
// NULL if we're dealing with the local state. This is the usual way to create
// a new PrefService. |extension_pref_store| is used as the source for
// extension-controlled preferences and may be NULL. The PrefService takes
- // ownership of |extension_pref_store|.
+ // ownership of |extension_pref_store|. If |async| is true, asynchronous
+ // version is used. Notifies using PREF_INITIALIZATION_COMPLETED or
+ // PREF_INITIALIZATION_FAILED in the end.
static PrefService* CreatePrefService(const FilePath& pref_filename,
PrefStore* extension_pref_store,
- Profile* profile);
-
- // Same as above, but with async initialization.
- static PrefService* CreatePrefServiceAsync(const FilePath& pref_filename,
- PrefStore* extension_pref_store,
- Profile* profile,
- PrefServiceDelegate* delegate);
+ Profile* profile,
+ bool async);
// Creates an incognito copy of the pref service that shares most pref stores
// but uses a fresh non-persistent overlay for the user pref store and an
@@ -260,8 +248,11 @@ class PrefService : public base::NonThreadSafe,
PersistentPrefStore* user_prefs,
PrefStore* recommended_platform_prefs,
PrefStore* recommended_cloud_prefs,
- DefaultPrefStore* default_store,
- PrefServiceDelegate* delegate);
+ DefaultPrefStore* default_store);
+
+ // PrefStore::Observer implementation:
+ virtual void OnPrefValueChanged(const std::string&) {}
+ virtual void OnInitializationCompleted();
// The PrefNotifier handles registering and notifying preference observers.
// It is created and owned by this PrefService. Subclasses may access it for
@@ -318,8 +309,8 @@ class PrefService : public base::NonThreadSafe,
void SetUserPrefValue(const char* path, Value* new_value);
// Load preferences from storage, attempting to diagnose and handle errors.
- // This should only be called from the constructor.
- void InitFromStorage();
+ // This should only be called right after construction.
+ void InitFromStorage(bool async);
// Used to set the value of dictionary or list values in the user pref store.
// This will create a dictionary or list if one does not exist in the user
@@ -343,10 +334,6 @@ class PrefService : public base::NonThreadSafe,
// of registered preferences are.
mutable PreferenceSet prefs_;
- // Holds delegator to be called after initialization, if async version
- // is used.
- PrefServiceDelegate* delegate_;
-
DISALLOW_COPY_AND_ASSIGN(PrefService);
};

Powered by Google App Engine
This is Rietveld 408576698