| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 #if !defined(USE_ATHENA) | 214 #if !defined(USE_ATHENA) |
| 218 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 215 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 219 #endif | 216 #endif |
| 220 | 217 |
| 221 namespace { | 218 namespace { |
| 222 | 219 |
| 223 enum MigratedPreferences { | 220 enum MigratedPreferences { |
| 224 NO_PREFS = 0, | 221 NO_PREFS = 0, |
| 225 DNS_PREFS = 1 << 0, | 222 DNS_PREFS = 1 << 0, |
| 226 WINDOWS_PREFS = 1 << 1, | 223 WINDOWS_PREFS = 1 << 1, |
| 227 GOOGLE_URL_TRACKER_PREFS = 1 << 2, | |
| 228 }; | 224 }; |
| 229 | 225 |
| 230 // A previous feature (see | 226 // A previous feature (see |
| 231 // chrome/browser/protector/protected_prefs_watcher.cc in source | 227 // chrome/browser/protector/protected_prefs_watcher.cc in source |
| 232 // control history) used this string as a prefix for various prefs it | 228 // control history) used this string as a prefix for various prefs it |
| 233 // registered. We keep it here for now to clear out those old prefs in | 229 // registered. We keep it here for now to clear out those old prefs in |
| 234 // MigrateUserPrefs. | 230 // MigrateUserPrefs. |
| 235 const char kBackupPref[] = "backup"; | 231 const char kBackupPref[] = "backup"; |
| 236 | 232 |
| 237 #if !defined(OS_ANDROID) | 233 #if !defined(OS_ANDROID) |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 user_prefs->Set(prefs::kBrowserWindowPlacement, | 613 user_prefs->Set(prefs::kBrowserWindowPlacement, |
| 618 *(pref->GetValue())); | 614 *(pref->GetValue())); |
| 619 } | 615 } |
| 620 local_state->ClearPref(prefs::kBrowserWindowPlacement); | 616 local_state->ClearPref(prefs::kBrowserWindowPlacement); |
| 621 | 617 |
| 622 current_version |= WINDOWS_PREFS; | 618 current_version |= WINDOWS_PREFS; |
| 623 local_state->SetInteger(prefs::kMultipleProfilePrefMigration, | 619 local_state->SetInteger(prefs::kMultipleProfilePrefMigration, |
| 624 current_version); | 620 current_version); |
| 625 } | 621 } |
| 626 | 622 |
| 627 if (!(current_version & GOOGLE_URL_TRACKER_PREFS)) { | |
| 628 registry->RegisterStringPref(prefs::kLastKnownGoogleURL, | |
| 629 GoogleURLTracker::kDefaultGoogleHomepage); | |
| 630 if (local_state->HasPrefPath(prefs::kLastKnownGoogleURL)) { | |
| 631 user_prefs->SetString(prefs::kLastKnownGoogleURL, | |
| 632 local_state->GetString(prefs::kLastKnownGoogleURL)); | |
| 633 } | |
| 634 local_state->ClearPref(prefs::kLastKnownGoogleURL); | |
| 635 | |
| 636 registry->RegisterStringPref(prefs::kLastPromptedGoogleURL, | |
| 637 std::string()); | |
| 638 if (local_state->HasPrefPath(prefs::kLastPromptedGoogleURL)) { | |
| 639 user_prefs->SetString( | |
| 640 prefs::kLastPromptedGoogleURL, | |
| 641 local_state->GetString(prefs::kLastPromptedGoogleURL)); | |
| 642 } | |
| 643 local_state->ClearPref(prefs::kLastPromptedGoogleURL); | |
| 644 | |
| 645 current_version |= GOOGLE_URL_TRACKER_PREFS; | |
| 646 local_state->SetInteger(prefs::kMultipleProfilePrefMigration, | |
| 647 current_version); | |
| 648 } | |
| 649 | |
| 650 #if !defined(OS_ANDROID) | 623 #if !defined(OS_ANDROID) |
| 651 local_state->ClearPref(kLegacyProfileResetPromptMemento); | 624 local_state->ClearPref(kLegacyProfileResetPromptMemento); |
| 652 #endif | 625 #endif |
| 653 | 626 |
| 654 #if defined(OS_CHROMEOS) | 627 #if defined(OS_CHROMEOS) |
| 655 chromeos::default_pinned_apps_field_trial::MigratePrefs(local_state); | 628 chromeos::default_pinned_apps_field_trial::MigratePrefs(local_state); |
| 656 #endif | 629 #endif |
| 657 | 630 |
| 658 #if defined(TOOLKIT_VIEWS) | 631 #if defined(TOOLKIT_VIEWS) |
| 659 MigrateBrowserTabStripPrefs(local_state); | 632 MigrateBrowserTabStripPrefs(local_state); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 host_zoom_dictionary, false /* sanitize_partition_host_zoom_levels */); | 680 host_zoom_dictionary, false /* sanitize_partition_host_zoom_levels */); |
| 708 | 681 |
| 709 // We're done migrating the profile per-host zoom level values, so we clear | 682 // We're done migrating the profile per-host zoom level values, so we clear |
| 710 // them all. | 683 // them all. |
| 711 DictionaryPrefUpdate host_zoom_dictionary_update( | 684 DictionaryPrefUpdate host_zoom_dictionary_update( |
| 712 prefs, prefs::kPerHostZoomLevelsDeprecated); | 685 prefs, prefs::kPerHostZoomLevelsDeprecated); |
| 713 host_zoom_dictionary_update->Clear(); | 686 host_zoom_dictionary_update->Clear(); |
| 714 } | 687 } |
| 715 | 688 |
| 716 } // namespace chrome | 689 } // namespace chrome |
| OLD | NEW |