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

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

Issue 12079097: Introduce PrefRegistrySyncable, simplifying PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add to PrefRegistrySyncable and PrefServiceSyncable to let sync know of pre-registered prefs. Created 7 years, 10 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_syncable.h
diff --git a/chrome/browser/prefs/pref_service_syncable.h b/chrome/browser/prefs/pref_service_syncable.h
index 3df6a0a83cb221bef644be38d83e1ad74288330c..5d317fc0cfd3f49904faf322145ecaaf052ea5a8 100644
--- a/chrome/browser/prefs/pref_service_syncable.h
+++ b/chrome/browser/prefs/pref_service_syncable.h
@@ -8,7 +8,9 @@
#include "chrome/browser/prefs/pref_model_associator.h"
#include "chrome/browser/prefs/pref_service.h"
+class PrefRegistrySyncable;
class PrefServiceSyncableObserver;
+class Profile;
namespace syncer {
class SyncableService;
@@ -19,13 +21,12 @@ class SyncableService;
// this PrefService.
class PrefServiceSyncable : public PrefService {
public:
- // Enum used when registering preferences to determine if it should be synced
- // or not. This is only used for profile prefs, not local state prefs.
- // See the Register*Pref methods for profile prefs below.
- enum PrefSyncStatus {
- UNSYNCABLE_PREF,
- SYNCABLE_PREF
- };
+ // PrefServiceSyncable is primarily an implementation detail of
Mattias Nissler (ping if slow) 2013/02/06 17:53:33 Can you elaborate on the "primarily"? I thought th
Jói 2013/02/07 14:52:32 Anyone who needs to know about the sync integratio
Mattias Nissler (ping if slow) 2013/02/08 11:26:56 Thanks!
+ // profile and the sync mechanism, so Profile does not expose an
+ // accessor for it. Instead, you can use these accessors to retrieve
+ // the PrefServiceSyncable (or its incognito version) from a Profile.
+ static PrefServiceSyncable* FromProfile(Profile* profile);
+ static PrefServiceSyncable* IncognitoFromProfile(Profile* profile);
// You may wish to use PrefServiceBuilder or one of its subclasses
// for simplified construction.
@@ -33,7 +34,7 @@ class PrefServiceSyncable : public PrefService {
PrefNotifierImpl* pref_notifier,
PrefValueStore* pref_value_store,
PersistentPrefStore* user_prefs,
- PrefRegistry* pref_registry,
+ PrefRegistrySyncable* pref_registry,
base::Callback<void(PersistentPrefStore::PrefReadError)>
read_error_callback,
bool async);
@@ -55,52 +56,6 @@ class PrefServiceSyncable : public PrefService {
void AddObserver(PrefServiceSyncableObserver* observer);
void RemoveObserver(PrefServiceSyncableObserver* observer);
- void RegisterBooleanPref(const char* path,
- bool default_value,
- PrefSyncStatus sync_status);
- void RegisterIntegerPref(const char* path,
- int default_value,
- PrefSyncStatus sync_status);
- void RegisterDoublePref(const char* path,
- double default_value,
- PrefSyncStatus sync_status);
- void RegisterStringPref(const char* path,
- const std::string& default_value,
- PrefSyncStatus sync_status);
- void RegisterFilePathPref(const char* path,
- const base::FilePath& default_value,
- PrefSyncStatus sync_status);
- void RegisterListPref(const char* path,
- PrefSyncStatus sync_status);
- void RegisterDictionaryPref(const char* path,
- PrefSyncStatus sync_status);
- void RegisterListPref(const char* path,
- base::ListValue* default_value,
- PrefSyncStatus sync_status);
- void RegisterDictionaryPref(const char* path,
- base::DictionaryValue* default_value,
- PrefSyncStatus sync_status);
- void RegisterLocalizedBooleanPref(const char* path,
- int locale_default_message_id,
- PrefSyncStatus sync_status);
- void RegisterLocalizedIntegerPref(const char* path,
- int locale_default_message_id,
- PrefSyncStatus sync_status);
- void RegisterLocalizedDoublePref(const char* path,
- int locale_default_message_id,
- PrefSyncStatus sync_status);
- void RegisterLocalizedStringPref(const char* path,
- int locale_default_message_id,
- PrefSyncStatus sync_status);
- void RegisterInt64Pref(const char* path,
- int64 default_value,
- PrefSyncStatus sync_status);
- void RegisterUint64Pref(const char* path,
- uint64 default_value,
- PrefSyncStatus sync_status);
-
- void UnregisterPreference(const char* path);
-
// TODO(zea): Have PrefServiceSyncable implement
// syncer::SyncableService directly.
syncer::SyncableService* GetSyncableService();
@@ -111,16 +66,12 @@ class PrefServiceSyncable : public PrefService {
private:
friend class PrefModelAssociator;
+ void AddRegisteredSyncablePreference(const char* path);
+ virtual void RemoveRegisteredPreference(const char* path) OVERRIDE;
+
// Invoked internally when the IsSyncing() state changes.
void OnIsSyncingChanged();
- // Registers a preference at |path| with |default_value|. If the
- // preference is syncable per |sync_status|, also registers it with
- // PrefModelAssociator.
- void RegisterSyncablePreference(const char* path,
- Value* default_value,
- PrefSyncStatus sync_status);
-
// Whether CreateIncognitoPrefService() has been called to create a
// "forked" PrefService.
bool pref_service_forked_;

Powered by Google App Engine
This is Rietveld 408576698