Chromium Code Reviews| Index: chrome/browser/prefs/browser_prefs.cc |
| diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc |
| index e733f82f18c93b36b4357b8433cde2fb1a208abf..efef199c3862737173d0275f8f89996ae1653e5e 100644 |
| --- a/chrome/browser/prefs/browser_prefs.cc |
| +++ b/chrome/browser/prefs/browser_prefs.cc |
| @@ -224,19 +224,6 @@ |
| namespace { |
| -enum MigratedPreferences { |
| - NO_PREFS = 0, |
| - DNS_PREFS = 1 << 0, |
| - WINDOWS_PREFS = 1 << 1, |
| -}; |
| - |
| -// A previous feature (see |
| -// chrome/browser/protector/protected_prefs_watcher.cc in source |
| -// control history) used this string as a prefix for various prefs it |
| -// registered. We keep it here for now to clear out those old prefs in |
| -// MigrateUserPrefs. |
| -const char kBackupPref[] = "backup"; |
| - |
| #if !defined(OS_ANDROID) |
| // The AutomaticProfileResetter service used this preference to save that the |
| // profile reset prompt had already been shown, however, the preference has been |
| @@ -251,8 +238,6 @@ const char kLegacyProfileResetPromptMemento[] = "profile.reset_prompt_memento"; |
| namespace chrome { |
| void RegisterLocalState(PrefRegistrySimple* registry) { |
| - // Prefs in Local State. |
| - registry->RegisterIntegerPref(prefs::kMultipleProfilePrefMigration, 0); |
| // Please keep this list alphabetized. |
| AppListService::RegisterPrefs(registry); |
| @@ -533,10 +518,6 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| // Preferences registered only for migration (clearing or moving to a new key) |
| // go here. |
|
gab
2015/02/24 20:55:20
Remove this comment I guess now that it comments n
rkaplow
2015/02/24 22:41:11
make sense. We actually have this comment on line
|
| - registry->RegisterDictionaryPref( |
| - kBackupPref, |
| - new base::DictionaryValue(), |
| - user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| } |
| void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| @@ -559,79 +540,45 @@ void RegisterLoginProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| } |
| #endif |
| -void MigrateUserPrefs(Profile* profile) { |
| - PrefService* prefs = profile->GetPrefs(); |
| +void MigrateObsoleteBrowserPrefs(Profile* profile, PrefService* local_state) { |
| + // This method should be periodically pruned of year+ old migrations. |
| - // Cleanup prefs from now-removed protector feature. |
| - prefs->ClearPref(kBackupPref); |
| + // Added 05/2014. |
| +#if defined(TOOLKIT_VIEWS) |
| + MigrateBrowserTabStripPrefs(local_state); |
| +#endif |
| + // Added 08/2014. |
| #if !defined(OS_ANDROID) |
| - // Migrate kNetworkPredictionEnabled to kNetworkPredictionOptions when not on |
| - // Android. On Android, platform-specific code performs preference migration. |
| - // TODO(bnc): https://crbug.com/401970 Remove migration code one year after |
| - // M38. |
| - chrome_browser_net::MigrateNetworkPredictionUserPrefs(prefs); |
| + local_state->ClearPref(kLegacyProfileResetPromptMemento); |
| #endif |
| +} |
| - PromoResourceService::MigrateUserPrefs(prefs); |
| - translate::TranslatePrefs::MigrateUserPrefs(prefs, prefs::kAcceptLanguages); |
| +void MigrateObsoleteProfilePrefs(Profile* profile) { |
| + // This method should be periodically pruned of year+ old migrations. |
| + PrefService* profile_prefs = profile->GetPrefs(); |
| #if defined(OS_MACOSX) && !defined(OS_IOS) |
| - autofill::AutofillManager::MigrateUserPrefs(prefs); |
| + // Added 06/2014. |
| + autofill::AutofillManager::MigrateUserPrefs(profile_prefs); |
| #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| -#if defined(OS_CHROMEOS) && defined(ENABLE_APP_LIST) |
| - MigrateGoogleNowPrefs(profile); |
| -#endif |
| -} |
| - |
| -void MigrateBrowserPrefs(Profile* profile, PrefService* local_state) { |
| - // Copy pref values which have been migrated to user_prefs from local_state, |
| - // or remove them from local_state outright, if copying is not required. |
| - int current_version = |
| - local_state->GetInteger(prefs::kMultipleProfilePrefMigration); |
| - PrefRegistrySimple* registry = static_cast<PrefRegistrySimple*>( |
| - local_state->DeprecatedGetPrefRegistry()); |
| - |
| - if (!(current_version & DNS_PREFS)) { |
| - registry->RegisterListPref(prefs::kDnsStartupPrefetchList); |
| - local_state->ClearPref(prefs::kDnsStartupPrefetchList); |
| - |
| - registry->RegisterListPref(prefs::kDnsHostReferralList); |
| - local_state->ClearPref(prefs::kDnsHostReferralList); |
| - |
| - current_version |= DNS_PREFS; |
| - local_state->SetInteger(prefs::kMultipleProfilePrefMigration, |
| - current_version); |
| - } |
| - |
| - PrefService* user_prefs = profile->GetPrefs(); |
| - if (!(current_version & WINDOWS_PREFS)) { |
| - registry->RegisterDictionaryPref(prefs::kBrowserWindowPlacement); |
| - if (local_state->HasPrefPath(prefs::kBrowserWindowPlacement)) { |
| - const PrefService::Preference* pref = |
| - local_state->FindPreference(prefs::kBrowserWindowPlacement); |
| - DCHECK(pref); |
| - user_prefs->Set(prefs::kBrowserWindowPlacement, |
| - *(pref->GetValue())); |
| - } |
| - local_state->ClearPref(prefs::kBrowserWindowPlacement); |
| - |
| - current_version |= WINDOWS_PREFS; |
| - local_state->SetInteger(prefs::kMultipleProfilePrefMigration, |
| - current_version); |
| - } |
| + // Added 07/2014. |
| + translate::TranslatePrefs::MigrateUserPrefs(profile_prefs, |
| + prefs::kAcceptLanguages); |
| #if !defined(OS_ANDROID) |
| - local_state->ClearPref(kLegacyProfileResetPromptMemento); |
| -#endif |
| - |
| -#if defined(OS_CHROMEOS) |
| - chromeos::default_pinned_apps_field_trial::MigratePrefs(local_state); |
| + // Added 08/2014. |
| + // Migrate kNetworkPredictionEnabled to kNetworkPredictionOptions when not on |
| + // Android. On Android, platform-specific code performs preference migration. |
| + // TODO(bnc): https://crbug.com/401970 Remove migration code one year after |
| + // M38. |
| + chrome_browser_net::MigrateNetworkPredictionUserPrefs(profile_prefs); |
| #endif |
| -#if defined(TOOLKIT_VIEWS) |
| - MigrateBrowserTabStripPrefs(local_state); |
| +#if defined(OS_CHROMEOS) && defined(ENABLE_APP_LIST) |
| + // Added 02/2015. |
| + MigrateGoogleNowPrefs(profile); |
| #endif |
| } |