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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "chrome/browser/prefs/origin_trial_prefs.h" | 44 #include "chrome/browser/prefs/origin_trial_prefs.h" |
45 #include "chrome/browser/prefs/session_startup_pref.h" | 45 #include "chrome/browser/prefs/session_startup_pref.h" |
46 #include "chrome/browser/profiles/chrome_version_service.h" | 46 #include "chrome/browser/profiles/chrome_version_service.h" |
47 #include "chrome/browser/profiles/net_http_session_params_observer.h" | 47 #include "chrome/browser/profiles/net_http_session_params_observer.h" |
48 #include "chrome/browser/profiles/profile.h" | 48 #include "chrome/browser/profiles/profile.h" |
49 #include "chrome/browser/profiles/profile_impl.h" | 49 #include "chrome/browser/profiles/profile_impl.h" |
50 #include "chrome/browser/profiles/profile_info_cache.h" | 50 #include "chrome/browser/profiles/profile_info_cache.h" |
51 #include "chrome/browser/profiles/profiles_state.h" | 51 #include "chrome/browser/profiles/profiles_state.h" |
52 #include "chrome/browser/push_messaging/push_messaging_app_identifier.h" | 52 #include "chrome/browser/push_messaging/push_messaging_app_identifier.h" |
53 #include "chrome/browser/renderer_host/pepper/device_id_fetcher.h" | 53 #include "chrome/browser/renderer_host/pepper/device_id_fetcher.h" |
| 54 #include "chrome/browser/rlz/chrome_rlz_tracker_delegate.h" |
54 #include "chrome/browser/search/search.h" | 55 #include "chrome/browser/search/search.h" |
55 #include "chrome/browser/signin/signin_manager_factory.h" | 56 #include "chrome/browser/signin/signin_manager_factory.h" |
56 #include "chrome/browser/task_manager/task_manager_interface.h" | 57 #include "chrome/browser/task_manager/task_manager_interface.h" |
57 #include "chrome/browser/tracing/chrome_tracing_delegate.h" | 58 #include "chrome/browser/tracing/chrome_tracing_delegate.h" |
58 #include "chrome/browser/ui/app_list/app_list_service.h" | 59 #include "chrome/browser/ui/app_list/app_list_service.h" |
59 #include "chrome/browser/ui/browser_ui_prefs.h" | 60 #include "chrome/browser/ui/browser_ui_prefs.h" |
60 #include "chrome/browser/ui/navigation_correction_tab_observer.h" | 61 #include "chrome/browser/ui/navigation_correction_tab_observer.h" |
61 #include "chrome/browser/ui/network_profile_bubble.h" | 62 #include "chrome/browser/ui/network_profile_bubble.h" |
62 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" | 63 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" |
63 #include "chrome/browser/ui/search_engines/keyword_editor_controller.h" | 64 #include "chrome/browser/ui/search_engines/keyword_editor_controller.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 #include "components/translate/core/browser/language_model.h" | 106 #include "components/translate/core/browser/language_model.h" |
106 #include "components/translate/core/browser/translate_prefs.h" | 107 #include "components/translate/core/browser/translate_prefs.h" |
107 #include "components/update_client/update_client.h" | 108 #include "components/update_client/update_client.h" |
108 #include "components/variations/service/variations_service.h" | 109 #include "components/variations/service/variations_service.h" |
109 #include "content/public/browser/browser_thread.h" | 110 #include "content/public/browser/browser_thread.h" |
110 #include "content/public/browser/render_process_host.h" | 111 #include "content/public/browser/render_process_host.h" |
111 #include "extensions/features/features.h" | 112 #include "extensions/features/features.h" |
112 #include "net/http/http_server_properties_manager.h" | 113 #include "net/http/http_server_properties_manager.h" |
113 #include "ppapi/features/features.h" | 114 #include "ppapi/features/features.h" |
114 #include "printing/features/features.h" | 115 #include "printing/features/features.h" |
| 116 #include "rlz/features/features.h" |
115 | 117 |
116 #if BUILDFLAG(ENABLE_APP_LIST) | 118 #if BUILDFLAG(ENABLE_APP_LIST) |
117 #include "chrome/browser/apps/drive/drive_app_mapping.h" | 119 #include "chrome/browser/apps/drive/drive_app_mapping.h" |
118 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" | 120 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" |
119 #endif | 121 #endif |
120 | 122 |
121 #if BUILDFLAG(ENABLE_BACKGROUND) | 123 #if BUILDFLAG(ENABLE_BACKGROUND) |
122 #include "chrome/browser/background/background_mode_manager.h" | 124 #include "chrome/browser/background/background_mode_manager.h" |
123 #endif | 125 #endif |
124 | 126 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 #endif | 257 #endif |
256 | 258 |
257 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 259 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
258 #include "chrome/browser/ui/webui/md_history_ui.h" | 260 #include "chrome/browser/ui/webui/md_history_ui.h" |
259 #endif | 261 #endif |
260 | 262 |
261 namespace { | 263 namespace { |
262 | 264 |
263 #if BUILDFLAG(ENABLE_GOOGLE_NOW) | 265 #if BUILDFLAG(ENABLE_GOOGLE_NOW) |
264 // Deprecated 3/2016 | 266 // Deprecated 3/2016 |
265 const char kGoogleGeolocationAccessEnabled[] = | 267 constexpr char kGoogleGeolocationAccessEnabled[] = |
266 "googlegeolocationaccess.enabled"; | 268 "googlegeolocationaccess.enabled"; |
267 #endif | 269 #endif |
268 | 270 |
269 // Deprecated 4/2016. | 271 // Deprecated 4/2016. |
270 const char kCheckDefaultBrowser[] = "browser.check_default_browser"; | 272 constexpr char kCheckDefaultBrowser[] = "browser.check_default_browser"; |
271 | 273 |
272 // Deprecated 5/2016. | 274 // Deprecated 5/2016. |
273 const char kDesktopSearchRedirectionInfobarShownPref[] = | 275 constexpr char kDesktopSearchRedirectionInfobarShownPref[] = |
274 "desktop_search_redirection_infobar_shown"; | 276 "desktop_search_redirection_infobar_shown"; |
275 | 277 |
276 // Deprecated 7/2016. | 278 // Deprecated 7/2016. |
277 const char kNetworkPredictionEnabled[] = "dns_prefetching.enabled"; | 279 constexpr char kNetworkPredictionEnabled[] = "dns_prefetching.enabled"; |
278 const char kDisableSpdy[] = "spdy.disabled"; | 280 constexpr char kDisableSpdy[] = "spdy.disabled"; |
279 | 281 |
280 // Deprecated 8/2016. | 282 // Deprecated 8/2016. |
281 const char kRecentlySelectedEncoding[] = "profile.recently_selected_encodings"; | 283 constexpr char kRecentlySelectedEncoding[] = |
282 const char kStaticEncodings[] = "intl.static_encodings"; | 284 "profile.recently_selected_encodings"; |
| 285 constexpr char kStaticEncodings[] = "intl.static_encodings"; |
283 | 286 |
284 // Deprecated 9/2016. | 287 // Deprecated 9/2016. |
285 const char kWebKitUsesUniversalDetector[] = | 288 constexpr char kWebKitUsesUniversalDetector[] = |
286 "webkit.webprefs.uses_universal_detector"; | 289 "webkit.webprefs.uses_universal_detector"; |
287 const char kWebKitAllowDisplayingInsecureContent[] = | 290 constexpr char kWebKitAllowDisplayingInsecureContent[] = |
288 "webkit.webprefs.allow_displaying_insecure_content"; | 291 "webkit.webprefs.allow_displaying_insecure_content"; |
289 | 292 |
290 #if BUILDFLAG(ENABLE_EXTENSIONS) | 293 #if BUILDFLAG(ENABLE_EXTENSIONS) |
291 // Deprecated 2/2017. | 294 // Deprecated 2/2017. |
292 const char kToolbarMigratedComponentActionStatus[] = | 295 constexpr char kToolbarMigratedComponentActionStatus[] = |
293 "toolbar_migrated_component_action_status"; | 296 "toolbar_migrated_component_action_status"; |
294 #endif | 297 #endif |
295 | 298 |
| 299 #if BUILDFLAG(ENABLE_RLZ) |
| 300 // Migrated out of kDistroDict as of 2/2017. |
| 301 constexpr char kDistroRlzPingDelay[] = "ping_delay"; |
| 302 #endif // BUILDFLAG(ENABLE_RLZ) |
| 303 |
| 304 // master_preferences used to be mapped as-is to Preferences on first run but |
| 305 // the "distribution" dictionary was never used beyond first run. It is now |
| 306 // stripped in first_run.cc prior to applying this mapping. Cleanup for existing |
| 307 // Preferences files added here 2/2017. |
| 308 constexpr char kDistroDict[] = "distribution"; |
| 309 |
296 void DeleteWebRTCIdentityStoreDBOnFileThread( | 310 void DeleteWebRTCIdentityStoreDBOnFileThread( |
297 const base::FilePath& profile_path) { | 311 const base::FilePath& profile_path) { |
298 base::DeleteFile(profile_path.Append( | 312 base::DeleteFile(profile_path.Append( |
299 FILE_PATH_LITERAL("WebRTCIdentityStore")), false); | 313 FILE_PATH_LITERAL("WebRTCIdentityStore")), false); |
300 base::DeleteFile(profile_path.Append( | 314 base::DeleteFile(profile_path.Append( |
301 FILE_PATH_LITERAL("WebRTCIdentityStore-journal")), false); | 315 FILE_PATH_LITERAL("WebRTCIdentityStore-journal")), false); |
302 } | 316 } |
303 | 317 |
304 void DeleteWebRTCIdentityStoreDB(const Profile& profile) { | 318 void DeleteWebRTCIdentityStoreDB(const Profile& profile) { |
305 content::BrowserThread::PostDelayedTask( | 319 content::BrowserThread::PostDelayedTask( |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 AppShortcutManager::RegisterProfilePrefs(registry); | 553 AppShortcutManager::RegisterProfilePrefs(registry); |
540 DeviceIDFetcher::RegisterProfilePrefs(registry); | 554 DeviceIDFetcher::RegisterProfilePrefs(registry); |
541 DevToolsWindow::RegisterProfilePrefs(registry); | 555 DevToolsWindow::RegisterProfilePrefs(registry); |
542 #if BUILDFLAG(ENABLE_APP_LIST) | 556 #if BUILDFLAG(ENABLE_APP_LIST) |
543 DriveAppMapping::RegisterProfilePrefs(registry); | 557 DriveAppMapping::RegisterProfilePrefs(registry); |
544 app_list::AppListSyncableService::RegisterProfilePrefs(registry); | 558 app_list::AppListSyncableService::RegisterProfilePrefs(registry); |
545 #endif | 559 #endif |
546 extensions::CommandService::RegisterProfilePrefs(registry); | 560 extensions::CommandService::RegisterProfilePrefs(registry); |
547 extensions::ExtensionSettingsHandler::RegisterProfilePrefs(registry); | 561 extensions::ExtensionSettingsHandler::RegisterProfilePrefs(registry); |
548 extensions::TabsCaptureVisibleTabFunction::RegisterProfilePrefs(registry); | 562 extensions::TabsCaptureVisibleTabFunction::RegisterProfilePrefs(registry); |
549 first_run::RegisterProfilePrefs(registry); | |
550 NewTabUI::RegisterProfilePrefs(registry); | 563 NewTabUI::RegisterProfilePrefs(registry); |
551 PepperFlashSettingsManager::RegisterProfilePrefs(registry); | 564 PepperFlashSettingsManager::RegisterProfilePrefs(registry); |
552 PinnedTabCodec::RegisterProfilePrefs(registry); | 565 PinnedTabCodec::RegisterProfilePrefs(registry); |
553 signin::RegisterProfilePrefs(registry); | 566 signin::RegisterProfilePrefs(registry); |
554 #endif | 567 #endif |
555 | 568 |
556 #if defined(OS_ANDROID) | 569 #if defined(OS_ANDROID) |
557 ContentSuggestionsNotifierService::RegisterProfilePrefs(registry); | 570 ContentSuggestionsNotifierService::RegisterProfilePrefs(registry); |
558 DownloadSuggestionsProvider::RegisterProfilePrefs(registry); | 571 DownloadSuggestionsProvider::RegisterProfilePrefs(registry); |
559 ntp_snippets::ClickBasedCategoryRanker::RegisterProfilePrefs(registry); | 572 ntp_snippets::ClickBasedCategoryRanker::RegisterProfilePrefs(registry); |
(...skipping 30 matching lines...) Expand all Loading... |
590 extensions::EPKPChallengeUserKey::RegisterProfilePrefs(registry); | 603 extensions::EPKPChallengeUserKey::RegisterProfilePrefs(registry); |
591 flags_ui::PrefServiceFlagsStorage::RegisterProfilePrefs(registry); | 604 flags_ui::PrefServiceFlagsStorage::RegisterProfilePrefs(registry); |
592 policy::DeviceStatusCollector::RegisterProfilePrefs(registry); | 605 policy::DeviceStatusCollector::RegisterProfilePrefs(registry); |
593 ::onc::RegisterProfilePrefs(registry); | 606 ::onc::RegisterProfilePrefs(registry); |
594 #endif | 607 #endif |
595 | 608 |
596 #if defined(OS_CHROMEOS) && BUILDFLAG(ENABLE_APP_LIST) | 609 #if defined(OS_CHROMEOS) && BUILDFLAG(ENABLE_APP_LIST) |
597 ArcAppListPrefs::RegisterProfilePrefs(registry); | 610 ArcAppListPrefs::RegisterProfilePrefs(registry); |
598 #endif | 611 #endif |
599 | 612 |
| 613 #if BUILDFLAG(ENABLE_RLZ) |
| 614 ChromeRLZTrackerDelegate::RegisterProfilePrefs(registry); |
| 615 #endif |
| 616 |
600 #if defined(OS_WIN) | 617 #if defined(OS_WIN) |
601 component_updater::RegisterProfilePrefsForSwReporter(registry); | 618 component_updater::RegisterProfilePrefsForSwReporter(registry); |
602 desktop_ios_promotion::RegisterProfilePrefs(registry); | 619 desktop_ios_promotion::RegisterProfilePrefs(registry); |
603 NetworkProfileBubble::RegisterProfilePrefs(registry); | 620 NetworkProfileBubble::RegisterProfilePrefs(registry); |
604 #endif | 621 #endif |
605 | 622 |
606 #if defined(TOOLKIT_VIEWS) | 623 #if defined(TOOLKIT_VIEWS) |
607 RegisterBrowserViewProfilePrefs(registry); | 624 RegisterBrowserViewProfilePrefs(registry); |
608 RegisterInvertBubbleUserPrefs(registry); | 625 RegisterInvertBubbleUserPrefs(registry); |
609 #endif | 626 #endif |
(...skipping 22 matching lines...) Expand all Loading... |
632 registry->RegisterBooleanPref(kDisableSpdy, false); | 649 registry->RegisterBooleanPref(kDisableSpdy, false); |
633 registry->RegisterStringPref(kStaticEncodings, std::string()); | 650 registry->RegisterStringPref(kStaticEncodings, std::string()); |
634 registry->RegisterStringPref(kRecentlySelectedEncoding, std::string()); | 651 registry->RegisterStringPref(kRecentlySelectedEncoding, std::string()); |
635 registry->RegisterBooleanPref(kWebKitUsesUniversalDetector, true); | 652 registry->RegisterBooleanPref(kWebKitUsesUniversalDetector, true); |
636 | 653 |
637 registry->RegisterBooleanPref(kWebKitAllowDisplayingInsecureContent, true); | 654 registry->RegisterBooleanPref(kWebKitAllowDisplayingInsecureContent, true); |
638 | 655 |
639 #if BUILDFLAG(ENABLE_EXTENSIONS) | 656 #if BUILDFLAG(ENABLE_EXTENSIONS) |
640 registry->RegisterDictionaryPref(kToolbarMigratedComponentActionStatus); | 657 registry->RegisterDictionaryPref(kToolbarMigratedComponentActionStatus); |
641 #endif | 658 #endif |
| 659 |
| 660 registry->RegisterDictionaryPref(kDistroDict); |
642 } | 661 } |
643 | 662 |
644 void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 663 void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
645 RegisterProfilePrefs(registry); | 664 RegisterProfilePrefs(registry); |
646 | 665 |
647 #if defined(OS_CHROMEOS) | 666 #if defined(OS_CHROMEOS) |
648 chromeos::PowerPrefs::RegisterUserProfilePrefs(registry); | 667 chromeos::PowerPrefs::RegisterUserProfilePrefs(registry); |
649 #endif | 668 #endif |
650 | 669 |
651 #if defined(OS_ANDROID) | 670 #if defined(OS_ANDROID) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 profile_prefs->ClearPref(kRecentlySelectedEncoding); | 743 profile_prefs->ClearPref(kRecentlySelectedEncoding); |
725 | 744 |
726 // Added 9/2016. | 745 // Added 9/2016. |
727 profile_prefs->ClearPref(kWebKitUsesUniversalDetector); | 746 profile_prefs->ClearPref(kWebKitUsesUniversalDetector); |
728 profile_prefs->ClearPref(kWebKitAllowDisplayingInsecureContent); | 747 profile_prefs->ClearPref(kWebKitAllowDisplayingInsecureContent); |
729 | 748 |
730 #if BUILDFLAG(ENABLE_EXTENSIONS) | 749 #if BUILDFLAG(ENABLE_EXTENSIONS) |
731 // Added 2/2017. | 750 // Added 2/2017. |
732 profile_prefs->ClearPref(kToolbarMigratedComponentActionStatus); | 751 profile_prefs->ClearPref(kToolbarMigratedComponentActionStatus); |
733 #endif | 752 #endif |
| 753 |
| 754 // Added 2/2017. |
| 755 { |
| 756 #if BUILDFLAG(ENABLE_RLZ) |
| 757 const base::DictionaryValue* distro_dict = |
| 758 profile_prefs->GetDictionary(kDistroDict); |
| 759 int rlz_ping_delay = 0; |
| 760 if (distro_dict && |
| 761 distro_dict->GetInteger(kDistroRlzPingDelay, &rlz_ping_delay)) { |
| 762 profile_prefs->SetInteger(prefs::kRlzPingDelaySeconds, rlz_ping_delay); |
| 763 } |
| 764 #endif // BUILDFLAG(ENABLE_RLZ) |
| 765 profile_prefs->ClearPref(kDistroDict); |
| 766 } |
734 } | 767 } |
735 | 768 |
736 } // namespace chrome | 769 } // namespace chrome |
OLD | NEW |