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

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

Issue 6905044: Refactor preference syncing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix syncing of platform specific prefs 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..f45574fcbb93e79c9d91c1928dbd053f7da9dc86 100644
--- a/chrome/browser/prefs/pref_service.h
+++ b/chrome/browser/prefs/pref_service.h
@@ -21,7 +21,7 @@ class DefaultPrefStore;
class FilePath;
class NotificationObserver;
class PersistentPrefStore;
-class PrefChangeObserver;
+class PrefModelAssociator;
class PrefNotifier;
class PrefNotifierImpl;
class PrefStore;
@@ -171,27 +171,46 @@ class PrefService : public base::NonThreadSafe,
// Lands pending writes to disk.
void CommitPendingWrite();
- // Make the PrefService aware of a pref.
- void RegisterBooleanPref(const char* path, bool default_value);
- void RegisterIntegerPref(const char* path, int default_value);
- void RegisterDoublePref(const char* path, double default_value);
- void RegisterStringPref(const char* path, const std::string& default_value);
- void RegisterFilePathPref(const char* path, const FilePath& default_value);
- void RegisterListPref(const char* path);
- void RegisterDictionaryPref(const char* path);
+ // Make the PrefService aware of a pref, and inform the Sync model associator
+ // if we want to synchronize it.
+ void RegisterBooleanPref(const char* path,
+ bool default_value,
+ bool syncable);
+ void RegisterIntegerPref(const char* path,
+ int default_value,
+ bool syncable);
+ void RegisterDoublePref(const char* path,
+ double default_value,
+ bool syncable);
+ void RegisterStringPref(const char* path,
+ const std::string& default_value,
+ bool syncable);
+ void RegisterFilePathPref(const char* path,
+ const FilePath& default_value,
+ bool syncable);
+ void RegisterListPref(const char* path, bool syncable);
+ void RegisterDictionaryPref(const char* path, bool syncable);
// These take ownership of the default_value:
- void RegisterListPref(const char* path, ListValue* default_value);
- void RegisterDictionaryPref(const char* path, DictionaryValue* default_value);
+ void RegisterListPref(const char* path,
+ ListValue* default_value,
+ bool syncable);
+ void RegisterDictionaryPref(const char* path,
+ DictionaryValue* default_value,
+ bool syncable);
// These variants use a default value from the locale dll instead.
void RegisterLocalizedBooleanPref(const char* path,
- int locale_default_message_id);
+ int locale_default_message_id,
+ bool syncable);
void RegisterLocalizedIntegerPref(const char* path,
- int locale_default_message_id);
+ int locale_default_message_id,
+ bool syncable);
void RegisterLocalizedDoublePref(const char* path,
- int locale_default_message_id);
+ int locale_default_message_id,
+ bool syncable);
void RegisterLocalizedStringPref(const char* path,
- int locale_default_message_id);
+ int locale_default_message_id,
+ bool syncable);
// If the path is valid and the value at the end of the path matches the type
// specified, it will return the specified value. Otherwise, the default
@@ -231,7 +250,7 @@ class PrefService : public base::NonThreadSafe,
// Value type will be TYPE_STRING.
void SetInt64(const char* path, int64 value);
int64 GetInt64(const char* path) const;
- void RegisterInt64Pref(const char* path, int64 default_value);
+ void RegisterInt64Pref(const char* path, int64 default_value, bool syncable);
// Returns true if a value has been set for the specified path.
// NOTE: this is NOT the same as FindPreference. In particular
@@ -311,7 +330,9 @@ class PrefService : public base::NonThreadSafe,
// NULL as it determines the preference value's type.
// RegisterPreference must not be called twice for the same path.
// This method takes ownership of |default_value|.
- void RegisterPreference(const char* path, Value* default_value);
+ void RegisterPreference(const char* path,
+ Value* default_value,
+ bool syncable);
// Sets the value for this pref path in the user pref store and informs the
// PrefNotifier of the change.
@@ -347,6 +368,9 @@ class PrefService : public base::NonThreadSafe,
// is used.
PrefServiceDelegate* delegate_;
+ // The model associator that maintains the links with the sync db.
+ scoped_refptr<PrefModelAssociator> pref_sync_associator_;
+
DISALLOW_COPY_AND_ASSIGN(PrefService);
};

Powered by Google App Engine
This is Rietveld 408576698