Preferences are a generic system for storing configuration parameters in Chrome, see Preferences and chrome/browser/prefs/README.md.
Individual preferences may be declared as syncable, meaning they will be uploaded to the user's Google Account and propagate across signed-in/syncing devices from the same user.
This folder contains the code for synchronizing preferences. See components/sync/README.md for background about Sync itself.
Making a pref syncable requires a few things:
Register*Pref
call.ChromeSyncablePrefsDatabase
if the pref is in chrome/
, IOSChromeSyncablePrefsDatabase
if it‘s in ios/chrome/
, or CommonSyncablePrefsDatabase
if it’s cross-platform.SyncablePref
enum in tools/metrics/histograms/metadata/sync/enums.xml.Important: Adding syncable prefs may have privacy impact. It‘s the responsibility of the code reviewer to ensure that new syncable prefs don’t have undue privacy impact. In particular:
is_history_opt_in_required = true
, and it will only be synced if the user has opted in to history sync (in addition to preferences sync).syncer::PRIORITY_PREFERENCES
or syncer::OS_PRIORITY_PREFERENCES
), then it will not be encrypted. Carefully consider if it actually needs to be “priority”. (The most common reason for this is when the pref needs to be consumed on the server side.)