| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 #include "components/sync/driver/sync_prefs.h" | 97 #include "components/sync/driver/sync_prefs.h" |
| 98 #include "components/syncable_prefs/pref_service_syncable.h" | 98 #include "components/syncable_prefs/pref_service_syncable.h" |
| 99 #include "components/translate/core/browser/translate_prefs.h" | 99 #include "components/translate/core/browser/translate_prefs.h" |
| 100 #include "components/update_client/update_client.h" | 100 #include "components/update_client/update_client.h" |
| 101 #include "components/variations/service/variations_service.h" | 101 #include "components/variations/service/variations_service.h" |
| 102 #include "components/web_resource/promo_resource_service.h" | 102 #include "components/web_resource/promo_resource_service.h" |
| 103 #include "content/public/browser/browser_thread.h" | 103 #include "content/public/browser/browser_thread.h" |
| 104 #include "content/public/browser/render_process_host.h" | 104 #include "content/public/browser/render_process_host.h" |
| 105 #include "net/http/http_server_properties_manager.h" | 105 #include "net/http/http_server_properties_manager.h" |
| 106 | 106 |
| 107 #if defined(ENABLE_APP_LIST) |
| 108 #include "chrome/browser/apps/drive/drive_app_mapping.h" |
| 109 #endif |
| 110 |
| 107 #if BUILDFLAG(ENABLE_BACKGROUND) | 111 #if BUILDFLAG(ENABLE_BACKGROUND) |
| 108 #include "chrome/browser/background/background_mode_manager.h" | 112 #include "chrome/browser/background/background_mode_manager.h" |
| 109 #endif | 113 #endif |
| 110 | 114 |
| 111 #if defined(ENABLE_EXTENSIONS) | 115 #if defined(ENABLE_EXTENSIONS) |
| 112 #include "chrome/browser/accessibility/animation_policy_prefs.h" | 116 #include "chrome/browser/accessibility/animation_policy_prefs.h" |
| 113 #include "chrome/browser/apps/shortcut_manager.h" | 117 #include "chrome/browser/apps/shortcut_manager.h" |
| 114 #include "chrome/browser/extensions/activity_log/activity_log.h" | 118 #include "chrome/browser/extensions/activity_log/activity_log.h" |
| 115 #include "chrome/browser/extensions/api/commands/command_service.h" | 119 #include "chrome/browser/extensions/api/commands/command_service.h" |
| 116 #include "chrome/browser/extensions/api/tabs/tabs_api.h" | 120 #include "chrome/browser/extensions/api/tabs/tabs_api.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 143 #if BUILDFLAG(ANDROID_JAVA_UI) | 147 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 144 #include "chrome/browser/android/bookmarks/partner_bookmarks_shim.h" | 148 #include "chrome/browser/android/bookmarks/partner_bookmarks_shim.h" |
| 145 #include "chrome/browser/android/ntp/new_tab_page_prefs.h" | 149 #include "chrome/browser/android/ntp/new_tab_page_prefs.h" |
| 146 #include "components/ntp_tiles/most_visited_sites.h" | 150 #include "components/ntp_tiles/most_visited_sites.h" |
| 147 #include "components/ntp_tiles/popular_sites.h" | 151 #include "components/ntp_tiles/popular_sites.h" |
| 148 #else | 152 #else |
| 149 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 153 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 150 #include "chrome/browser/upgrade_detector.h" | 154 #include "chrome/browser/upgrade_detector.h" |
| 151 #endif | 155 #endif |
| 152 | 156 |
| 153 #if !defined(OS_ANDROID) | 157 #if defined(OS_ANDROID) |
| 158 #include "chrome/browser/notifications/notification_platform_bridge_android.h" |
| 159 #include "components/ntp_snippets/offline_pages/offline_page_suggestions_provide
r.h" |
| 160 #else |
| 154 #include "chrome/browser/services/gcm/gcm_product_util.h" | 161 #include "chrome/browser/services/gcm/gcm_product_util.h" |
| 155 #include "chrome/browser/signin/signin_promo.h" | 162 #include "chrome/browser/signin/signin_promo.h" |
| 156 #include "chrome/browser/ui/webui/foreign_session_handler.h" | 163 #include "chrome/browser/ui/webui/foreign_session_handler.h" |
| 157 #endif | 164 #endif |
| 158 | 165 |
| 159 #if defined(OS_CHROMEOS) | 166 #if defined(OS_CHROMEOS) |
| 160 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 167 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 161 #include "chrome/browser/chromeos/arc/arc_auth_service.h" | 168 #include "chrome/browser/chromeos/arc/arc_auth_service.h" |
| 162 #include "chrome/browser/chromeos/customization/customization_document.h" | 169 #include "chrome/browser/chromeos/customization/customization_document.h" |
| 163 #include "chrome/browser/chromeos/display/display_preferences.h" | 170 #include "chrome/browser/chromeos/display/display_preferences.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 #include "chrome/browser/ui/webui/chromeos/login/reset_screen_handler.h" | 205 #include "chrome/browser/ui/webui/chromeos/login/reset_screen_handler.h" |
| 199 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 206 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
| 200 #include "chromeos/audio/audio_devices_pref_handler_impl.h" | 207 #include "chromeos/audio/audio_devices_pref_handler_impl.h" |
| 201 #include "chromeos/timezone/timezone_resolver.h" | 208 #include "chromeos/timezone/timezone_resolver.h" |
| 202 #include "components/invalidation/impl/invalidator_storage.h" | 209 #include "components/invalidation/impl/invalidator_storage.h" |
| 203 #include "components/quirks/quirks_manager.h" | 210 #include "components/quirks/quirks_manager.h" |
| 204 #else | 211 #else |
| 205 #include "chrome/browser/extensions/default_apps.h" | 212 #include "chrome/browser/extensions/default_apps.h" |
| 206 #endif | 213 #endif |
| 207 | 214 |
| 208 #if defined(OS_ANDROID) | |
| 209 #include "chrome/browser/notifications/notification_platform_bridge_android.h" | |
| 210 #include "components/ntp_snippets/offline_pages/offline_page_suggestions_provide
r.h" | |
| 211 #endif | |
| 212 | |
| 213 #if defined(OS_CHROMEOS) && defined(ENABLE_APP_LIST) | 215 #if defined(OS_CHROMEOS) && defined(ENABLE_APP_LIST) |
| 214 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 216 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 215 #endif | 217 #endif |
| 216 | 218 |
| 217 #if defined(OS_MACOSX) | 219 #if defined(OS_MACOSX) |
| 218 #include "chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac.h" | 220 #include "chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac.h" |
| 219 #include "chrome/browser/ui/cocoa/confirm_quit.h" | 221 #include "chrome/browser/ui/cocoa/confirm_quit.h" |
| 220 #endif | 222 #endif |
| 221 | 223 |
| 222 #if defined(OS_WIN) | 224 #if defined(OS_WIN) |
| 223 #include "chrome/browser/apps/app_launch_for_metro_restart_win.h" | 225 #include "chrome/browser/apps/app_launch_for_metro_restart_win.h" |
| 224 #include "chrome/browser/component_updater/sw_reporter_installer_win.h" | 226 #include "chrome/browser/component_updater/sw_reporter_installer_win.h" |
| 225 #endif | 227 #endif |
| 226 | 228 |
| 229 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) |
| 230 #include "chrome/browser/ui/startup/default_browser_prompt.h" |
| 231 #endif |
| 232 |
| 227 #if defined(TOOLKIT_VIEWS) | 233 #if defined(TOOLKIT_VIEWS) |
| 228 #include "chrome/browser/ui/browser_view_prefs.h" | 234 #include "chrome/browser/ui/browser_view_prefs.h" |
| 229 #endif | 235 #endif |
| 230 | 236 |
| 231 #if defined(USE_ASH) | 237 #if defined(USE_ASH) |
| 232 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" | 238 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
| 233 #endif | 239 #endif |
| 234 | 240 |
| 235 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) | |
| 236 #include "chrome/browser/ui/startup/default_browser_prompt.h" | |
| 237 #endif | |
| 238 | |
| 239 #if defined(ENABLE_APP_LIST) | |
| 240 #include "chrome/browser/apps/drive/drive_app_mapping.h" | |
| 241 #endif | |
| 242 | |
| 243 namespace { | 241 namespace { |
| 244 | 242 |
| 245 #if defined(OS_WIN) | 243 #if defined(OS_WIN) |
| 246 // Deprecated 11/2015 (M48). TODO(gab): delete in M52+. | 244 // Deprecated 11/2015 (M48). TODO(gab): delete in M52+. |
| 247 const char kShownAutoLaunchInfobarDeprecated[] = | 245 const char kShownAutoLaunchInfobarDeprecated[] = |
| 248 "browser.shown_autolaunch_infobar"; | 246 "browser.shown_autolaunch_infobar"; |
| 249 #endif // defined(OS_WIN) | 247 #endif // defined(OS_WIN) |
| 250 | 248 |
| 251 // The SessionStartupPref used this pref to store the list of URLs to restore | 249 // The SessionStartupPref used this pref to store the list of URLs to restore |
| 252 // on startup, and then renamed it to "sessions.startup_urls" in M31. Migration | 250 // on startup, and then renamed it to "sessions.startup_urls" in M31. Migration |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 const char kCheckDefaultBrowser[] = "browser.check_default_browser"; | 294 const char kCheckDefaultBrowser[] = "browser.check_default_browser"; |
| 297 | 295 |
| 298 // Deprecated 5/2016. | 296 // Deprecated 5/2016. |
| 299 const char kDesktopSearchRedirectionInfobarShownPref[] = | 297 const char kDesktopSearchRedirectionInfobarShownPref[] = |
| 300 "desktop_search_redirection_infobar_shown"; | 298 "desktop_search_redirection_infobar_shown"; |
| 301 | 299 |
| 302 // Deprecated 7/2016. | 300 // Deprecated 7/2016. |
| 303 const char kNetworkPredictionEnabled[] = "dns_prefetching.enabled"; | 301 const char kNetworkPredictionEnabled[] = "dns_prefetching.enabled"; |
| 304 const char kDisableSpdy[] = "spdy.disabled"; | 302 const char kDisableSpdy[] = "spdy.disabled"; |
| 305 | 303 |
| 306 void DeleteWebRTCIdentityStoreDBOnFileThread(base::FilePath profile_path) { | 304 // Deprecated 8/2016. |
| 305 const char kRecentlySelectedEncoding[] = "profile.recently_selected_encodings"; |
| 306 const char kStaticEncodings[] = "intl.static_encodings"; |
| 307 |
| 308 // Deprecated 9/2016. |
| 309 const char kWebKitUsesUniversalDetector[] = |
| 310 "webkit.webprefs.uses_universal_detector"; |
| 311 |
| 312 void DeleteWebRTCIdentityStoreDBOnFileThread( |
| 313 const base::FilePath& profile_path) { |
| 307 base::DeleteFile(profile_path.Append( | 314 base::DeleteFile(profile_path.Append( |
| 308 FILE_PATH_LITERAL("WebRTCIdentityStore")), false); | 315 FILE_PATH_LITERAL("WebRTCIdentityStore")), false); |
| 309 base::DeleteFile(profile_path.Append( | 316 base::DeleteFile(profile_path.Append( |
| 310 FILE_PATH_LITERAL("WebRTCIdentityStore-journal")), false); | 317 FILE_PATH_LITERAL("WebRTCIdentityStore-journal")), false); |
| 311 } | 318 } |
| 312 | 319 |
| 313 void DeleteWebRTCIdentityStoreDB(Profile* profile) { | 320 void DeleteWebRTCIdentityStoreDB(const Profile& profile) { |
| 314 content::BrowserThread::PostDelayedTask( | 321 content::BrowserThread::PostDelayedTask( |
| 315 content::BrowserThread::FILE, | 322 content::BrowserThread::FILE, |
| 316 FROM_HERE, | 323 FROM_HERE, |
| 317 base::Bind(&DeleteWebRTCIdentityStoreDBOnFileThread, profile->GetPath()), | 324 base::Bind(&DeleteWebRTCIdentityStoreDBOnFileThread, profile.GetPath()), |
| 318 base::TimeDelta::FromSeconds(120)); | 325 base::TimeDelta::FromSeconds(120)); |
| 319 } | 326 } |
| 320 | 327 |
| 321 } // namespace | 328 } // namespace |
| 322 | 329 |
| 323 namespace chrome { | 330 namespace chrome { |
| 324 | 331 |
| 325 void RegisterLocalState(PrefRegistrySimple* registry) { | 332 void RegisterLocalState(PrefRegistrySimple* registry) { |
| 326 // Please keep this list alphabetized. | 333 // Please keep this list alphabetized. |
| 327 AppListService::RegisterPrefs(registry); | 334 AppListService::RegisterPrefs(registry); |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 registry->RegisterBooleanPref(kGoogleGeolocationAccessEnabled, false); | 642 registry->RegisterBooleanPref(kGoogleGeolocationAccessEnabled, false); |
| 636 #endif | 643 #endif |
| 637 | 644 |
| 638 registry->RegisterBooleanPref(kCheckDefaultBrowser, true); | 645 registry->RegisterBooleanPref(kCheckDefaultBrowser, true); |
| 639 | 646 |
| 640 registry->RegisterBooleanPref(kDesktopSearchRedirectionInfobarShownPref, | 647 registry->RegisterBooleanPref(kDesktopSearchRedirectionInfobarShownPref, |
| 641 false); | 648 false); |
| 642 | 649 |
| 643 registry->RegisterBooleanPref(kNetworkPredictionEnabled, true); | 650 registry->RegisterBooleanPref(kNetworkPredictionEnabled, true); |
| 644 registry->RegisterBooleanPref(kDisableSpdy, false); | 651 registry->RegisterBooleanPref(kDisableSpdy, false); |
| 645 registry->RegisterStringPref(prefs::kStaticEncodings, std::string()); | 652 registry->RegisterStringPref(kStaticEncodings, std::string()); |
| 646 registry->RegisterStringPref(prefs::kRecentlySelectedEncoding, std::string()); | 653 registry->RegisterStringPref(kRecentlySelectedEncoding, std::string()); |
| 654 registry->RegisterBooleanPref(kWebKitUsesUniversalDetector, true); |
| 647 } | 655 } |
| 648 | 656 |
| 649 void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 657 void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 650 RegisterProfilePrefs(registry); | 658 RegisterProfilePrefs(registry); |
| 651 | 659 |
| 652 #if defined(OS_CHROMEOS) | 660 #if defined(OS_CHROMEOS) |
| 653 chromeos::PowerPrefs::RegisterUserProfilePrefs(registry); | 661 chromeos::PowerPrefs::RegisterUserProfilePrefs(registry); |
| 654 #endif | 662 #endif |
| 655 } | 663 } |
| 656 | 664 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 : base::Time::Now(); | 742 : base::Time::Now(); |
| 735 profile_prefs->SetInt64(prefs::kDefaultBrowserLastDeclined, | 743 profile_prefs->SetInt64(prefs::kDefaultBrowserLastDeclined, |
| 736 install_time.ToInternalValue()); | 744 install_time.ToInternalValue()); |
| 737 } | 745 } |
| 738 profile_prefs->ClearPref(kCheckDefaultBrowser); | 746 profile_prefs->ClearPref(kCheckDefaultBrowser); |
| 739 | 747 |
| 740 // Added 5/2016. | 748 // Added 5/2016. |
| 741 profile_prefs->ClearPref(kDesktopSearchRedirectionInfobarShownPref); | 749 profile_prefs->ClearPref(kDesktopSearchRedirectionInfobarShownPref); |
| 742 | 750 |
| 743 // Added 7/2016. | 751 // Added 7/2016. |
| 744 DeleteWebRTCIdentityStoreDB(profile); | 752 DeleteWebRTCIdentityStoreDB(*profile); |
| 745 profile_prefs->ClearPref(kNetworkPredictionEnabled); | 753 profile_prefs->ClearPref(kNetworkPredictionEnabled); |
| 746 profile_prefs->ClearPref(kDisableSpdy); | 754 profile_prefs->ClearPref(kDisableSpdy); |
| 747 | 755 |
| 748 // Added 8/2016. | 756 // Added 8/2016. |
| 749 profile_prefs->ClearPref(prefs::kStaticEncodings); | 757 profile_prefs->ClearPref(kStaticEncodings); |
| 750 profile_prefs->ClearPref(prefs::kRecentlySelectedEncoding); | 758 profile_prefs->ClearPref(kRecentlySelectedEncoding); |
| 751 | 759 |
| 752 // Added 9/2016. | 760 // Added 9/2016. |
| 753 profile_prefs->ClearPref(prefs::kWebKitUsesUniversalDetector); | 761 profile_prefs->ClearPref(kWebKitUsesUniversalDetector); |
| 754 } | 762 } |
| 755 | 763 |
| 756 } // namespace chrome | 764 } // namespace chrome |
| OLD | NEW |