| 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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/prefs/pref_registry_simple.h" | 11 #include "base/prefs/pref_registry_simple.h" |
| 12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 13 #include "base/prefs/scoped_user_pref_update.h" | 13 #include "base/prefs/scoped_user_pref_update.h" |
| 14 #include "chrome/browser/about_flags.h" | 14 #include "chrome/browser/about_flags.h" |
| 15 #include "chrome/browser/accessibility/invert_bubble_prefs.h" | 15 #include "chrome/browser/accessibility/invert_bubble_prefs.h" |
| 16 #include "chrome/browser/autocomplete/zero_suggest_provider.h" | 16 #include "chrome/browser/autocomplete/zero_suggest_provider.h" |
| 17 #include "chrome/browser/browser_process_impl.h" | 17 #include "chrome/browser/browser_process_impl.h" |
| 18 #include "chrome/browser/browser_shutdown.h" | 18 #include "chrome/browser/browser_shutdown.h" |
| 19 #include "chrome/browser/chrome_content_browser_client.h" | 19 #include "chrome/browser/chrome_content_browser_client.h" |
| 20 #include "chrome/browser/component_updater/recovery_component_installer.h" | 20 #include "chrome/browser/component_updater/recovery_component_installer.h" |
| 21 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 21 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 22 #include "chrome/browser/devtools/devtools_window.h" | 22 #include "chrome/browser/devtools/devtools_window.h" |
| 23 #include "chrome/browser/download/download_prefs.h" | 23 #include "chrome/browser/download/download_prefs.h" |
| 24 #include "chrome/browser/external_protocol/external_protocol_handler.h" | 24 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
| 25 #include "chrome/browser/first_run/first_run.h" | 25 #include "chrome/browser/first_run/first_run.h" |
| 26 #include "chrome/browser/geolocation/geolocation_prefs.h" | 26 #include "chrome/browser/geolocation/geolocation_prefs.h" |
| 27 #include "chrome/browser/google/google_url_tracker_factory.h" | |
| 28 #include "chrome/browser/gpu/gl_string_manager.h" | 27 #include "chrome/browser/gpu/gl_string_manager.h" |
| 29 #include "chrome/browser/gpu/gpu_mode_manager.h" | 28 #include "chrome/browser/gpu/gpu_mode_manager.h" |
| 30 #include "chrome/browser/intranet_redirect_detector.h" | 29 #include "chrome/browser/intranet_redirect_detector.h" |
| 31 #include "chrome/browser/io_thread.h" | 30 #include "chrome/browser/io_thread.h" |
| 32 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 31 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
| 33 #include "chrome/browser/media/media_device_id_salt.h" | 32 #include "chrome/browser/media/media_device_id_salt.h" |
| 34 #include "chrome/browser/media/media_stream_devices_controller.h" | 33 #include "chrome/browser/media/media_stream_devices_controller.h" |
| 35 #include "chrome/browser/metrics/chrome_metrics_service_client.h" | 34 #include "chrome/browser/metrics/chrome_metrics_service_client.h" |
| 36 #include "chrome/browser/metrics/variations/variations_service.h" | 35 #include "chrome/browser/metrics/variations/variations_service.h" |
| 37 #include "chrome/browser/net/http_server_properties_manager_factory.h" | 36 #include "chrome/browser/net/http_server_properties_manager_factory.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" | 78 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" |
| 80 #include "chrome/browser/upgrade_detector.h" | 79 #include "chrome/browser/upgrade_detector.h" |
| 81 #include "chrome/browser/web_resource/promo_resource_service.h" | 80 #include "chrome/browser/web_resource/promo_resource_service.h" |
| 82 #include "chrome/common/pref_names.h" | 81 #include "chrome/common/pref_names.h" |
| 83 #include "components/autofill/core/browser/autofill_manager.h" | 82 #include "components/autofill/core/browser/autofill_manager.h" |
| 84 #include "components/bookmarks/browser/bookmark_utils.h" | 83 #include "components/bookmarks/browser/bookmark_utils.h" |
| 85 #include "components/content_settings/core/browser/host_content_settings_map.h" | 84 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 86 #include "components/dom_distiller/core/distilled_page_prefs.h" | 85 #include "components/dom_distiller/core/distilled_page_prefs.h" |
| 87 #include "components/enhanced_bookmarks/bookmark_server_cluster_service.h" | 86 #include "components/enhanced_bookmarks/bookmark_server_cluster_service.h" |
| 88 #include "components/gcm_driver/gcm_channel_status_syncer.h" | 87 #include "components/gcm_driver/gcm_channel_status_syncer.h" |
| 89 #include "components/google/core/browser/google_pref_names.h" | |
| 90 #include "components/google/core/browser/google_url_tracker.h" | |
| 91 #include "components/network_time/network_time_tracker.h" | 88 #include "components/network_time/network_time_tracker.h" |
| 92 #include "components/password_manager/core/browser/password_manager.h" | 89 #include "components/password_manager/core/browser/password_manager.h" |
| 93 #include "components/password_manager/core/browser/password_manager_url_collecti
on_experiment.h" | 90 #include "components/password_manager/core/browser/password_manager_url_collecti
on_experiment.h" |
| 94 #include "components/pref_registry/pref_registry_syncable.h" | 91 #include "components/pref_registry/pref_registry_syncable.h" |
| 95 #include "components/rappor/rappor_service.h" | 92 #include "components/rappor/rappor_service.h" |
| 96 #include "components/search_engines/template_url_prepopulate_data.h" | 93 #include "components/search_engines/template_url_prepopulate_data.h" |
| 97 #include "components/sync_driver/sync_prefs.h" | 94 #include "components/sync_driver/sync_prefs.h" |
| 98 #include "components/translate/core/browser/translate_prefs.h" | 95 #include "components/translate/core/browser/translate_prefs.h" |
| 99 #include "content/public/browser/render_process_host.h" | 96 #include "content/public/browser/render_process_host.h" |
| 100 #include "net/http/http_server_properties_manager.h" | 97 #include "net/http/http_server_properties_manager.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 #if !defined(USE_ATHENA) | 213 #if !defined(USE_ATHENA) |
| 217 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 214 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 218 #endif | 215 #endif |
| 219 | 216 |
| 220 namespace { | 217 namespace { |
| 221 | 218 |
| 222 enum MigratedPreferences { | 219 enum MigratedPreferences { |
| 223 NO_PREFS = 0, | 220 NO_PREFS = 0, |
| 224 DNS_PREFS = 1 << 0, | 221 DNS_PREFS = 1 << 0, |
| 225 WINDOWS_PREFS = 1 << 1, | 222 WINDOWS_PREFS = 1 << 1, |
| 226 GOOGLE_URL_TRACKER_PREFS = 1 << 2, | |
| 227 }; | 223 }; |
| 228 | 224 |
| 229 // A previous feature (see | 225 // A previous feature (see |
| 230 // chrome/browser/protector/protected_prefs_watcher.cc in source | 226 // chrome/browser/protector/protected_prefs_watcher.cc in source |
| 231 // control history) used this string as a prefix for various prefs it | 227 // control history) used this string as a prefix for various prefs it |
| 232 // registered. We keep it here for now to clear out those old prefs in | 228 // registered. We keep it here for now to clear out those old prefs in |
| 233 // MigrateUserPrefs. | 229 // MigrateUserPrefs. |
| 234 const char kBackupPref[] = "backup"; | 230 const char kBackupPref[] = "backup"; |
| 235 | 231 |
| 236 #if !defined(OS_ANDROID) | 232 #if !defined(OS_ANDROID) |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 user_prefs->Set(prefs::kBrowserWindowPlacement, | 610 user_prefs->Set(prefs::kBrowserWindowPlacement, |
| 615 *(pref->GetValue())); | 611 *(pref->GetValue())); |
| 616 } | 612 } |
| 617 local_state->ClearPref(prefs::kBrowserWindowPlacement); | 613 local_state->ClearPref(prefs::kBrowserWindowPlacement); |
| 618 | 614 |
| 619 current_version |= WINDOWS_PREFS; | 615 current_version |= WINDOWS_PREFS; |
| 620 local_state->SetInteger(prefs::kMultipleProfilePrefMigration, | 616 local_state->SetInteger(prefs::kMultipleProfilePrefMigration, |
| 621 current_version); | 617 current_version); |
| 622 } | 618 } |
| 623 | 619 |
| 624 if (!(current_version & GOOGLE_URL_TRACKER_PREFS)) { | |
| 625 registry->RegisterStringPref(prefs::kLastKnownGoogleURL, | |
| 626 GoogleURLTracker::kDefaultGoogleHomepage); | |
| 627 if (local_state->HasPrefPath(prefs::kLastKnownGoogleURL)) { | |
| 628 user_prefs->SetString(prefs::kLastKnownGoogleURL, | |
| 629 local_state->GetString(prefs::kLastKnownGoogleURL)); | |
| 630 } | |
| 631 local_state->ClearPref(prefs::kLastKnownGoogleURL); | |
| 632 | |
| 633 registry->RegisterStringPref(prefs::kLastPromptedGoogleURL, | |
| 634 std::string()); | |
| 635 if (local_state->HasPrefPath(prefs::kLastPromptedGoogleURL)) { | |
| 636 user_prefs->SetString( | |
| 637 prefs::kLastPromptedGoogleURL, | |
| 638 local_state->GetString(prefs::kLastPromptedGoogleURL)); | |
| 639 } | |
| 640 local_state->ClearPref(prefs::kLastPromptedGoogleURL); | |
| 641 | |
| 642 current_version |= GOOGLE_URL_TRACKER_PREFS; | |
| 643 local_state->SetInteger(prefs::kMultipleProfilePrefMigration, | |
| 644 current_version); | |
| 645 } | |
| 646 | |
| 647 #if !defined(OS_ANDROID) | 620 #if !defined(OS_ANDROID) |
| 648 local_state->ClearPref(kLegacyProfileResetPromptMemento); | 621 local_state->ClearPref(kLegacyProfileResetPromptMemento); |
| 649 #endif | 622 #endif |
| 650 | 623 |
| 651 #if defined(OS_CHROMEOS) | 624 #if defined(OS_CHROMEOS) |
| 652 chromeos::default_pinned_apps_field_trial::MigratePrefs(local_state); | 625 chromeos::default_pinned_apps_field_trial::MigratePrefs(local_state); |
| 653 #endif | 626 #endif |
| 654 | 627 |
| 655 #if defined(TOOLKIT_VIEWS) | 628 #if defined(TOOLKIT_VIEWS) |
| 656 MigrateBrowserTabStripPrefs(local_state); | 629 MigrateBrowserTabStripPrefs(local_state); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 host_zoom_dictionary, false /* sanitize_partition_host_zoom_levels */); | 677 host_zoom_dictionary, false /* sanitize_partition_host_zoom_levels */); |
| 705 | 678 |
| 706 // We're done migrating the profile per-host zoom level values, so we clear | 679 // We're done migrating the profile per-host zoom level values, so we clear |
| 707 // them all. | 680 // them all. |
| 708 DictionaryPrefUpdate host_zoom_dictionary_update( | 681 DictionaryPrefUpdate host_zoom_dictionary_update( |
| 709 prefs, prefs::kPerHostZoomLevelsDeprecated); | 682 prefs, prefs::kPerHostZoomLevelsDeprecated); |
| 710 host_zoom_dictionary_update->Clear(); | 683 host_zoom_dictionary_update->Clear(); |
| 711 } | 684 } |
| 712 | 685 |
| 713 } // namespace chrome | 686 } // namespace chrome |
| OLD | NEW |