Commit 0e0ef49f authored by James Cook's avatar James Cook Committed by Commit Bot

sync: Move obsolete sync prefs to sync_prefs.cc file

This keeps them out of the public pref_names.h header and makes it
more obvious that they are obsolete.

This reveals that the Android ChromeBackupAgent has been backing up
empty prefs since 1/2019. Stop backing up those prefs. Based on my
reading of the backup and restore code this should work OK.
The restore code already checks to make sure all the prefs being
restored are still valid names.

Bug: 906611

Change-Id: I962ddc0f52f06f38247647bffeabba85a0721ef2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1929974
Commit-Queue: Marc Treib <treib@chromium.org>
Auto-Submit: James Cook <jamescook@chromium.org>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Reviewed-by: default avatarBoris Sazonov <bsazonov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718642}
parent 09908954
......@@ -21,23 +21,11 @@ const char* backed_up_preferences_[] = {
data_reduction_proxy::prefs::kDataSaverEnabled,
syncer::prefs::kSyncFirstSetupComplete,
syncer::prefs::kSyncKeepEverythingSynced,
syncer::prefs::kSyncAutofillProfile,
syncer::prefs::kSyncAutofillWallet,
syncer::prefs::kSyncAutofillWalletMetadata,
syncer::prefs::kSyncAutofill,
syncer::prefs::kSyncBookmarks,
syncer::prefs::kSyncDeviceInfo,
syncer::prefs::kSyncFaviconImages,
syncer::prefs::kSyncFaviconTracking,
syncer::prefs::kSyncHistoryDeleteDirectives,
syncer::prefs::kSyncPasswords,
syncer::prefs::kSyncPreferences,
syncer::prefs::kSyncPriorityPreferences,
syncer::prefs::kSyncRequested,
syncer::prefs::kSyncSessions,
syncer::prefs::kSyncSupervisedUserSettings,
syncer::prefs::kSyncSupervisedUserSharedSettings,
syncer::prefs::kSyncSupervisedUserWhitelists,
syncer::prefs::kSyncTabs,
syncer::prefs::kSyncTypedUrls,
};
......
......@@ -38,54 +38,25 @@ const char kOsSyncFeatureEnabled[] = "sync.os_sync_feature_enabled";
const char kSyncAllOsTypes[] = "sync.all_os_types";
// Booleans specifying whether the user has selected to sync the following
// OS datatypes.
// OS user selectable types.
const char kSyncOsApps[] = "sync.os_apps";
const char kSyncOsPreferences[] = "sync.os_preferences";
const char kSyncOsPrinters[] = "sync.os_printers";
#endif
// Booleans specifying whether the user has selected to sync the following
// datatypes.
const char kSyncAppList[] = "sync.app_list";
const char kSyncAppNotifications[] = "sync.app_notifications";
const char kSyncAppSettings[] = "sync.app_settings";
// user selectable types.
const char kSyncApps[] = "sync.apps";
const char kSyncArcPackage[] = "sync.arc_package";
const char kSyncArticles[] = "sync.articles";
const char kSyncAutofillProfile[] = "sync.autofill_profile";
const char kSyncAutofillWallet[] = "sync.autofill_wallet";
const char kSyncAutofillWalletMetadata[] = "sync.autofill_wallet_metadata";
const char kSyncAutofill[] = "sync.autofill";
const char kSyncBookmarks[] = "sync.bookmarks";
const char kSyncDeviceInfo[] = "sync.device_info";
const char kSyncDictionary[] = "sync.dictionary";
const char kSyncExtensionSettings[] = "sync.extension_settings";
const char kSyncExtensions[] = "sync.extensions";
const char kSyncFaviconImages[] = "sync.favicon_images";
const char kSyncFaviconTracking[] = "sync.favicon_tracking";
const char kSyncHistoryDeleteDirectives[] = "sync.history_delete_directives";
const char kSyncMountainShares[] = "sync.mountain_shares";
const char kSyncPasswords[] = "sync.passwords";
const char kSyncPreferences[] = "sync.preferences";
const char kSyncPriorityPreferences[] = "sync.priority_preferences";
const char kSyncReadingList[] = "sync.reading_list";
const char kSyncSearchEngines[] = "sync.search_engines";
const char kSyncSessions[] = "sync.sessions";
const char kSyncSupervisedUserSettings[] = "sync.managed_user_settings";
const char kSyncSupervisedUserSharedSettings[] =
"sync.managed_user_shared_settings";
const char kSyncSupervisedUserWhitelists[] = "sync.managed_user_whitelists";
const char kSyncSupervisedUsers[] = "sync.managed_users";
const char kSyncSyncedNotificationAppInfo[] =
"sync.synced_notification_app_info";
const char kSyncSyncedNotifications[] = "sync.synced_notifications";
const char kSyncTabs[] = "sync.tabs";
const char kSyncThemes[] = "sync.themes";
const char kSyncTypedUrls[] = "sync.typed_urls";
const char kSyncUserConsents[] = "sync.user_consents";
const char kSyncUserEvents[] = "sync.user_events";
const char kSyncWifiConfigurations[] = "sync.wifi_configurations";
const char kSyncWifiCredentials[] = "sync.wifi_credentials";
// Boolean used by enterprise configuration management in order to lock down
// sync.
......
......@@ -25,44 +25,17 @@ extern const char kSyncOsPreferences[];
extern const char kSyncOsPrinters[];
#endif
extern const char kSyncAppList[];
extern const char kSyncAppNotifications[];
extern const char kSyncAppSettings[];
extern const char kSyncApps[];
extern const char kSyncArcPackage[];
extern const char kSyncArticles[];
extern const char kSyncAutofillProfile[];
extern const char kSyncAutofillWallet[];
extern const char kSyncAutofillWalletMetadata[];
extern const char kSyncAutofill[];
extern const char kSyncBookmarks[];
extern const char kSyncDeviceInfo[];
extern const char kSyncDictionary[];
extern const char kSyncExtensionSettings[];
extern const char kSyncExtensions[];
extern const char kSyncFaviconImages[];
extern const char kSyncFaviconTracking[];
extern const char kSyncHistoryDeleteDirectives[];
extern const char kSyncMountainShares[];
extern const char kSyncPasswords[];
extern const char kSyncPreferences[];
extern const char kSyncPriorityPreferences[];
extern const char kSyncReadingList[];
extern const char kSyncSearchEngines[];
extern const char kSyncSessions[];
extern const char kSyncSupervisedUserSettings[];
extern const char kSyncSupervisedUserSharedSettings[];
extern const char kSyncSupervisedUserWhitelists[];
extern const char kSyncSupervisedUsers[];
extern const char kSyncSyncedNotificationAppInfo[];
extern const char kSyncSyncedNotifications[];
extern const char kSyncTabs[];
extern const char kSyncThemes[];
extern const char kSyncTypedUrls[];
extern const char kSyncUserConsents[];
extern const char kSyncUserEvents[];
extern const char kSyncWifiConfigurations[];
extern const char kSyncWifiCredentials[];
extern const char kSyncManaged[];
extern const char kSyncRequested[];
......
......@@ -56,34 +56,67 @@ const char kSyncMemoryPressureWarningCount[] = "sync.memory_warning_count";
// Obsolete pref that stored if sync shutdown cleanly.
const char kSyncShutdownCleanly[] = "sync.shutdown_cleanly";
// Obsolete prefs for data types. Can be deleted after 2020-01-30.
const char kSyncAppList[] = "sync.app_list";
const char kSyncAppNotifications[] = "sync.app_notifications";
const char kSyncAppSettings[] = "sync.app_settings";
const char kSyncArcPackage[] = "sync.arc_package";
const char kSyncArticles[] = "sync.articles";
const char kSyncAutofillProfile[] = "sync.autofill_profile";
const char kSyncAutofillWallet[] = "sync.autofill_wallet";
const char kSyncAutofillWalletMetadata[] = "sync.autofill_wallet_metadata";
const char kSyncDeviceInfo[] = "sync.device_info";
const char kSyncDictionary[] = "sync.dictionary";
const char kSyncExtensionSettings[] = "sync.extension_settings";
const char kSyncFaviconImages[] = "sync.favicon_images";
const char kSyncFaviconTracking[] = "sync.favicon_tracking";
const char kSyncHistoryDeleteDirectives[] = "sync.history_delete_directives";
const char kSyncMountainShares[] = "sync.mountain_shares";
const char kSyncPriorityPreferences[] = "sync.priority_preferences";
const char kSyncSearchEngines[] = "sync.search_engines";
const char kSyncSessions[] = "sync.sessions";
const char kSyncSupervisedUsers[] = "sync.managed_users";
const char kSyncSupervisedUserSettings[] = "sync.managed_user_settings";
const char kSyncSupervisedUserSharedSettings[] =
"sync.managed_user_shared_settings";
const char kSyncSupervisedUserWhitelists[] = "sync.managed_user_whitelists";
const char kSyncSyncedNotificationAppInfo[] =
"sync.synced_notification_app_info";
const char kSyncSyncedNotifications[] = "sync.synced_notifications";
const char kSyncUserEvents[] = "sync.user_events";
const char kSyncWifiCredentials[] = "sync.wifi_credentials";
// Obsolete pref. Can be deleted after 2020-09-09.
const char kSyncUserConsents[] = "sync.user_consents";
std::vector<std::string> GetObsoleteUserTypePrefs() {
return {prefs::kSyncAutofillProfile,
prefs::kSyncAutofillWallet,
prefs::kSyncAutofillWalletMetadata,
prefs::kSyncSearchEngines,
prefs::kSyncSessions,
prefs::kSyncAppSettings,
prefs::kSyncExtensionSettings,
prefs::kSyncAppNotifications,
prefs::kSyncHistoryDeleteDirectives,
prefs::kSyncSyncedNotifications,
prefs::kSyncSyncedNotificationAppInfo,
prefs::kSyncDictionary,
prefs::kSyncFaviconImages,
prefs::kSyncFaviconTracking,
prefs::kSyncDeviceInfo,
prefs::kSyncPriorityPreferences,
prefs::kSyncSupervisedUserSettings,
prefs::kSyncSupervisedUsers,
prefs::kSyncSupervisedUserSharedSettings,
prefs::kSyncArticles,
prefs::kSyncAppList,
prefs::kSyncWifiCredentials,
prefs::kSyncSupervisedUserWhitelists,
prefs::kSyncArcPackage,
prefs::kSyncUserEvents,
prefs::kSyncMountainShares,
prefs::kSyncUserConsents};
return {kSyncAutofillProfile,
kSyncAutofillWallet,
kSyncAutofillWalletMetadata,
kSyncSearchEngines,
kSyncSessions,
kSyncAppSettings,
kSyncExtensionSettings,
kSyncAppNotifications,
kSyncHistoryDeleteDirectives,
kSyncSyncedNotifications,
kSyncSyncedNotificationAppInfo,
kSyncDictionary,
kSyncFaviconImages,
kSyncFaviconTracking,
kSyncDeviceInfo,
kSyncPriorityPreferences,
kSyncSupervisedUserSettings,
kSyncSupervisedUsers,
kSyncSupervisedUserSharedSettings,
kSyncArticles,
kSyncAppList,
kSyncWifiCredentials,
kSyncSupervisedUserWhitelists,
kSyncArcPackage,
kSyncUserEvents,
kSyncMountainShares,
kSyncUserConsents};
}
void RegisterObsoleteUserTypePrefs(user_prefs::PrefRegistrySyncable* registry) {
......@@ -731,11 +764,11 @@ UserDemographicsResult SyncPrefs::GetUserNoisedBirthYearAndGender(
void MigrateSessionsToProxyTabsPrefs(PrefService* pref_service) {
if (pref_service->GetUserPrefValue(prefs::kSyncTabs) == nullptr &&
pref_service->GetUserPrefValue(prefs::kSyncSessions) != nullptr &&
pref_service->GetUserPrefValue(kSyncSessions) != nullptr &&
pref_service->IsUserModifiablePreference(prefs::kSyncTabs)) {
// If there is no tab sync preference yet (i.e. newly enabled type),
// default to the session sync preference value.
bool sessions_pref_value = pref_service->GetBoolean(prefs::kSyncSessions);
bool sessions_pref_value = pref_service->GetBoolean(kSyncSessions);
pref_service->SetBoolean(prefs::kSyncTabs, sessions_pref_value);
}
}
......
......@@ -26,6 +26,9 @@ namespace syncer {
namespace {
// Declared here because the pref is obsolete in production code.
const char kSyncSessions[] = "sync.sessions";
ModelTypeSet GetUserTypes() {
ModelTypeSet user_types = UserTypes();
#if defined(OS_CHROMEOS)
......@@ -116,7 +119,7 @@ TEST_F(SyncUserSettingsTest, DeleteDirectivesAndProxyTabsMigration) {
// in proxy tabs also being enabled. Also, manually disable typed urls, which
// should mean that history delete directives are not enabled.
pref_service_.SetBoolean(prefs::kSyncTypedUrls, false);
pref_service_.SetBoolean(prefs::kSyncSessions, true);
pref_service_.SetBoolean(kSyncSessions, true);
MigrateSessionsToProxyTabsPrefs(&pref_service_);
preferred_types = sync_user_settings->GetPreferredDataTypes();
......
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