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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 | 129 |
| 130 #if defined(ENABLE_PLUGIN_INSTALLATION) | 130 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 131 #include "chrome/browser/plugins/plugins_resource_service.h" | 131 #include "chrome/browser/plugins/plugins_resource_service.h" |
| 132 #endif | 132 #endif |
| 133 | 133 |
| 134 #if defined(OS_ANDROID) | 134 #if defined(OS_ANDROID) |
| 135 #include "chrome/browser/android/bookmarks/partner_bookmarks_shim.h" | 135 #include "chrome/browser/android/bookmarks/partner_bookmarks_shim.h" |
| 136 #include "chrome/browser/android/new_tab_page_prefs.h" | 136 #include "chrome/browser/android/new_tab_page_prefs.h" |
| 137 #else | 137 #else |
| 138 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" | 138 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" |
| 139 #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h" | |
| 140 #include "chrome/browser/ui/autofill/generated_credit_card_bubble_controller.h" | 139 #include "chrome/browser/ui/autofill/generated_credit_card_bubble_controller.h" |
| 141 #endif | 140 #endif |
| 142 | 141 |
| 143 #if defined(OS_CHROMEOS) | 142 #if defined(OS_CHROMEOS) |
| 144 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 143 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 145 #include "chrome/browser/chromeos/attestation/platform_verification_flow.h" | 144 #include "chrome/browser/chromeos/attestation/platform_verification_flow.h" |
| 146 #include "chrome/browser/chromeos/audio/audio_devices_pref_handler_impl.h" | 145 #include "chrome/browser/chromeos/audio/audio_devices_pref_handler_impl.h" |
| 147 #include "chrome/browser/chromeos/customization_document.h" | 146 #include "chrome/browser/chromeos/customization_document.h" |
| 148 #include "chrome/browser/chromeos/display/display_preferences.h" | 147 #include "chrome/browser/chromeos/display/display_preferences.h" |
| 149 #include "chrome/browser/chromeos/extensions/echo_private_api.h" | 148 #include "chrome/browser/chromeos/extensions/echo_private_api.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 // chrome/browser/protector/protected_prefs_watcher.cc in source | 213 // chrome/browser/protector/protected_prefs_watcher.cc in source |
| 215 // control history) used this string as a prefix for various prefs it | 214 // control history) used this string as a prefix for various prefs it |
| 216 // registered. We keep it here for now to clear out those old prefs in | 215 // registered. We keep it here for now to clear out those old prefs in |
| 217 // MigrateUserPrefs. | 216 // MigrateUserPrefs. |
| 218 const char kBackupPref[] = "backup"; | 217 const char kBackupPref[] = "backup"; |
| 219 | 218 |
| 220 #if !defined(OS_ANDROID) | 219 #if !defined(OS_ANDROID) |
| 221 // The sync promo error message preference has been removed; this pref will | 220 // The sync promo error message preference has been removed; this pref will |
| 222 // be cleared from user data. | 221 // be cleared from user data. |
| 223 const char kSyncPromoErrorMessage[] = "sync_promo.error_message"; | 222 const char kSyncPromoErrorMessage[] = "sync_promo.error_message"; |
| 223 | |
| 224 // The AutomaticProfileResetter service, which has been unimplemented, used to | |
| 225 // use this preference to save that the profile reset prompt had already been | |
| 226 // shown. We keep the name here for now so that we can clear out legacy values | |
| 227 // that might be retained in Preferences and/or Local State. | |
| 228 // TODO(engedy): Remove this and all usages at one point. See crbug.com/398813. | |
|
battre
2014/07/30 12:53:28
Please specify a milestone ("at or after Mxx")
engedy
2014/07/30 13:52:52
Done.
| |
| 229 const char kProfileResetPromptMemento[] = "profile.reset_prompt_memento"; | |
| 224 #endif | 230 #endif |
| 225 | 231 |
| 226 } // namespace | 232 } // namespace |
| 227 | 233 |
| 228 namespace chrome { | 234 namespace chrome { |
| 229 | 235 |
| 230 void RegisterLocalState(PrefRegistrySimple* registry) { | 236 void RegisterLocalState(PrefRegistrySimple* registry) { |
| 231 // Prefs in Local State. | 237 // Prefs in Local State. |
| 232 registry->RegisterIntegerPref(prefs::kMultipleProfilePrefMigration, 0); | 238 registry->RegisterIntegerPref(prefs::kMultipleProfilePrefMigration, 0); |
| 233 | 239 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 | 285 |
| 280 #if defined(ENABLE_PLUGIN_INSTALLATION) | 286 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 281 PluginsResourceService::RegisterPrefs(registry); | 287 PluginsResourceService::RegisterPrefs(registry); |
| 282 #endif | 288 #endif |
| 283 | 289 |
| 284 #if defined(ENABLE_TASK_MANAGER) | 290 #if defined(ENABLE_TASK_MANAGER) |
| 285 TaskManager::RegisterPrefs(registry); | 291 TaskManager::RegisterPrefs(registry); |
| 286 #endif // defined(ENABLE_TASK_MANAGER) | 292 #endif // defined(ENABLE_TASK_MANAGER) |
| 287 | 293 |
| 288 #if !defined(OS_ANDROID) | 294 #if !defined(OS_ANDROID) |
| 289 AutomaticProfileResetterFactory::RegisterPrefs(registry); | |
| 290 BackgroundModeManager::RegisterPrefs(registry); | 295 BackgroundModeManager::RegisterPrefs(registry); |
| 291 RegisterBrowserPrefs(registry); | 296 RegisterBrowserPrefs(registry); |
| 292 #if !defined(OS_CHROMEOS) | 297 #if !defined(OS_CHROMEOS) |
| 293 RegisterDefaultBrowserPromptPrefs(registry); | 298 RegisterDefaultBrowserPromptPrefs(registry); |
| 294 #endif // !defined(OS_CHROMEOS) | 299 #endif // !defined(OS_CHROMEOS) |
| 295 #endif // !defined(OS_ANDROID) | 300 #endif // !defined(OS_ANDROID) |
| 296 | 301 |
| 297 #if defined(OS_CHROMEOS) | 302 #if defined(OS_CHROMEOS) |
| 298 ChromeOSMetricsProvider::RegisterPrefs(registry); | 303 ChromeOSMetricsProvider::RegisterPrefs(registry); |
| 299 chromeos::AudioDevicesPrefHandlerImpl::RegisterPrefs(registry); | 304 chromeos::AudioDevicesPrefHandlerImpl::RegisterPrefs(registry); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 | 341 |
| 337 #if defined(OS_WIN) | 342 #if defined(OS_WIN) |
| 338 app_metro_launch::RegisterPrefs(registry); | 343 app_metro_launch::RegisterPrefs(registry); |
| 339 component_updater::RegisterPrefsForSwReporter(registry); | 344 component_updater::RegisterPrefsForSwReporter(registry); |
| 340 password_manager::PasswordManager::RegisterLocalPrefs(registry); | 345 password_manager::PasswordManager::RegisterLocalPrefs(registry); |
| 341 #endif | 346 #endif |
| 342 | 347 |
| 343 #if defined(TOOLKIT_VIEWS) | 348 #if defined(TOOLKIT_VIEWS) |
| 344 RegisterBrowserViewLocalPrefs(registry); | 349 RegisterBrowserViewLocalPrefs(registry); |
| 345 #endif | 350 #endif |
| 351 | |
| 352 // Preferences registered only for migration (clearing or moving to a new key) | |
| 353 // go here. | |
| 354 #if !defined(OS_ANDROID) | |
| 355 registry->RegisterDictionaryPref(kProfileResetPromptMemento); | |
| 356 #endif // !defined(OS_ANDROID) | |
| 346 } | 357 } |
| 347 | 358 |
| 348 // Register prefs applicable to all profiles. | 359 // Register prefs applicable to all profiles. |
| 349 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 360 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 350 TRACE_EVENT0("browser", "chrome::RegisterUserPrefs"); | 361 TRACE_EVENT0("browser", "chrome::RegisterUserPrefs"); |
| 351 // User prefs. Please keep this list alphabetized. | 362 // User prefs. Please keep this list alphabetized. |
| 352 autofill::AutofillManager::RegisterProfilePrefs(registry); | 363 autofill::AutofillManager::RegisterProfilePrefs(registry); |
| 353 bookmarks::RegisterProfilePrefs(registry); | 364 bookmarks::RegisterProfilePrefs(registry); |
| 354 sync_driver::SyncPrefs::RegisterProfilePrefs(registry); | 365 sync_driver::SyncPrefs::RegisterProfilePrefs(registry); |
| 355 ChromeContentBrowserClient::RegisterProfilePrefs(registry); | 366 ChromeContentBrowserClient::RegisterProfilePrefs(registry); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 469 | 480 |
| 470 #if defined(TOOLKIT_VIEWS) | 481 #if defined(TOOLKIT_VIEWS) |
| 471 RegisterBrowserViewProfilePrefs(registry); | 482 RegisterBrowserViewProfilePrefs(registry); |
| 472 RegisterInvertBubbleUserPrefs(registry); | 483 RegisterInvertBubbleUserPrefs(registry); |
| 473 #endif | 484 #endif |
| 474 | 485 |
| 475 #if defined(USE_ASH) | 486 #if defined(USE_ASH) |
| 476 ash::RegisterChromeLauncherUserPrefs(registry); | 487 ash::RegisterChromeLauncherUserPrefs(registry); |
| 477 #endif | 488 #endif |
| 478 | 489 |
| 479 // Prefs registered only for migration (clearing or moving to a new | 490 // Preferences registered only for migration (clearing or moving to a new key) |
| 480 // key) go here. | 491 // go here. |
| 481 registry->RegisterDictionaryPref( | 492 registry->RegisterDictionaryPref( |
| 482 kBackupPref, | 493 kBackupPref, |
| 483 new base::DictionaryValue(), | 494 new base::DictionaryValue(), |
| 484 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 495 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 485 #if !defined(OS_ANDROID) | 496 #if !defined(OS_ANDROID) |
| 486 registry->RegisterStringPref( | 497 registry->RegisterStringPref( |
| 487 kSyncPromoErrorMessage, | 498 kSyncPromoErrorMessage, |
| 488 std::string(), | 499 std::string(), |
| 489 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 500 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 501 registry->RegisterStringPref( | |
| 502 kProfileResetPromptMemento, | |
| 503 std::string(), | |
| 504 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 490 #endif | 505 #endif |
| 491 } | 506 } |
| 492 | 507 |
| 493 void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 508 void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 494 RegisterProfilePrefs(registry); | 509 RegisterProfilePrefs(registry); |
| 495 | 510 |
| 496 #if defined(OS_CHROMEOS) | 511 #if defined(OS_CHROMEOS) |
| 497 chromeos::PowerPrefs::RegisterUserProfilePrefs(registry); | 512 chromeos::PowerPrefs::RegisterUserProfilePrefs(registry); |
| 498 #endif | 513 #endif |
| 499 } | 514 } |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 515 | 530 |
| 516 // Cleanup prefs from now-removed protector feature. | 531 // Cleanup prefs from now-removed protector feature. |
| 517 prefs->ClearPref(kBackupPref); | 532 prefs->ClearPref(kBackupPref); |
| 518 | 533 |
| 519 #if !defined(OS_ANDROID) | 534 #if !defined(OS_ANDROID) |
| 520 // Cleanup now-removed sync promo error message preference. | 535 // Cleanup now-removed sync promo error message preference. |
| 521 // TODO(fdoray): Remove this when it's safe to do so (crbug.com/268442). | 536 // TODO(fdoray): Remove this when it's safe to do so (crbug.com/268442). |
| 522 prefs->ClearPref(kSyncPromoErrorMessage); | 537 prefs->ClearPref(kSyncPromoErrorMessage); |
| 523 #endif | 538 #endif |
| 524 | 539 |
| 540 #if !defined(OS_ANDROID) | |
| 541 prefs->ClearPref(kProfileResetPromptMemento); | |
| 542 #endif | |
| 543 | |
| 525 PromoResourceService::MigrateUserPrefs(prefs); | 544 PromoResourceService::MigrateUserPrefs(prefs); |
| 526 translate::TranslatePrefs::MigrateUserPrefs(prefs, prefs::kAcceptLanguages); | 545 translate::TranslatePrefs::MigrateUserPrefs(prefs, prefs::kAcceptLanguages); |
| 527 | 546 |
| 528 #if defined(OS_MACOSX) && !defined(OS_IOS) | 547 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 529 autofill::AutofillManager::MigrateUserPrefs(prefs); | 548 autofill::AutofillManager::MigrateUserPrefs(prefs); |
| 530 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 549 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 531 } | 550 } |
| 532 | 551 |
| 533 void MigrateBrowserPrefs(Profile* profile, PrefService* local_state) { | 552 void MigrateBrowserPrefs(Profile* profile, PrefService* local_state) { |
| 534 // Copy pref values which have been migrated to user_prefs from local_state, | 553 // Copy pref values which have been migrated to user_prefs from local_state, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 583 prefs::kLastPromptedGoogleURL, | 602 prefs::kLastPromptedGoogleURL, |
| 584 local_state->GetString(prefs::kLastPromptedGoogleURL)); | 603 local_state->GetString(prefs::kLastPromptedGoogleURL)); |
| 585 } | 604 } |
| 586 local_state->ClearPref(prefs::kLastPromptedGoogleURL); | 605 local_state->ClearPref(prefs::kLastPromptedGoogleURL); |
| 587 | 606 |
| 588 current_version |= GOOGLE_URL_TRACKER_PREFS; | 607 current_version |= GOOGLE_URL_TRACKER_PREFS; |
| 589 local_state->SetInteger(prefs::kMultipleProfilePrefMigration, | 608 local_state->SetInteger(prefs::kMultipleProfilePrefMigration, |
| 590 current_version); | 609 current_version); |
| 591 } | 610 } |
| 592 | 611 |
| 612 #if !defined(OS_ANDROID) | |
| 613 local_state->ClearPref(kProfileResetPromptMemento); | |
| 614 #endif | |
| 615 | |
| 593 #if defined(OS_CHROMEOS) | 616 #if defined(OS_CHROMEOS) |
| 594 chromeos::default_pinned_apps_field_trial::MigratePrefs(local_state); | 617 chromeos::default_pinned_apps_field_trial::MigratePrefs(local_state); |
| 595 #endif | 618 #endif |
| 596 | 619 |
| 597 #if defined(TOOLKIT_VIEWS) | 620 #if defined(TOOLKIT_VIEWS) |
| 598 MigrateBrowserTabStripPrefs(local_state); | 621 MigrateBrowserTabStripPrefs(local_state); |
| 599 #endif | 622 #endif |
| 600 } | 623 } |
| 601 | 624 |
| 602 } // namespace chrome | 625 } // namespace chrome |
| OLD | NEW |