| 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/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 #if defined(USE_ASH) | 247 #if defined(USE_ASH) |
| 248 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" | 248 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
| 249 #endif | 249 #endif |
| 250 | 250 |
| 251 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 251 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 252 #include "chrome/browser/ui/webui/md_history_ui.h" | 252 #include "chrome/browser/ui/webui/md_history_ui.h" |
| 253 #endif | 253 #endif |
| 254 | 254 |
| 255 namespace { | 255 namespace { |
| 256 | 256 |
| 257 #if defined(OS_WIN) | |
| 258 // Deprecated 11/2015 (M48). TODO(gab): delete in M52+. | |
| 259 const char kShownAutoLaunchInfobarDeprecated[] = | |
| 260 "browser.shown_autolaunch_infobar"; | |
| 261 #endif // defined(OS_WIN) | |
| 262 | |
| 263 // The SessionStartupPref used this pref to store the list of URLs to restore | 257 // The SessionStartupPref used this pref to store the list of URLs to restore |
| 264 // on startup, and then renamed it to "sessions.startup_urls" in M31. Migration | 258 // on startup, and then renamed it to "sessions.startup_urls" in M31. Migration |
| 265 // code was added and the timestamp of when the migration happened was tracked | 259 // code was added and the timestamp of when the migration happened was tracked |
| 266 // by "session.startup_urls_migration_time". Both are obsolete now (12/2015) and | 260 // by "session.startup_urls_migration_time". Both are obsolete now (12/2015) and |
| 267 // should be removed once a few releases have happened. | 261 // should be removed once a few releases have happened. |
| 268 const char kURLsToRestoreOnStartupOld[] = "session.urls_to_restore_on_startup"; | 262 const char kURLsToRestoreOnStartupOld[] = "session.urls_to_restore_on_startup"; |
| 269 const char kRestoreStartupURLsMigrationTime[] = | 263 const char kRestoreStartupURLsMigrationTime[] = |
| 270 "session.startup_urls_migration_time"; | 264 "session.startup_urls_migration_time"; |
| 271 | 265 |
| 272 // Deprecated 12/2015. | 266 // Deprecated 12/2015. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 chromeos::DemoModeDetector::RegisterPrefs(registry); | 419 chromeos::DemoModeDetector::RegisterPrefs(registry); |
| 426 chromeos::NetworkThrottlingObserver::RegisterPrefs(registry); | 420 chromeos::NetworkThrottlingObserver::RegisterPrefs(registry); |
| 427 chromeos::Preferences::RegisterPrefs(registry); | 421 chromeos::Preferences::RegisterPrefs(registry); |
| 428 chromeos::RegisterDisplayLocalStatePrefs(registry); | 422 chromeos::RegisterDisplayLocalStatePrefs(registry); |
| 429 chromeos::ResetScreenHandler::RegisterPrefs(registry); | 423 chromeos::ResetScreenHandler::RegisterPrefs(registry); |
| 430 chromeos::ResourceReporter::RegisterPrefs(registry); | 424 chromeos::ResourceReporter::RegisterPrefs(registry); |
| 431 chromeos::ServicesCustomizationDocument::RegisterPrefs(registry); | 425 chromeos::ServicesCustomizationDocument::RegisterPrefs(registry); |
| 432 chromeos::SigninScreenHandler::RegisterPrefs(registry); | 426 chromeos::SigninScreenHandler::RegisterPrefs(registry); |
| 433 chromeos::StartupUtils::RegisterPrefs(registry); | 427 chromeos::StartupUtils::RegisterPrefs(registry); |
| 434 chromeos::system::AutomaticRebootManager::RegisterPrefs(registry); | 428 chromeos::system::AutomaticRebootManager::RegisterPrefs(registry); |
| 435 chromeos::system::InputDeviceSettings::RegisterPrefs(registry); | |
| 436 chromeos::TimeZoneResolver::RegisterPrefs(registry); | 429 chromeos::TimeZoneResolver::RegisterPrefs(registry); |
| 437 chromeos::UserImageManager::RegisterPrefs(registry); | 430 chromeos::UserImageManager::RegisterPrefs(registry); |
| 438 chromeos::UserSessionManager::RegisterPrefs(registry); | 431 chromeos::UserSessionManager::RegisterPrefs(registry); |
| 439 chromeos::WallpaperManager::RegisterPrefs(registry); | 432 chromeos::WallpaperManager::RegisterPrefs(registry); |
| 440 chromeos::echo_offer::RegisterPrefs(registry); | 433 chromeos::echo_offer::RegisterPrefs(registry); |
| 441 extensions::ExtensionAssetsManagerChromeOS::RegisterPrefs(registry); | 434 extensions::ExtensionAssetsManagerChromeOS::RegisterPrefs(registry); |
| 442 invalidation::InvalidatorStorage::RegisterPrefs(registry); | 435 invalidation::InvalidatorStorage::RegisterPrefs(registry); |
| 443 ::onc::RegisterPrefs(registry); | 436 ::onc::RegisterPrefs(registry); |
| 444 policy::AutoEnrollmentClient::RegisterPrefs(registry); | 437 policy::AutoEnrollmentClient::RegisterPrefs(registry); |
| 445 policy::BrowserPolicyConnectorChromeOS::RegisterPrefs(registry); | 438 policy::BrowserPolicyConnectorChromeOS::RegisterPrefs(registry); |
| 446 policy::DeviceCloudPolicyManagerChromeOS::RegisterPrefs(registry); | 439 policy::DeviceCloudPolicyManagerChromeOS::RegisterPrefs(registry); |
| 447 policy::DeviceStatusCollector::RegisterPrefs(registry); | 440 policy::DeviceStatusCollector::RegisterPrefs(registry); |
| 448 policy::PolicyCertServiceFactory::RegisterPrefs(registry); | 441 policy::PolicyCertServiceFactory::RegisterPrefs(registry); |
| 449 quirks::QuirksManager::RegisterPrefs(registry); | 442 quirks::QuirksManager::RegisterPrefs(registry); |
| 443 |
| 444 // Moved to profile prefs, but we still need to register the prefs in local |
| 445 // state until migration is complete (See MigrateObsoleteBrowserPrefs()). |
| 446 chromeos::system::InputDeviceSettings::RegisterProfilePrefs(registry); |
| 450 #endif | 447 #endif |
| 451 | 448 |
| 452 #if defined(OS_MACOSX) | 449 #if defined(OS_MACOSX) |
| 453 confirm_quit::RegisterLocalState(registry); | 450 confirm_quit::RegisterLocalState(registry); |
| 454 QuitWithAppsController::RegisterPrefs(registry); | 451 QuitWithAppsController::RegisterPrefs(registry); |
| 455 #endif | 452 #endif |
| 456 | 453 |
| 457 #if defined(OS_WIN) | 454 #if defined(OS_WIN) |
| 458 app_metro_launch::RegisterPrefs(registry); | 455 app_metro_launch::RegisterPrefs(registry); |
| 459 component_updater::RegisterPrefsForSwReporter(registry); | 456 component_updater::RegisterPrefsForSwReporter(registry); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 chromeos::first_run::RegisterProfilePrefs(registry); | 597 chromeos::first_run::RegisterProfilePrefs(registry); |
| 601 chromeos::file_system_provider::RegisterProfilePrefs(registry); | 598 chromeos::file_system_provider::RegisterProfilePrefs(registry); |
| 602 chromeos::KeyPermissions::RegisterProfilePrefs(registry); | 599 chromeos::KeyPermissions::RegisterProfilePrefs(registry); |
| 603 chromeos::MultiProfileUserController::RegisterProfilePrefs(registry); | 600 chromeos::MultiProfileUserController::RegisterProfilePrefs(registry); |
| 604 chromeos::PinStorage::RegisterProfilePrefs(registry); | 601 chromeos::PinStorage::RegisterProfilePrefs(registry); |
| 605 chromeos::Preferences::RegisterProfilePrefs(registry); | 602 chromeos::Preferences::RegisterProfilePrefs(registry); |
| 606 chromeos::PrinterPrefManager::RegisterProfilePrefs(registry); | 603 chromeos::PrinterPrefManager::RegisterProfilePrefs(registry); |
| 607 chromeos::RegisterQuickUnlockProfilePrefs(registry); | 604 chromeos::RegisterQuickUnlockProfilePrefs(registry); |
| 608 chromeos::SAMLOfflineSigninLimiter::RegisterProfilePrefs(registry); | 605 chromeos::SAMLOfflineSigninLimiter::RegisterProfilePrefs(registry); |
| 609 chromeos::ServicesCustomizationDocument::RegisterProfilePrefs(registry); | 606 chromeos::ServicesCustomizationDocument::RegisterProfilePrefs(registry); |
| 607 chromeos::system::InputDeviceSettings::RegisterProfilePrefs(registry); |
| 610 chromeos::UserImageSyncObserver::RegisterProfilePrefs(registry); | 608 chromeos::UserImageSyncObserver::RegisterProfilePrefs(registry); |
| 611 extensions::EPKPChallengeUserKey::RegisterProfilePrefs(registry); | 609 extensions::EPKPChallengeUserKey::RegisterProfilePrefs(registry); |
| 612 flags_ui::PrefServiceFlagsStorage::RegisterProfilePrefs(registry); | 610 flags_ui::PrefServiceFlagsStorage::RegisterProfilePrefs(registry); |
| 613 ::onc::RegisterProfilePrefs(registry); | 611 ::onc::RegisterProfilePrefs(registry); |
| 614 #endif | 612 #endif |
| 615 | 613 |
| 616 #if defined(OS_CHROMEOS) && BUILDFLAG(ENABLE_APP_LIST) | 614 #if defined(OS_CHROMEOS) && BUILDFLAG(ENABLE_APP_LIST) |
| 617 ArcAppListPrefs::RegisterProfilePrefs(registry); | 615 ArcAppListPrefs::RegisterProfilePrefs(registry); |
| 618 #endif | 616 #endif |
| 619 | 617 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 631 ash::launcher::RegisterChromeLauncherUserPrefs(registry); | 629 ash::launcher::RegisterChromeLauncherUserPrefs(registry); |
| 632 #endif | 630 #endif |
| 633 | 631 |
| 634 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 632 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 635 MdHistoryUI::RegisterProfilePrefs(registry); | 633 MdHistoryUI::RegisterProfilePrefs(registry); |
| 636 #endif | 634 #endif |
| 637 | 635 |
| 638 // Preferences registered only for migration (clearing or moving to a new key) | 636 // Preferences registered only for migration (clearing or moving to a new key) |
| 639 // go here. | 637 // go here. |
| 640 | 638 |
| 641 #if defined(OS_WIN) | |
| 642 registry->RegisterIntegerPref(kShownAutoLaunchInfobarDeprecated, 0); | |
| 643 #endif // defined(OS_WIN) | |
| 644 | |
| 645 #if defined(USE_AURA) | 639 #if defined(USE_AURA) |
| 646 registry->RegisterIntegerPref(kFlingMaxCancelToDownTimeInMs, 0); | 640 registry->RegisterIntegerPref(kFlingMaxCancelToDownTimeInMs, 0); |
| 647 registry->RegisterIntegerPref(kFlingMaxTapGapTimeInMs, 0); | 641 registry->RegisterIntegerPref(kFlingMaxTapGapTimeInMs, 0); |
| 648 registry->RegisterIntegerPref(kTabScrubActivationDelayInMs, 0); | 642 registry->RegisterIntegerPref(kTabScrubActivationDelayInMs, 0); |
| 649 registry->RegisterIntegerPref(kSemiLongPressTimeInMs, 0); | 643 registry->RegisterIntegerPref(kSemiLongPressTimeInMs, 0); |
| 650 registry->RegisterDoublePref(kMaxSeparationForGestureTouchesInPixels, 0); | 644 registry->RegisterDoublePref(kMaxSeparationForGestureTouchesInPixels, 0); |
| 651 | 645 |
| 652 registry->RegisterDoublePref(kOverscrollHorizontalThresholdComplete, 0); | 646 registry->RegisterDoublePref(kOverscrollHorizontalThresholdComplete, 0); |
| 653 registry->RegisterDoublePref(kOverscrollVerticalThresholdComplete, 0); | 647 registry->RegisterDoublePref(kOverscrollVerticalThresholdComplete, 0); |
| 654 registry->RegisterDoublePref(kOverscrollMinimumThresholdStart, 0); | 648 registry->RegisterDoublePref(kOverscrollMinimumThresholdStart, 0); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 #if defined(OS_CHROMEOS) | 693 #if defined(OS_CHROMEOS) |
| 700 void RegisterLoginProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 694 void RegisterLoginProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 701 RegisterProfilePrefs(registry); | 695 RegisterProfilePrefs(registry); |
| 702 | 696 |
| 703 chromeos::PowerPrefs::RegisterLoginProfilePrefs(registry); | 697 chromeos::PowerPrefs::RegisterLoginProfilePrefs(registry); |
| 704 } | 698 } |
| 705 #endif | 699 #endif |
| 706 | 700 |
| 707 // This method should be periodically pruned of year+ old migrations. | 701 // This method should be periodically pruned of year+ old migrations. |
| 708 void MigrateObsoleteBrowserPrefs(Profile* profile, PrefService* local_state) { | 702 void MigrateObsoleteBrowserPrefs(Profile* profile, PrefService* local_state) { |
| 703 #if defined(OS_CHROMEOS) |
| 704 // Added 11/2016 |
| 705 local_state->ClearPref(prefs::kTouchScreenEnabled); |
| 706 local_state->ClearPref(prefs::kTouchPadEnabled); |
| 707 #endif // defined(OS_CHROMEOS) |
| 709 } | 708 } |
| 710 | 709 |
| 711 // This method should be periodically pruned of year+ old migrations. | 710 // This method should be periodically pruned of year+ old migrations. |
| 712 void MigrateObsoleteProfilePrefs(Profile* profile) { | 711 void MigrateObsoleteProfilePrefs(Profile* profile) { |
| 713 PrefService* profile_prefs = profile->GetPrefs(); | 712 PrefService* profile_prefs = profile->GetPrefs(); |
| 714 | 713 |
| 715 #if defined(OS_WIN) | |
| 716 // Added 11/2015. | |
| 717 profile_prefs->ClearPref(kShownAutoLaunchInfobarDeprecated); | |
| 718 #endif | |
| 719 | |
| 720 #if defined(OS_MACOSX) | 714 #if defined(OS_MACOSX) |
| 721 // Migrate the value of kHideFullscreenToolbar to kShowFullscreenToolbar if | 715 // Migrate the value of kHideFullscreenToolbar to kShowFullscreenToolbar if |
| 722 // it was set by the user. See crbug.com/590827. | 716 // it was set by the user. See crbug.com/590827. |
| 723 // Added 03/2016. | 717 // Added 03/2016. |
| 724 const PrefService::Preference* hide_pref = | 718 const PrefService::Preference* hide_pref = |
| 725 profile_prefs->FindPreference(prefs::kHideFullscreenToolbar); | 719 profile_prefs->FindPreference(prefs::kHideFullscreenToolbar); |
| 726 if (!hide_pref->IsDefaultValue()) { | 720 if (!hide_pref->IsDefaultValue()) { |
| 727 bool hide_pref_value = | 721 bool hide_pref_value = |
| 728 profile_prefs->GetBoolean(prefs::kHideFullscreenToolbar); | 722 profile_prefs->GetBoolean(prefs::kHideFullscreenToolbar); |
| 729 profile_prefs->SetBoolean(prefs::kShowFullscreenToolbar, !hide_pref_value); | 723 profile_prefs->SetBoolean(prefs::kShowFullscreenToolbar, !hide_pref_value); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 // Added 8/2016. | 778 // Added 8/2016. |
| 785 profile_prefs->ClearPref(kStaticEncodings); | 779 profile_prefs->ClearPref(kStaticEncodings); |
| 786 profile_prefs->ClearPref(kRecentlySelectedEncoding); | 780 profile_prefs->ClearPref(kRecentlySelectedEncoding); |
| 787 | 781 |
| 788 // Added 9/2016. | 782 // Added 9/2016. |
| 789 profile_prefs->ClearPref(kWebKitUsesUniversalDetector); | 783 profile_prefs->ClearPref(kWebKitUsesUniversalDetector); |
| 790 profile_prefs->ClearPref(kWebKitAllowDisplayingInsecureContent); | 784 profile_prefs->ClearPref(kWebKitAllowDisplayingInsecureContent); |
| 791 } | 785 } |
| 792 | 786 |
| 793 } // namespace chrome | 787 } // namespace chrome |
| OLD | NEW |