| 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/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #include "chrome/browser/signin/signin_manager_factory.h" | 53 #include "chrome/browser/signin/signin_manager_factory.h" |
| 54 #include "chrome/browser/task_manager/task_manager.h" | 54 #include "chrome/browser/task_manager/task_manager.h" |
| 55 #include "chrome/browser/tracing/chrome_tracing_delegate.h" | 55 #include "chrome/browser/tracing/chrome_tracing_delegate.h" |
| 56 #include "chrome/browser/ui/app_list/app_list_prefs.h" | 56 #include "chrome/browser/ui/app_list/app_list_prefs.h" |
| 57 #include "chrome/browser/ui/app_list/app_list_service.h" | 57 #include "chrome/browser/ui/app_list/app_list_service.h" |
| 58 #include "chrome/browser/ui/browser_ui_prefs.h" | 58 #include "chrome/browser/ui/browser_ui_prefs.h" |
| 59 #include "chrome/browser/ui/navigation_correction_tab_observer.h" | 59 #include "chrome/browser/ui/navigation_correction_tab_observer.h" |
| 60 #include "chrome/browser/ui/network_profile_bubble.h" | 60 #include "chrome/browser/ui/network_profile_bubble.h" |
| 61 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" | 61 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" |
| 62 #include "chrome/browser/ui/search_engines/keyword_editor_controller.h" | 62 #include "chrome/browser/ui/search_engines/keyword_editor_controller.h" |
| 63 #include "chrome/browser/ui/startup/autolaunch_prompt.h" | |
| 64 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" | 63 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" |
| 65 #include "chrome/browser/ui/webui/flags_ui.h" | 64 #include "chrome/browser/ui/webui/flags_ui.h" |
| 66 #include "chrome/browser/ui/webui/instant_ui.h" | 65 #include "chrome/browser/ui/webui/instant_ui.h" |
| 67 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 66 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 68 #include "chrome/browser/ui/webui/plugins_ui.h" | 67 #include "chrome/browser/ui/webui/plugins_ui.h" |
| 69 #include "chrome/browser/ui/webui/print_preview/sticky_settings.h" | 68 #include "chrome/browser/ui/webui/print_preview/sticky_settings.h" |
| 70 #include "chrome/common/pref_names.h" | 69 #include "chrome/common/pref_names.h" |
| 71 #include "components/autofill/core/browser/autofill_manager.h" | 70 #include "components/autofill/core/browser/autofill_manager.h" |
| 72 #include "components/content_settings/core/browser/host_content_settings_map.h" | 71 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 73 #include "components/dom_distiller/core/distilled_page_prefs.h" | 72 #include "components/dom_distiller/core/distilled_page_prefs.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 #if defined(USE_ASH) | 219 #if defined(USE_ASH) |
| 221 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" | 220 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
| 222 #endif | 221 #endif |
| 223 | 222 |
| 224 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) | 223 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) |
| 225 #include "chrome/browser/ui/startup/default_browser_prompt.h" | 224 #include "chrome/browser/ui/startup/default_browser_prompt.h" |
| 226 #endif | 225 #endif |
| 227 | 226 |
| 228 namespace { | 227 namespace { |
| 229 | 228 |
| 230 #if !defined(OS_ANDROID) | 229 #if defined(OS_WIN) |
| 231 // The AutomaticProfileResetter service used this preference to save that the | 230 // Deprecated 11/2015 (M48). TODO(gab): delete in M52+. |
| 232 // profile reset prompt had already been shown, however, the preference has been | 231 const char kShownAutoLaunchInfobarDeprecated[] = |
| 233 // renamed in Local State. We keep the name here for now so that we can clear | 232 "browser.shown_autolaunch_infobar"; |
| 234 // out legacy values. | 233 #endif // defined(OS_WIN) |
| 235 // TODO(engedy): Remove this and usages in M42 or later. See crbug.com/398813. | |
| 236 const char kLegacyProfileResetPromptMemento[] = "profile.reset_prompt_memento"; | |
| 237 #endif | |
| 238 | 234 |
| 239 } // namespace | 235 } // namespace |
| 240 | 236 |
| 241 namespace chrome { | 237 namespace chrome { |
| 242 | 238 |
| 243 void RegisterLocalState(PrefRegistrySimple* registry) { | 239 void RegisterLocalState(PrefRegistrySimple* registry) { |
| 244 // Please keep this list alphabetized. | 240 // Please keep this list alphabetized. |
| 245 AppListService::RegisterPrefs(registry); | 241 AppListService::RegisterPrefs(registry); |
| 246 browser_shutdown::RegisterPrefs(registry); | 242 browser_shutdown::RegisterPrefs(registry); |
| 247 BrowserProcessImpl::RegisterPrefs(registry); | 243 BrowserProcessImpl::RegisterPrefs(registry); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 | 346 |
| 351 #if defined(OS_WIN) | 347 #if defined(OS_WIN) |
| 352 app_metro_launch::RegisterPrefs(registry); | 348 app_metro_launch::RegisterPrefs(registry); |
| 353 component_updater::RegisterPrefsForSwReporter(registry); | 349 component_updater::RegisterPrefsForSwReporter(registry); |
| 354 password_manager::PasswordManager::RegisterLocalPrefs(registry); | 350 password_manager::PasswordManager::RegisterLocalPrefs(registry); |
| 355 #endif | 351 #endif |
| 356 | 352 |
| 357 #if defined(TOOLKIT_VIEWS) | 353 #if defined(TOOLKIT_VIEWS) |
| 358 RegisterBrowserViewLocalPrefs(registry); | 354 RegisterBrowserViewLocalPrefs(registry); |
| 359 #endif | 355 #endif |
| 360 | |
| 361 // Preferences registered only for migration (clearing or moving to a new key) | |
| 362 // go here. | |
| 363 #if !defined(OS_ANDROID) | |
| 364 registry->RegisterDictionaryPref(kLegacyProfileResetPromptMemento); | |
| 365 #endif // !defined(OS_ANDROID) | |
| 366 } | 356 } |
| 367 | 357 |
| 368 // Register prefs applicable to all profiles. | 358 // Register prefs applicable to all profiles. |
| 369 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 359 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 370 TRACE_EVENT0("browser", "chrome::RegisterProfilePrefs"); | 360 TRACE_EVENT0("browser", "chrome::RegisterProfilePrefs"); |
| 371 SCOPED_UMA_HISTOGRAM_TIMER("Settings.RegisterProfilePrefsTime"); | 361 SCOPED_UMA_HISTOGRAM_TIMER("Settings.RegisterProfilePrefsTime"); |
| 372 // User prefs. Please keep this list alphabetized. | 362 // User prefs. Please keep this list alphabetized. |
| 373 autofill::AutofillManager::RegisterProfilePrefs(registry); | 363 autofill::AutofillManager::RegisterProfilePrefs(registry); |
| 374 sync_driver::SyncPrefs::RegisterProfilePrefs(registry); | 364 sync_driver::SyncPrefs::RegisterProfilePrefs(registry); |
| 375 ChromeContentBrowserClient::RegisterProfilePrefs(registry); | 365 ChromeContentBrowserClient::RegisterProfilePrefs(registry); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 DevToolsWindow::RegisterProfilePrefs(registry); | 464 DevToolsWindow::RegisterProfilePrefs(registry); |
| 475 DriveAppMapping::RegisterProfilePrefs(registry); | 465 DriveAppMapping::RegisterProfilePrefs(registry); |
| 476 extensions::CommandService::RegisterProfilePrefs(registry); | 466 extensions::CommandService::RegisterProfilePrefs(registry); |
| 477 extensions::ExtensionSettingsHandler::RegisterProfilePrefs(registry); | 467 extensions::ExtensionSettingsHandler::RegisterProfilePrefs(registry); |
| 478 extensions::TabsCaptureVisibleTabFunction::RegisterProfilePrefs(registry); | 468 extensions::TabsCaptureVisibleTabFunction::RegisterProfilePrefs(registry); |
| 479 first_run::RegisterProfilePrefs(registry); | 469 first_run::RegisterProfilePrefs(registry); |
| 480 gcm::GCMChannelStatusSyncer::RegisterProfilePrefs(registry); | 470 gcm::GCMChannelStatusSyncer::RegisterProfilePrefs(registry); |
| 481 NewTabUI::RegisterProfilePrefs(registry); | 471 NewTabUI::RegisterProfilePrefs(registry); |
| 482 PepperFlashSettingsManager::RegisterProfilePrefs(registry); | 472 PepperFlashSettingsManager::RegisterProfilePrefs(registry); |
| 483 PinnedTabCodec::RegisterProfilePrefs(registry); | 473 PinnedTabCodec::RegisterProfilePrefs(registry); |
| 484 RegisterAutolaunchUserPrefs(registry); | |
| 485 signin::RegisterProfilePrefs(registry); | 474 signin::RegisterProfilePrefs(registry); |
| 486 #endif | 475 #endif |
| 487 | 476 |
| 488 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) | 477 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) |
| 489 default_apps::RegisterProfilePrefs(registry); | 478 default_apps::RegisterProfilePrefs(registry); |
| 490 #endif | 479 #endif |
| 491 | 480 |
| 492 #if defined(OS_CHROMEOS) | 481 #if defined(OS_CHROMEOS) |
| 493 chromeos::first_run::RegisterProfilePrefs(registry); | 482 chromeos::first_run::RegisterProfilePrefs(registry); |
| 494 chromeos::file_system_provider::RegisterProfilePrefs(registry); | 483 chromeos::file_system_provider::RegisterProfilePrefs(registry); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 514 RegisterInvertBubbleUserPrefs(registry); | 503 RegisterInvertBubbleUserPrefs(registry); |
| 515 #endif | 504 #endif |
| 516 | 505 |
| 517 #if defined(USE_ASH) | 506 #if defined(USE_ASH) |
| 518 ash::RegisterChromeLauncherUserPrefs(registry); | 507 ash::RegisterChromeLauncherUserPrefs(registry); |
| 519 #endif | 508 #endif |
| 520 | 509 |
| 521 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 510 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 522 browser_sync::ForeignSessionHandler::RegisterProfilePrefs(registry); | 511 browser_sync::ForeignSessionHandler::RegisterProfilePrefs(registry); |
| 523 #endif | 512 #endif |
| 513 |
| 514 // Preferences registered only for migration (clearing or moving to a new key) |
| 515 // go here. |
| 516 |
| 517 #if defined(OS_WIN) |
| 518 registry->RegisterIntegerPref(kShownAutoLaunchInfobarDeprecated, 0); |
| 519 #endif // defined(OS_WIN) |
| 524 } | 520 } |
| 525 | 521 |
| 526 void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 522 void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 527 RegisterProfilePrefs(registry); | 523 RegisterProfilePrefs(registry); |
| 528 | 524 |
| 529 #if defined(OS_CHROMEOS) | 525 #if defined(OS_CHROMEOS) |
| 530 chromeos::PowerPrefs::RegisterUserProfilePrefs(registry); | 526 chromeos::PowerPrefs::RegisterUserProfilePrefs(registry); |
| 531 #endif | 527 #endif |
| 532 } | 528 } |
| 533 | 529 |
| 534 void RegisterScreenshotPrefs(PrefRegistrySimple* registry) { | 530 void RegisterScreenshotPrefs(PrefRegistrySimple* registry) { |
| 535 registry->RegisterBooleanPref(prefs::kDisableScreenshots, false); | 531 registry->RegisterBooleanPref(prefs::kDisableScreenshots, false); |
| 536 } | 532 } |
| 537 | 533 |
| 538 #if defined(OS_CHROMEOS) | 534 #if defined(OS_CHROMEOS) |
| 539 void RegisterLoginProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 535 void RegisterLoginProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 540 RegisterProfilePrefs(registry); | 536 RegisterProfilePrefs(registry); |
| 541 | 537 |
| 542 chromeos::PowerPrefs::RegisterLoginProfilePrefs(registry); | 538 chromeos::PowerPrefs::RegisterLoginProfilePrefs(registry); |
| 543 } | 539 } |
| 544 #endif | 540 #endif |
| 545 | 541 |
| 546 // This method should be periodically pruned of year+ old migrations. | 542 // This method should be periodically pruned of year+ old migrations. |
| 547 void MigrateObsoleteBrowserPrefs(Profile* profile, PrefService* local_state) { | 543 void MigrateObsoleteBrowserPrefs(Profile* profile, PrefService* local_state) { |
| 548 #if defined(TOOLKIT_VIEWS) | 544 #if defined(TOOLKIT_VIEWS) |
| 549 // Added 05/2014. | 545 // Added 05/2014. |
| 550 MigrateBrowserTabStripPrefs(local_state); | 546 MigrateBrowserTabStripPrefs(local_state); |
| 551 #endif | 547 #endif |
| 552 | |
| 553 #if !defined(OS_ANDROID) | |
| 554 // Added 08/2014. | |
| 555 local_state->ClearPref(kLegacyProfileResetPromptMemento); | |
| 556 #endif | |
| 557 } | 548 } |
| 558 | 549 |
| 559 // This method should be periodically pruned of year+ old migrations. | 550 // This method should be periodically pruned of year+ old migrations. |
| 560 void MigrateObsoleteProfilePrefs(Profile* profile) { | 551 void MigrateObsoleteProfilePrefs(Profile* profile) { |
| 561 PrefService* profile_prefs = profile->GetPrefs(); | 552 PrefService* profile_prefs = profile->GetPrefs(); |
| 562 | 553 |
| 563 // Added 07/2014. | 554 // Added 07/2014. |
| 564 translate::TranslatePrefs::MigrateUserPrefs(profile_prefs, | 555 translate::TranslatePrefs::MigrateUserPrefs(profile_prefs, |
| 565 prefs::kAcceptLanguages); | 556 prefs::kAcceptLanguages); |
| 566 | 557 |
| 567 #if defined(OS_CHROMEOS) && defined(ENABLE_APP_LIST) | 558 #if defined(OS_CHROMEOS) && defined(ENABLE_APP_LIST) |
| 568 // Added 02/2015. | 559 // Added 02/2015. |
| 569 MigrateGoogleNowPrefs(profile); | 560 MigrateGoogleNowPrefs(profile); |
| 570 #endif | 561 #endif |
| 562 |
| 563 #if defined(OS_WIN) |
| 564 // Added 11/2015. |
| 565 profile_prefs->ClearPref(kShownAutoLaunchInfobarDeprecated); |
| 566 #endif |
| 571 } | 567 } |
| 572 | 568 |
| 573 } // namespace chrome | 569 } // namespace chrome |
| OLD | NEW |