Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/prefs/browser_prefs.h" | 5 #include "chrome/browser/prefs/browser_prefs.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 550 void RegisterLoginProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 550 void RegisterLoginProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 551 RegisterProfilePrefs(registry); | 551 RegisterProfilePrefs(registry); |
| 552 | 552 |
| 553 chromeos::PowerPrefs::RegisterLoginProfilePrefs(registry); | 553 chromeos::PowerPrefs::RegisterLoginProfilePrefs(registry); |
| 554 } | 554 } |
| 555 #endif | 555 #endif |
| 556 | 556 |
| 557 void MigrateUserPrefs(Profile* profile) { | 557 void MigrateUserPrefs(Profile* profile) { |
| 558 PrefService* prefs = profile->GetPrefs(); | 558 PrefService* prefs = profile->GetPrefs(); |
| 559 | 559 |
| 560 // Cleanup prefs from now-removed protector feature. | 560 // Added 08/2014. |
| 561 prefs->ClearPref(kBackupPref); | |
|
gab
2015/02/20 20:33:57
Remove kBackupPref's definition higher up in this
rkaplow
2015/02/20 21:58:08
Am I good to remove this initialization of the pre
gab
2015/02/23 16:09:37
Yes, prefs that are still cleared will need to be
rkaplow
2015/02/23 23:27:52
Done.
| |
| 562 | |
| 563 #if !defined(OS_ANDROID) | |
| 564 // Migrate kNetworkPredictionEnabled to kNetworkPredictionOptions when not on | 561 // Migrate kNetworkPredictionEnabled to kNetworkPredictionOptions when not on |
| 565 // Android. On Android, platform-specific code performs preference migration. | 562 // Android. On Android, platform-specific code performs preference migration. |
| 566 // TODO(bnc): https://crbug.com/401970 Remove migration code one year after | 563 // TODO(bnc): https://crbug.com/401970 Remove migration code one year after |
| 567 // M38. | 564 // M38. |
| 565 #if !defined(OS_ANDROID) | |
|
gab
2015/02/20 20:33:57
I liked having the comment inside the ifdef, pleas
rkaplow
2015/02/20 21:58:08
Done.
I rearranged everything to be ordered by da
| |
| 568 chrome_browser_net::MigrateNetworkPredictionUserPrefs(prefs); | 566 chrome_browser_net::MigrateNetworkPredictionUserPrefs(prefs); |
| 569 #endif | 567 #endif |
| 570 | 568 |
| 571 PromoResourceService::MigrateUserPrefs(prefs); | 569 // Added 07/2014. |
| 572 translate::TranslatePrefs::MigrateUserPrefs(prefs, prefs::kAcceptLanguages); | 570 translate::TranslatePrefs::MigrateUserPrefs(prefs, prefs::kAcceptLanguages); |
| 573 | 571 |
| 572 // Added 06/2014. | |
| 574 #if defined(OS_MACOSX) && !defined(OS_IOS) | 573 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 575 autofill::AutofillManager::MigrateUserPrefs(prefs); | 574 autofill::AutofillManager::MigrateUserPrefs(prefs); |
| 576 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 575 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 577 } | 576 } |
| 578 | 577 |
| 579 void MigrateBrowserPrefs(Profile* profile, PrefService* local_state) { | 578 void MigrateBrowserPrefs(Profile* profile, PrefService* local_state) { |
| 580 // Copy pref values which have been migrated to user_prefs from local_state, | 579 // Added 08/2014. |
| 581 // or remove them from local_state outright, if copying is not required. | |
| 582 int current_version = | |
| 583 local_state->GetInteger(prefs::kMultipleProfilePrefMigration); | |
|
gab
2015/02/20 20:33:57
Also remove all constants cleaned up below from th
rkaplow
2015/02/23 23:27:52
should be done.
| |
| 584 PrefRegistrySimple* registry = static_cast<PrefRegistrySimple*>( | |
| 585 local_state->DeprecatedGetPrefRegistry()); | |
| 586 | |
| 587 if (!(current_version & DNS_PREFS)) { | |
| 588 registry->RegisterListPref(prefs::kDnsStartupPrefetchList); | |
| 589 local_state->ClearPref(prefs::kDnsStartupPrefetchList); | |
| 590 | |
| 591 registry->RegisterListPref(prefs::kDnsHostReferralList); | |
| 592 local_state->ClearPref(prefs::kDnsHostReferralList); | |
| 593 | |
| 594 current_version |= DNS_PREFS; | |
| 595 local_state->SetInteger(prefs::kMultipleProfilePrefMigration, | |
| 596 current_version); | |
| 597 } | |
| 598 | |
| 599 PrefService* user_prefs = profile->GetPrefs(); | |
| 600 if (!(current_version & WINDOWS_PREFS)) { | |
| 601 registry->RegisterDictionaryPref(prefs::kBrowserWindowPlacement); | |
| 602 if (local_state->HasPrefPath(prefs::kBrowserWindowPlacement)) { | |
| 603 const PrefService::Preference* pref = | |
| 604 local_state->FindPreference(prefs::kBrowserWindowPlacement); | |
| 605 DCHECK(pref); | |
| 606 user_prefs->Set(prefs::kBrowserWindowPlacement, | |
| 607 *(pref->GetValue())); | |
| 608 } | |
| 609 local_state->ClearPref(prefs::kBrowserWindowPlacement); | |
| 610 | |
| 611 current_version |= WINDOWS_PREFS; | |
| 612 local_state->SetInteger(prefs::kMultipleProfilePrefMigration, | |
| 613 current_version); | |
| 614 } | |
| 615 | |
| 616 #if !defined(OS_ANDROID) | 580 #if !defined(OS_ANDROID) |
| 617 local_state->ClearPref(kLegacyProfileResetPromptMemento); | 581 local_state->ClearPref(kLegacyProfileResetPromptMemento); |
|
gab
2015/02/20 20:33:57
For prefs that are cleared inline (like this one),
rkaplow
2015/02/20 21:58:08
This gets used elsewhere, https://code.google.com/
gab
2015/02/23 16:09:37
Oops as mentioned above we'll need keep the file s
rkaplow
2015/02/23 22:55:03
There's actually a comment for kLegacyProfileReset
| |
| 618 #endif | 582 #endif |
| 619 | 583 |
| 620 #if defined(OS_CHROMEOS) | 584 // Added 05/2014. |
| 621 chromeos::default_pinned_apps_field_trial::MigratePrefs(local_state); | |
| 622 #endif | |
| 623 | |
| 624 #if defined(TOOLKIT_VIEWS) | 585 #if defined(TOOLKIT_VIEWS) |
| 625 MigrateBrowserTabStripPrefs(local_state); | 586 MigrateBrowserTabStripPrefs(local_state); |
| 626 #endif | 587 #endif |
| 627 } | 588 } |
| 628 | 589 |
| 629 // As part of the migration from per-profile to per-partition HostZoomMaps, | 590 // As part of the migration from per-profile to per-partition HostZoomMaps, |
| 630 // we need to detect if an existing per-profile set of preferences exist, and | 591 // we need to detect if an existing per-profile set of preferences exist, and |
| 631 // if so convert them to be per-partition. We migrate any per-profile zoom | 592 // if so convert them to be per-partition. We migrate any per-profile zoom |
| 632 // level prefs via zoom_level_prefs. | 593 // level prefs via zoom_level_prefs. |
| 633 // Code that updates zoom prefs in the profile prefs store has been removed, | 594 // Code that updates zoom prefs in the profile prefs store has been removed, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 673 host_zoom_dictionary, false /* sanitize_partition_host_zoom_levels */); | 634 host_zoom_dictionary, false /* sanitize_partition_host_zoom_levels */); |
| 674 | 635 |
| 675 // We're done migrating the profile per-host zoom level values, so we clear | 636 // We're done migrating the profile per-host zoom level values, so we clear |
| 676 // them all. | 637 // them all. |
| 677 DictionaryPrefUpdate host_zoom_dictionary_update( | 638 DictionaryPrefUpdate host_zoom_dictionary_update( |
| 678 prefs, prefs::kPerHostZoomLevelsDeprecated); | 639 prefs, prefs::kPerHostZoomLevelsDeprecated); |
| 679 host_zoom_dictionary_update->Clear(); | 640 host_zoom_dictionary_update->Clear(); |
| 680 } | 641 } |
| 681 | 642 |
| 682 } // namespace chrome | 643 } // namespace chrome |
| OLD | NEW |