| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 }; | 226 }; |
| 227 | 227 |
| 228 // A previous feature (see | 228 // A previous feature (see |
| 229 // chrome/browser/protector/protected_prefs_watcher.cc in source | 229 // chrome/browser/protector/protected_prefs_watcher.cc in source |
| 230 // control history) used this string as a prefix for various prefs it | 230 // control history) used this string as a prefix for various prefs it |
| 231 // registered. We keep it here for now to clear out those old prefs in | 231 // registered. We keep it here for now to clear out those old prefs in |
| 232 // MigrateUserPrefs. | 232 // MigrateUserPrefs. |
| 233 const char kBackupPref[] = "backup"; | 233 const char kBackupPref[] = "backup"; |
| 234 | 234 |
| 235 #if !defined(OS_ANDROID) | 235 #if !defined(OS_ANDROID) |
| 236 // The sync promo error message preference has been removed; this pref will | |
| 237 // be cleared from user data. | |
| 238 const char kSyncPromoErrorMessage[] = "sync_promo.error_message"; | |
| 239 | |
| 240 // The AutomaticProfileResetter service used this preference to save that the | 236 // The AutomaticProfileResetter service used this preference to save that the |
| 241 // profile reset prompt had already been shown, however, the preference has been | 237 // profile reset prompt had already been shown, however, the preference has been |
| 242 // renamed in Local State. We keep the name here for now so that we can clear | 238 // renamed in Local State. We keep the name here for now so that we can clear |
| 243 // out legacy values. | 239 // out legacy values. |
| 244 // TODO(engedy): Remove this and usages in M42 or later. See crbug.com/398813. | 240 // TODO(engedy): Remove this and usages in M42 or later. See crbug.com/398813. |
| 245 const char kLegacyProfileResetPromptMemento[] = "profile.reset_prompt_memento"; | 241 const char kLegacyProfileResetPromptMemento[] = "profile.reset_prompt_memento"; |
| 246 #endif | 242 #endif |
| 247 | 243 |
| 248 } // namespace | 244 } // namespace |
| 249 | 245 |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 #if defined(USE_ASH) | 523 #if defined(USE_ASH) |
| 528 ash::RegisterChromeLauncherUserPrefs(registry); | 524 ash::RegisterChromeLauncherUserPrefs(registry); |
| 529 #endif | 525 #endif |
| 530 | 526 |
| 531 // Preferences registered only for migration (clearing or moving to a new key) | 527 // Preferences registered only for migration (clearing or moving to a new key) |
| 532 // go here. | 528 // go here. |
| 533 registry->RegisterDictionaryPref( | 529 registry->RegisterDictionaryPref( |
| 534 kBackupPref, | 530 kBackupPref, |
| 535 new base::DictionaryValue(), | 531 new base::DictionaryValue(), |
| 536 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 532 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 537 #if !defined(OS_ANDROID) | |
| 538 registry->RegisterStringPref( | |
| 539 kSyncPromoErrorMessage, | |
| 540 std::string(), | |
| 541 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 542 #endif | |
| 543 } | 533 } |
| 544 | 534 |
| 545 void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 535 void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 546 RegisterProfilePrefs(registry); | 536 RegisterProfilePrefs(registry); |
| 547 | 537 |
| 548 #if defined(OS_CHROMEOS) | 538 #if defined(OS_CHROMEOS) |
| 549 chromeos::PowerPrefs::RegisterUserProfilePrefs(registry); | 539 chromeos::PowerPrefs::RegisterUserProfilePrefs(registry); |
| 550 #endif | 540 #endif |
| 551 } | 541 } |
| 552 | 542 |
| 553 void RegisterScreenshotPrefs(PrefRegistrySimple* registry) { | 543 void RegisterScreenshotPrefs(PrefRegistrySimple* registry) { |
| 554 registry->RegisterBooleanPref(prefs::kDisableScreenshots, false); | 544 registry->RegisterBooleanPref(prefs::kDisableScreenshots, false); |
| 555 } | 545 } |
| 556 | 546 |
| 557 #if defined(OS_CHROMEOS) | 547 #if defined(OS_CHROMEOS) |
| 558 void RegisterLoginProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 548 void RegisterLoginProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 559 RegisterProfilePrefs(registry); | 549 RegisterProfilePrefs(registry); |
| 560 | 550 |
| 561 chromeos::PowerPrefs::RegisterLoginProfilePrefs(registry); | 551 chromeos::PowerPrefs::RegisterLoginProfilePrefs(registry); |
| 562 } | 552 } |
| 563 #endif | 553 #endif |
| 564 | 554 |
| 565 void MigrateUserPrefs(Profile* profile) { | 555 void MigrateUserPrefs(Profile* profile) { |
| 566 PrefService* prefs = profile->GetPrefs(); | 556 PrefService* prefs = profile->GetPrefs(); |
| 567 | 557 |
| 568 // Cleanup prefs from now-removed protector feature. | 558 // Cleanup prefs from now-removed protector feature. |
| 569 prefs->ClearPref(kBackupPref); | 559 prefs->ClearPref(kBackupPref); |
| 570 | 560 |
| 571 #if !defined(OS_ANDROID) | 561 #if !defined(OS_ANDROID) |
| 572 // Cleanup now-removed sync promo error message preference. | |
| 573 // TODO(fdoray): Remove this when it's safe to do so (crbug.com/268442). | |
| 574 prefs->ClearPref(kSyncPromoErrorMessage); | |
| 575 // Migrate kNetworkPredictionEnabled to kNetworkPredictionOptions when not on | 562 // Migrate kNetworkPredictionEnabled to kNetworkPredictionOptions when not on |
| 576 // Android. On Android, platform-specific code performs preference migration. | 563 // Android. On Android, platform-specific code performs preference migration. |
| 577 // TODO(bnc): https://crbug.com/401970 Remove migration code one year after | 564 // TODO(bnc): https://crbug.com/401970 Remove migration code one year after |
| 578 // M38. | 565 // M38. |
| 579 chrome_browser_net::MigrateNetworkPredictionUserPrefs(prefs); | 566 chrome_browser_net::MigrateNetworkPredictionUserPrefs(prefs); |
| 580 #endif | 567 #endif |
| 581 | 568 |
| 582 PromoResourceService::MigrateUserPrefs(prefs); | 569 PromoResourceService::MigrateUserPrefs(prefs); |
| 583 translate::TranslatePrefs::MigrateUserPrefs(prefs, prefs::kAcceptLanguages); | 570 translate::TranslatePrefs::MigrateUserPrefs(prefs, prefs::kAcceptLanguages); |
| 584 | 571 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 host_zoom_dictionary, false /* sanitize_partition_host_zoom_levels */); | 671 host_zoom_dictionary, false /* sanitize_partition_host_zoom_levels */); |
| 685 | 672 |
| 686 // We're done migrating the profile per-host zoom level values, so we clear | 673 // We're done migrating the profile per-host zoom level values, so we clear |
| 687 // them all. | 674 // them all. |
| 688 DictionaryPrefUpdate host_zoom_dictionary_update( | 675 DictionaryPrefUpdate host_zoom_dictionary_update( |
| 689 prefs, prefs::kPerHostZoomLevelsDeprecated); | 676 prefs, prefs::kPerHostZoomLevelsDeprecated); |
| 690 host_zoom_dictionary_update->Clear(); | 677 host_zoom_dictionary_update->Clear(); |
| 691 } | 678 } |
| 692 | 679 |
| 693 } // namespace chrome | 680 } // namespace chrome |
| OLD | NEW |