Commit e1e8c231 authored by Roger McFarlane's avatar Roger McFarlane Committed by Commit Bot

Make prefs::kSyncDemographicsBirthYearOffset syncable.

This CL updates prefs::kSyncDemographicsBirthYearOffset to be
syncable. This change prevents a user who resets their profile
data without changing their UMA client id from generating a
new random offset, which could narrow down the true birth
year value.

Bug: 978849
Change-Id: I34d347dfdf5a35381443baa327883c72fb0aaed3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1803763
Commit-Queue: Roger McFarlane <rogerm@chromium.org>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Reviewed-by: default avatarTatiana Gornak <melandory@chromium.org>
Cr-Commit-Position: refs/heads/master@{#696895}
parent 86c326a7
...@@ -135,9 +135,11 @@ const char kSyncDemographics_GenderPath[] = "gender"; ...@@ -135,9 +135,11 @@ const char kSyncDemographics_GenderPath[] = "gender";
// Stores a "secret" offset that is used to randomize the birth year for metrics // Stores a "secret" offset that is used to randomize the birth year for metrics
// reporting. This value should not be logged to UMA directly; instead, it // reporting. This value should not be logged to UMA directly; instead, it
// should be summed with the kSyncDemographicsBirthYear. This value is both // should be summed with the kSyncDemographicsBirthYear. This value is generated
// generated and stored locally on the client and is not known outside of the // locally on the client the first time a user begins to merge birth year data
// client. It is not synced. // into their UMA reports. The value is synced to the user's other devices so
// that the user consistently uses the same offset across login/logout events
// and after clearing their other browser data.
const char kSyncDemographicsBirthYearOffset[] = const char kSyncDemographicsBirthYearOffset[] =
"sync.demographics_birth_year_offset"; "sync.demographics_birth_year_offset";
......
...@@ -127,7 +127,7 @@ const char* GetPrefNameForType(UserSelectableType type) { ...@@ -127,7 +127,7 @@ const char* GetPrefNameForType(UserSelectableType type) {
// Gets an offset to add noise to the birth year. If not present in prefs, the // Gets an offset to add noise to the birth year. If not present in prefs, the
// offset will be randomly generated within the offset range and cached in // offset will be randomly generated within the offset range and cached in
// prefs. // syncable prefs.
int GetBirthYearOffset(PrefService* pref_service) { int GetBirthYearOffset(PrefService* pref_service) {
int offset = int offset =
pref_service->GetInteger(prefs::kSyncDemographicsBirthYearOffset); pref_service->GetInteger(prefs::kSyncDemographicsBirthYearOffset);
...@@ -295,7 +295,8 @@ void SyncPrefs::RegisterProfilePrefs( ...@@ -295,7 +295,8 @@ void SyncPrefs::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF); user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF);
registry->RegisterIntegerPref( registry->RegisterIntegerPref(
prefs::kSyncDemographicsBirthYearOffset, prefs::kSyncDemographicsBirthYearOffset,
kUserDemographicsBirthYearNoiseOffsetDefaultValue); kUserDemographicsBirthYearNoiseOffsetDefaultValue,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
// Obsolete prefs that will be removed after a grace period. // Obsolete prefs that will be removed after a grace period.
RegisterObsoleteUserTypePrefs(registry); RegisterObsoleteUserTypePrefs(registry);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment