| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 #if BUILDFLAG(ENABLE_BACKGROUND) | 121 #if BUILDFLAG(ENABLE_BACKGROUND) |
| 122 #include "chrome/browser/background/background_mode_manager.h" | 122 #include "chrome/browser/background/background_mode_manager.h" |
| 123 #endif | 123 #endif |
| 124 | 124 |
| 125 #if BUILDFLAG(ENABLE_EXTENSIONS) | 125 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 126 #include "chrome/browser/accessibility/animation_policy_prefs.h" | 126 #include "chrome/browser/accessibility/animation_policy_prefs.h" |
| 127 #include "chrome/browser/apps/shortcut_manager.h" | 127 #include "chrome/browser/apps/shortcut_manager.h" |
| 128 #include "chrome/browser/extensions/activity_log/activity_log.h" | 128 #include "chrome/browser/extensions/activity_log/activity_log.h" |
| 129 #include "chrome/browser/extensions/api/commands/command_service.h" | 129 #include "chrome/browser/extensions/api/commands/command_service.h" |
| 130 #include "chrome/browser/extensions/api/tabs/tabs_api.h" | 130 #include "chrome/browser/extensions/api/tabs/tabs_api.h" |
| 131 #include "chrome/browser/extensions/component_migration_helper.h" | |
| 132 #include "chrome/browser/extensions/extension_web_ui.h" | 131 #include "chrome/browser/extensions/extension_web_ui.h" |
| 133 #include "chrome/browser/extensions/launch_util.h" | 132 #include "chrome/browser/extensions/launch_util.h" |
| 134 #include "chrome/browser/signin/easy_unlock_service.h" | 133 #include "chrome/browser/signin/easy_unlock_service.h" |
| 135 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" | 134 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" |
| 136 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h" | 135 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h" |
| 137 #include "extensions/browser/api/runtime/runtime_api.h" | 136 #include "extensions/browser/api/runtime/runtime_api.h" |
| 138 #include "extensions/browser/extension_prefs.h" | 137 #include "extensions/browser/extension_prefs.h" |
| 139 #endif // BUILDFLAG(ENABLE_EXTENSIONS) | 138 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
| 140 | 139 |
| 141 #if BUILDFLAG(ENABLE_PLUGIN_INSTALLATION) | 140 #if BUILDFLAG(ENABLE_PLUGIN_INSTALLATION) |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 #if defined(USE_ASH) | 252 #if defined(USE_ASH) |
| 254 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" | 253 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
| 255 #endif | 254 #endif |
| 256 | 255 |
| 257 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 256 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 258 #include "chrome/browser/ui/webui/md_history_ui.h" | 257 #include "chrome/browser/ui/webui/md_history_ui.h" |
| 259 #endif | 258 #endif |
| 260 | 259 |
| 261 namespace { | 260 namespace { |
| 262 | 261 |
| 263 // 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 | |
| 265 // 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 | |
| 267 // should be removed once a few releases have happened. | |
| 268 const char kURLsToRestoreOnStartupOld[] = "session.urls_to_restore_on_startup"; | |
| 269 const char kRestoreStartupURLsMigrationTime[] = | |
| 270 "session.startup_urls_migration_time"; | |
| 271 | |
| 272 // Deprecated 12/2015. | |
| 273 const char kRestoreOnStartupMigrated[] = "session.restore_on_startup_migrated"; | |
| 274 | |
| 275 #if defined(USE_AURA) | |
| 276 // Deprecated 1/2016. | |
| 277 const char kMaxSeparationForGestureTouchesInPixels[] = | |
| 278 "gesture.max_separation_for_gesture_touches_in_pixels"; | |
| 279 const char kSemiLongPressTimeInMs[] = "gesture.semi_long_press_time_in_ms"; | |
| 280 const char kTabScrubActivationDelayInMs[] = | |
| 281 "gesture.tab_scrub_activation_delay_in_ms"; | |
| 282 const char kFlingMaxCancelToDownTimeInMs[] = | |
| 283 "gesture.fling_max_cancel_to_down_time_in_ms"; | |
| 284 const char kFlingMaxTapGapTimeInMs[] = "gesture.fling_max_tap_gap_time_in_ms"; | |
| 285 const char kOverscrollHorizontalThresholdComplete[] = | |
| 286 "overscroll.horizontal_threshold_complete"; | |
| 287 const char kOverscrollVerticalThresholdComplete[] = | |
| 288 "overscroll.vertical_threshold_complete"; | |
| 289 const char kOverscrollMinimumThresholdStart[] = | |
| 290 "overscroll.minimum_threshold_start"; | |
| 291 const char kOverscrollMinimumThresholdStartTouchpad[] = | |
| 292 "overscroll.minimum_threshold_start_touchpad"; | |
| 293 const char kOverscrollVerticalThresholdStart[] = | |
| 294 "overscroll.vertical_threshold_start"; | |
| 295 const char kOverscrollHorizontalResistThreshold[] = | |
| 296 "overscroll.horizontal_resist_threshold"; | |
| 297 const char kOverscrollVerticalResistThreshold[] = | |
| 298 "overscroll.vertical_resist_threshold"; | |
| 299 #endif // defined(USE_AURA) | |
| 300 | |
| 301 #if BUILDFLAG(ENABLE_GOOGLE_NOW) | 262 #if BUILDFLAG(ENABLE_GOOGLE_NOW) |
| 302 // Deprecated 3/2016 | 263 // Deprecated 3/2016 |
| 303 const char kGoogleGeolocationAccessEnabled[] = | 264 const char kGoogleGeolocationAccessEnabled[] = |
| 304 "googlegeolocationaccess.enabled"; | 265 "googlegeolocationaccess.enabled"; |
| 305 #endif | 266 #endif |
| 306 | 267 |
| 307 // Deprecated 4/2016. | 268 // Deprecated 4/2016. |
| 308 const char kCheckDefaultBrowser[] = "browser.check_default_browser"; | 269 const char kCheckDefaultBrowser[] = "browser.check_default_browser"; |
| 309 | 270 |
| 310 // Deprecated 5/2016. | 271 // Deprecated 5/2016. |
| 311 const char kDesktopSearchRedirectionInfobarShownPref[] = | 272 const char kDesktopSearchRedirectionInfobarShownPref[] = |
| 312 "desktop_search_redirection_infobar_shown"; | 273 "desktop_search_redirection_infobar_shown"; |
| 313 | 274 |
| 314 // Deprecated 7/2016. | 275 // Deprecated 7/2016. |
| 315 const char kNetworkPredictionEnabled[] = "dns_prefetching.enabled"; | 276 const char kNetworkPredictionEnabled[] = "dns_prefetching.enabled"; |
| 316 const char kDisableSpdy[] = "spdy.disabled"; | 277 const char kDisableSpdy[] = "spdy.disabled"; |
| 317 | 278 |
| 318 // Deprecated 8/2016. | 279 // Deprecated 8/2016. |
| 319 const char kRecentlySelectedEncoding[] = "profile.recently_selected_encodings"; | 280 const char kRecentlySelectedEncoding[] = "profile.recently_selected_encodings"; |
| 320 const char kStaticEncodings[] = "intl.static_encodings"; | 281 const char kStaticEncodings[] = "intl.static_encodings"; |
| 321 | 282 |
| 322 // Deprecated 9/2016. | 283 // Deprecated 9/2016. |
| 323 const char kWebKitUsesUniversalDetector[] = | 284 const char kWebKitUsesUniversalDetector[] = |
| 324 "webkit.webprefs.uses_universal_detector"; | 285 "webkit.webprefs.uses_universal_detector"; |
| 325 const char kWebKitAllowDisplayingInsecureContent[] = | 286 const char kWebKitAllowDisplayingInsecureContent[] = |
| 326 "webkit.webprefs.allow_displaying_insecure_content"; | 287 "webkit.webprefs.allow_displaying_insecure_content"; |
| 327 | 288 |
| 289 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 290 // Deprecated 2/2017. |
| 291 const char kToolbarMigratedComponentActionStatus[] = |
| 292 "toolbar_migrated_component_action_status"; |
| 293 #endif |
| 294 |
| 328 void DeleteWebRTCIdentityStoreDBOnFileThread( | 295 void DeleteWebRTCIdentityStoreDBOnFileThread( |
| 329 const base::FilePath& profile_path) { | 296 const base::FilePath& profile_path) { |
| 330 base::DeleteFile(profile_path.Append( | 297 base::DeleteFile(profile_path.Append( |
| 331 FILE_PATH_LITERAL("WebRTCIdentityStore")), false); | 298 FILE_PATH_LITERAL("WebRTCIdentityStore")), false); |
| 332 base::DeleteFile(profile_path.Append( | 299 base::DeleteFile(profile_path.Append( |
| 333 FILE_PATH_LITERAL("WebRTCIdentityStore-journal")), false); | 300 FILE_PATH_LITERAL("WebRTCIdentityStore-journal")), false); |
| 334 } | 301 } |
| 335 | 302 |
| 336 void DeleteWebRTCIdentityStoreDB(const Profile& profile) { | 303 void DeleteWebRTCIdentityStoreDB(const Profile& profile) { |
| 337 content::BrowserThread::PostDelayedTask( | 304 content::BrowserThread::PostDelayedTask( |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 | 492 |
| 526 policy::URLBlacklistManager::RegisterProfilePrefs(registry); | 493 policy::URLBlacklistManager::RegisterProfilePrefs(registry); |
| 527 certificate_transparency::CTPolicyManager::RegisterPrefs(registry); | 494 certificate_transparency::CTPolicyManager::RegisterPrefs(registry); |
| 528 | 495 |
| 529 #if BUILDFLAG(ENABLE_EXTENSIONS) | 496 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 530 EasyUnlockService::RegisterProfilePrefs(registry); | 497 EasyUnlockService::RegisterProfilePrefs(registry); |
| 531 ExtensionWebUI::RegisterProfilePrefs(registry); | 498 ExtensionWebUI::RegisterProfilePrefs(registry); |
| 532 RegisterAnimationPolicyPrefs(registry); | 499 RegisterAnimationPolicyPrefs(registry); |
| 533 ToolbarActionsBar::RegisterProfilePrefs(registry); | 500 ToolbarActionsBar::RegisterProfilePrefs(registry); |
| 534 extensions::ActivityLog::RegisterProfilePrefs(registry); | 501 extensions::ActivityLog::RegisterProfilePrefs(registry); |
| 535 extensions::ComponentMigrationHelper::RegisterPrefs(registry); | |
| 536 extensions::ExtensionPrefs::RegisterProfilePrefs(registry); | 502 extensions::ExtensionPrefs::RegisterProfilePrefs(registry); |
| 537 extensions::launch_util::RegisterProfilePrefs(registry); | 503 extensions::launch_util::RegisterProfilePrefs(registry); |
| 538 extensions::RuntimeAPI::RegisterPrefs(registry); | 504 extensions::RuntimeAPI::RegisterPrefs(registry); |
| 539 #endif // BUILDFLAG(ENABLE_EXTENSIONS) | 505 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
| 540 | 506 |
| 541 #if BUILDFLAG(ENABLE_EXTENSIONS) && !defined(OS_ANDROID) | 507 #if BUILDFLAG(ENABLE_EXTENSIONS) && !defined(OS_ANDROID) |
| 542 // The extension welcome notification requires a build that enables extensions | 508 // The extension welcome notification requires a build that enables extensions |
| 543 // and notifications, and uses the UI message center. | 509 // and notifications, and uses the UI message center. |
| 544 ExtensionWelcomeNotification::RegisterProfilePrefs(registry); | 510 ExtensionWelcomeNotification::RegisterProfilePrefs(registry); |
| 545 #endif | 511 #endif |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 ash::launcher::RegisterChromeLauncherUserPrefs(registry); | 609 ash::launcher::RegisterChromeLauncherUserPrefs(registry); |
| 644 #endif | 610 #endif |
| 645 | 611 |
| 646 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 612 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 647 MdHistoryUI::RegisterProfilePrefs(registry); | 613 MdHistoryUI::RegisterProfilePrefs(registry); |
| 648 #endif | 614 #endif |
| 649 | 615 |
| 650 // Preferences registered only for migration (clearing or moving to a new key) | 616 // Preferences registered only for migration (clearing or moving to a new key) |
| 651 // go here. | 617 // go here. |
| 652 | 618 |
| 653 #if defined(USE_AURA) | |
| 654 registry->RegisterIntegerPref(kFlingMaxCancelToDownTimeInMs, 0); | |
| 655 registry->RegisterIntegerPref(kFlingMaxTapGapTimeInMs, 0); | |
| 656 registry->RegisterIntegerPref(kTabScrubActivationDelayInMs, 0); | |
| 657 registry->RegisterIntegerPref(kSemiLongPressTimeInMs, 0); | |
| 658 registry->RegisterDoublePref(kMaxSeparationForGestureTouchesInPixels, 0); | |
| 659 | |
| 660 registry->RegisterDoublePref(kOverscrollHorizontalThresholdComplete, 0); | |
| 661 registry->RegisterDoublePref(kOverscrollVerticalThresholdComplete, 0); | |
| 662 registry->RegisterDoublePref(kOverscrollMinimumThresholdStart, 0); | |
| 663 registry->RegisterDoublePref(kOverscrollMinimumThresholdStartTouchpad, 0); | |
| 664 registry->RegisterDoublePref(kOverscrollVerticalThresholdStart, 0); | |
| 665 registry->RegisterDoublePref(kOverscrollHorizontalResistThreshold, 0); | |
| 666 registry->RegisterDoublePref(kOverscrollVerticalResistThreshold, 0); | |
| 667 #endif // defined(USE_AURA) | |
| 668 | |
| 669 registry->RegisterListPref(kURLsToRestoreOnStartupOld); | |
| 670 registry->RegisterInt64Pref(kRestoreStartupURLsMigrationTime, 0); | |
| 671 registry->RegisterBooleanPref(kRestoreOnStartupMigrated, false); | |
| 672 | |
| 673 #if BUILDFLAG(ENABLE_GOOGLE_NOW) | 619 #if BUILDFLAG(ENABLE_GOOGLE_NOW) |
| 674 registry->RegisterBooleanPref(kGoogleGeolocationAccessEnabled, false); | 620 registry->RegisterBooleanPref(kGoogleGeolocationAccessEnabled, false); |
| 675 #endif | 621 #endif |
| 676 | 622 |
| 677 registry->RegisterBooleanPref(kCheckDefaultBrowser, true); | 623 registry->RegisterBooleanPref(kCheckDefaultBrowser, true); |
| 678 | 624 |
| 679 registry->RegisterBooleanPref(kDesktopSearchRedirectionInfobarShownPref, | 625 registry->RegisterBooleanPref(kDesktopSearchRedirectionInfobarShownPref, |
| 680 false); | 626 false); |
| 681 | 627 |
| 682 registry->RegisterBooleanPref(kNetworkPredictionEnabled, true); | 628 registry->RegisterBooleanPref(kNetworkPredictionEnabled, true); |
| 683 registry->RegisterBooleanPref(kDisableSpdy, false); | 629 registry->RegisterBooleanPref(kDisableSpdy, false); |
| 684 registry->RegisterStringPref(kStaticEncodings, std::string()); | 630 registry->RegisterStringPref(kStaticEncodings, std::string()); |
| 685 registry->RegisterStringPref(kRecentlySelectedEncoding, std::string()); | 631 registry->RegisterStringPref(kRecentlySelectedEncoding, std::string()); |
| 686 registry->RegisterBooleanPref(kWebKitUsesUniversalDetector, true); | 632 registry->RegisterBooleanPref(kWebKitUsesUniversalDetector, true); |
| 687 | 633 |
| 688 registry->RegisterBooleanPref(kWebKitAllowDisplayingInsecureContent, true); | 634 registry->RegisterBooleanPref(kWebKitAllowDisplayingInsecureContent, true); |
| 635 |
| 636 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 637 registry->RegisterDictionaryPref(kToolbarMigratedComponentActionStatus); |
| 638 #endif |
| 689 } | 639 } |
| 690 | 640 |
| 691 void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 641 void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 692 RegisterProfilePrefs(registry); | 642 RegisterProfilePrefs(registry); |
| 693 | 643 |
| 694 #if defined(OS_CHROMEOS) | 644 #if defined(OS_CHROMEOS) |
| 695 chromeos::PowerPrefs::RegisterUserProfilePrefs(registry); | 645 chromeos::PowerPrefs::RegisterUserProfilePrefs(registry); |
| 696 #endif | 646 #endif |
| 697 | 647 |
| 698 #if defined(OS_ANDROID) | 648 #if defined(OS_ANDROID) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 const PrefService::Preference* hide_pref = | 682 const PrefService::Preference* hide_pref = |
| 733 profile_prefs->FindPreference(prefs::kHideFullscreenToolbar); | 683 profile_prefs->FindPreference(prefs::kHideFullscreenToolbar); |
| 734 if (!hide_pref->IsDefaultValue()) { | 684 if (!hide_pref->IsDefaultValue()) { |
| 735 bool hide_pref_value = | 685 bool hide_pref_value = |
| 736 profile_prefs->GetBoolean(prefs::kHideFullscreenToolbar); | 686 profile_prefs->GetBoolean(prefs::kHideFullscreenToolbar); |
| 737 profile_prefs->SetBoolean(prefs::kShowFullscreenToolbar, !hide_pref_value); | 687 profile_prefs->SetBoolean(prefs::kShowFullscreenToolbar, !hide_pref_value); |
| 738 profile_prefs->ClearPref(prefs::kHideFullscreenToolbar); | 688 profile_prefs->ClearPref(prefs::kHideFullscreenToolbar); |
| 739 } | 689 } |
| 740 #endif | 690 #endif |
| 741 | 691 |
| 742 // Added 12/1015. | |
| 743 profile_prefs->ClearPref(kURLsToRestoreOnStartupOld); | |
| 744 profile_prefs->ClearPref(kRestoreStartupURLsMigrationTime); | |
| 745 | |
| 746 // Added 12/2015. | |
| 747 profile_prefs->ClearPref(kRestoreOnStartupMigrated); | |
| 748 | |
| 749 #if defined(USE_AURA) | |
| 750 // Added 1/2016 | |
| 751 profile_prefs->ClearPref(kFlingMaxCancelToDownTimeInMs); | |
| 752 profile_prefs->ClearPref(kFlingMaxTapGapTimeInMs); | |
| 753 profile_prefs->ClearPref(kTabScrubActivationDelayInMs); | |
| 754 profile_prefs->ClearPref(kMaxSeparationForGestureTouchesInPixels); | |
| 755 profile_prefs->ClearPref(kSemiLongPressTimeInMs); | |
| 756 profile_prefs->ClearPref(kOverscrollHorizontalThresholdComplete); | |
| 757 profile_prefs->ClearPref(kOverscrollVerticalThresholdComplete); | |
| 758 profile_prefs->ClearPref(kOverscrollMinimumThresholdStart); | |
| 759 profile_prefs->ClearPref(kOverscrollMinimumThresholdStartTouchpad); | |
| 760 profile_prefs->ClearPref(kOverscrollVerticalThresholdStart); | |
| 761 profile_prefs->ClearPref(kOverscrollHorizontalResistThreshold); | |
| 762 profile_prefs->ClearPref(kOverscrollVerticalResistThreshold); | |
| 763 #endif // defined(USE_AURA) | |
| 764 | |
| 765 #if BUILDFLAG(ENABLE_GOOGLE_NOW) | 692 #if BUILDFLAG(ENABLE_GOOGLE_NOW) |
| 766 // Added 3/2016. | 693 // Added 3/2016. |
| 767 profile_prefs->ClearPref(kGoogleGeolocationAccessEnabled); | 694 profile_prefs->ClearPref(kGoogleGeolocationAccessEnabled); |
| 768 #endif | 695 #endif |
| 769 | 696 |
| 770 // Added 4/2016. | 697 // Added 4/2016. |
| 771 if (!profile_prefs->GetBoolean(kCheckDefaultBrowser)) { | 698 if (!profile_prefs->GetBoolean(kCheckDefaultBrowser)) { |
| 772 // Seed kDefaultBrowserLastDeclined with the install date. | 699 // Seed kDefaultBrowserLastDeclined with the install date. |
| 773 metrics::MetricsService* metrics_service = | 700 metrics::MetricsService* metrics_service = |
| 774 g_browser_process->metrics_service(); | 701 g_browser_process->metrics_service(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 789 profile_prefs->ClearPref(kNetworkPredictionEnabled); | 716 profile_prefs->ClearPref(kNetworkPredictionEnabled); |
| 790 profile_prefs->ClearPref(kDisableSpdy); | 717 profile_prefs->ClearPref(kDisableSpdy); |
| 791 | 718 |
| 792 // Added 8/2016. | 719 // Added 8/2016. |
| 793 profile_prefs->ClearPref(kStaticEncodings); | 720 profile_prefs->ClearPref(kStaticEncodings); |
| 794 profile_prefs->ClearPref(kRecentlySelectedEncoding); | 721 profile_prefs->ClearPref(kRecentlySelectedEncoding); |
| 795 | 722 |
| 796 // Added 9/2016. | 723 // Added 9/2016. |
| 797 profile_prefs->ClearPref(kWebKitUsesUniversalDetector); | 724 profile_prefs->ClearPref(kWebKitUsesUniversalDetector); |
| 798 profile_prefs->ClearPref(kWebKitAllowDisplayingInsecureContent); | 725 profile_prefs->ClearPref(kWebKitAllowDisplayingInsecureContent); |
| 726 |
| 727 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 728 // Added 2/2017. |
| 729 profile_prefs->ClearPref(kToolbarMigratedComponentActionStatus); |
| 730 #endif |
| 799 } | 731 } |
| 800 | 732 |
| 801 } // namespace chrome | 733 } // namespace chrome |
| OLD | NEW |