Chromium Code Reviews| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 #if defined(USE_ASH) | 218 #if defined(USE_ASH) |
| 220 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" | 219 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
| 221 #endif | 220 #endif |
| 222 | 221 |
| 223 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) | 222 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) |
| 224 #include "chrome/browser/ui/startup/default_browser_prompt.h" | 223 #include "chrome/browser/ui/startup/default_browser_prompt.h" |
| 225 #endif | 224 #endif |
| 226 | 225 |
| 227 namespace { | 226 namespace { |
| 228 | 227 |
| 229 #if !defined(OS_ANDROID) | 228 // Deprecated 11/15. |
|
Bernhard Bauer
2015/11/10 16:14:13
Use the four-digit year.
gab
2015/11/10 16:29:03
Done.
| |
| 230 // The AutomaticProfileResetter service used this preference to save that the | 229 const char kShownAutoLaunchInfobarDeprecated[] = |
|
Bernhard Bauer
2015/11/10 16:14:13
Can you add a TODO with fixed date / milestone to
gab
2015/11/10 16:29:03
Done, no bug number though, I tend to just make it
| |
| 231 // profile reset prompt had already been shown, however, the preference has been | 230 "browser.shown_autolaunch_infobar"; |
| 232 // renamed in Local State. We keep the name here for now so that we can clear | |
| 233 // out legacy values. | |
| 234 // TODO(engedy): Remove this and usages in M42 or later. See crbug.com/398813. | |
| 235 const char kLegacyProfileResetPromptMemento[] = "profile.reset_prompt_memento"; | |
| 236 #endif | |
| 237 | 231 |
| 238 } // namespace | 232 } // namespace |
|
Bernhard Bauer
2015/11/10 16:14:13
Kinda unrelated, but the anonymous namespace is un
gab
2015/11/10 16:29:03
True, but Chromium style tends to put everything t
| |
| 239 | 233 |
| 240 namespace chrome { | 234 namespace chrome { |
| 241 | 235 |
| 242 void RegisterLocalState(PrefRegistrySimple* registry) { | 236 void RegisterLocalState(PrefRegistrySimple* registry) { |
| 243 // Please keep this list alphabetized. | 237 // Please keep this list alphabetized. |
| 244 AppListService::RegisterPrefs(registry); | 238 AppListService::RegisterPrefs(registry); |
| 245 browser_shutdown::RegisterPrefs(registry); | 239 browser_shutdown::RegisterPrefs(registry); |
| 246 BrowserProcessImpl::RegisterPrefs(registry); | 240 BrowserProcessImpl::RegisterPrefs(registry); |
| 247 ChromeMetricsServiceClient::RegisterPrefs(registry); | 241 ChromeMetricsServiceClient::RegisterPrefs(registry); |
| 248 chrome_prefs::RegisterPrefs(registry); | 242 chrome_prefs::RegisterPrefs(registry); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 348 | 342 |
| 349 #if defined(OS_WIN) | 343 #if defined(OS_WIN) |
| 350 app_metro_launch::RegisterPrefs(registry); | 344 app_metro_launch::RegisterPrefs(registry); |
| 351 component_updater::RegisterPrefsForSwReporter(registry); | 345 component_updater::RegisterPrefsForSwReporter(registry); |
| 352 password_manager::PasswordManager::RegisterLocalPrefs(registry); | 346 password_manager::PasswordManager::RegisterLocalPrefs(registry); |
| 353 #endif | 347 #endif |
| 354 | 348 |
| 355 #if defined(TOOLKIT_VIEWS) | 349 #if defined(TOOLKIT_VIEWS) |
| 356 RegisterBrowserViewLocalPrefs(registry); | 350 RegisterBrowserViewLocalPrefs(registry); |
| 357 #endif | 351 #endif |
| 358 | |
| 359 // Preferences registered only for migration (clearing or moving to a new key) | |
| 360 // go here. | |
| 361 #if !defined(OS_ANDROID) | |
| 362 registry->RegisterDictionaryPref(kLegacyProfileResetPromptMemento); | |
| 363 #endif // !defined(OS_ANDROID) | |
| 364 } | 352 } |
| 365 | 353 |
| 366 // Register prefs applicable to all profiles. | 354 // Register prefs applicable to all profiles. |
| 367 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 355 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 368 TRACE_EVENT0("browser", "chrome::RegisterProfilePrefs"); | 356 TRACE_EVENT0("browser", "chrome::RegisterProfilePrefs"); |
| 369 SCOPED_UMA_HISTOGRAM_TIMER("Settings.RegisterProfilePrefsTime"); | 357 SCOPED_UMA_HISTOGRAM_TIMER("Settings.RegisterProfilePrefsTime"); |
| 370 // User prefs. Please keep this list alphabetized. | 358 // User prefs. Please keep this list alphabetized. |
| 371 autofill::AutofillManager::RegisterProfilePrefs(registry); | 359 autofill::AutofillManager::RegisterProfilePrefs(registry); |
| 372 sync_driver::SyncPrefs::RegisterProfilePrefs(registry); | 360 sync_driver::SyncPrefs::RegisterProfilePrefs(registry); |
| 373 ChromeContentBrowserClient::RegisterProfilePrefs(registry); | 361 ChromeContentBrowserClient::RegisterProfilePrefs(registry); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 472 DevToolsWindow::RegisterProfilePrefs(registry); | 460 DevToolsWindow::RegisterProfilePrefs(registry); |
| 473 DriveAppMapping::RegisterProfilePrefs(registry); | 461 DriveAppMapping::RegisterProfilePrefs(registry); |
| 474 extensions::CommandService::RegisterProfilePrefs(registry); | 462 extensions::CommandService::RegisterProfilePrefs(registry); |
| 475 extensions::ExtensionSettingsHandler::RegisterProfilePrefs(registry); | 463 extensions::ExtensionSettingsHandler::RegisterProfilePrefs(registry); |
| 476 extensions::TabsCaptureVisibleTabFunction::RegisterProfilePrefs(registry); | 464 extensions::TabsCaptureVisibleTabFunction::RegisterProfilePrefs(registry); |
| 477 first_run::RegisterProfilePrefs(registry); | 465 first_run::RegisterProfilePrefs(registry); |
| 478 gcm::GCMChannelStatusSyncer::RegisterProfilePrefs(registry); | 466 gcm::GCMChannelStatusSyncer::RegisterProfilePrefs(registry); |
| 479 NewTabUI::RegisterProfilePrefs(registry); | 467 NewTabUI::RegisterProfilePrefs(registry); |
| 480 PepperFlashSettingsManager::RegisterProfilePrefs(registry); | 468 PepperFlashSettingsManager::RegisterProfilePrefs(registry); |
| 481 PinnedTabCodec::RegisterProfilePrefs(registry); | 469 PinnedTabCodec::RegisterProfilePrefs(registry); |
| 482 RegisterAutolaunchUserPrefs(registry); | |
| 483 signin::RegisterProfilePrefs(registry); | 470 signin::RegisterProfilePrefs(registry); |
| 484 #endif | 471 #endif |
| 485 | 472 |
| 486 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) | 473 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) |
| 487 default_apps::RegisterProfilePrefs(registry); | 474 default_apps::RegisterProfilePrefs(registry); |
| 488 #endif | 475 #endif |
| 489 | 476 |
| 490 #if defined(OS_CHROMEOS) | 477 #if defined(OS_CHROMEOS) |
| 491 chromeos::first_run::RegisterProfilePrefs(registry); | 478 chromeos::first_run::RegisterProfilePrefs(registry); |
| 492 chromeos::file_system_provider::RegisterProfilePrefs(registry); | 479 chromeos::file_system_provider::RegisterProfilePrefs(registry); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 512 RegisterInvertBubbleUserPrefs(registry); | 499 RegisterInvertBubbleUserPrefs(registry); |
| 513 #endif | 500 #endif |
| 514 | 501 |
| 515 #if defined(USE_ASH) | 502 #if defined(USE_ASH) |
| 516 ash::RegisterChromeLauncherUserPrefs(registry); | 503 ash::RegisterChromeLauncherUserPrefs(registry); |
| 517 #endif | 504 #endif |
| 518 | 505 |
| 519 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 506 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 520 browser_sync::ForeignSessionHandler::RegisterProfilePrefs(registry); | 507 browser_sync::ForeignSessionHandler::RegisterProfilePrefs(registry); |
| 521 #endif | 508 #endif |
| 509 | |
| 510 // Preferences registered only for migration (clearing or moving to a new key) | |
| 511 // go here. | |
| 512 #if defined(OS_WIN) | |
| 513 registry->RegisterIntegerPref(kShownAutoLaunchInfobarDeprecated, 0); | |
| 514 #endif // defined(OS_WIN) | |
| 522 } | 515 } |
| 523 | 516 |
| 524 void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 517 void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 525 RegisterProfilePrefs(registry); | 518 RegisterProfilePrefs(registry); |
| 526 | 519 |
| 527 #if defined(OS_CHROMEOS) | 520 #if defined(OS_CHROMEOS) |
| 528 chromeos::PowerPrefs::RegisterUserProfilePrefs(registry); | 521 chromeos::PowerPrefs::RegisterUserProfilePrefs(registry); |
| 529 #endif | 522 #endif |
| 530 } | 523 } |
| 531 | 524 |
| 532 void RegisterScreenshotPrefs(PrefRegistrySimple* registry) { | 525 void RegisterScreenshotPrefs(PrefRegistrySimple* registry) { |
| 533 registry->RegisterBooleanPref(prefs::kDisableScreenshots, false); | 526 registry->RegisterBooleanPref(prefs::kDisableScreenshots, false); |
| 534 } | 527 } |
| 535 | 528 |
| 536 #if defined(OS_CHROMEOS) | 529 #if defined(OS_CHROMEOS) |
| 537 void RegisterLoginProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 530 void RegisterLoginProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 538 RegisterProfilePrefs(registry); | 531 RegisterProfilePrefs(registry); |
| 539 | 532 |
| 540 chromeos::PowerPrefs::RegisterLoginProfilePrefs(registry); | 533 chromeos::PowerPrefs::RegisterLoginProfilePrefs(registry); |
| 541 } | 534 } |
| 542 #endif | 535 #endif |
| 543 | 536 |
| 544 // This method should be periodically pruned of year+ old migrations. | 537 // This method should be periodically pruned of year+ old migrations. |
| 545 void MigrateObsoleteBrowserPrefs(Profile* profile, PrefService* local_state) { | 538 void MigrateObsoleteBrowserPrefs(Profile* profile, PrefService* local_state) { |
| 546 #if defined(TOOLKIT_VIEWS) | 539 #if defined(TOOLKIT_VIEWS) |
| 547 // Added 05/2014. | 540 // Added 05/2014. |
| 548 MigrateBrowserTabStripPrefs(local_state); | 541 MigrateBrowserTabStripPrefs(local_state); |
| 549 #endif | 542 #endif |
| 550 | |
| 551 #if !defined(OS_ANDROID) | |
| 552 // Added 08/2014. | |
| 553 local_state->ClearPref(kLegacyProfileResetPromptMemento); | |
| 554 #endif | |
| 555 } | 543 } |
| 556 | 544 |
| 557 // This method should be periodically pruned of year+ old migrations. | 545 // This method should be periodically pruned of year+ old migrations. |
| 558 void MigrateObsoleteProfilePrefs(Profile* profile) { | 546 void MigrateObsoleteProfilePrefs(Profile* profile) { |
| 559 PrefService* profile_prefs = profile->GetPrefs(); | 547 PrefService* profile_prefs = profile->GetPrefs(); |
| 560 | 548 |
| 561 // Added 07/2014. | 549 // Added 07/2014. |
| 562 translate::TranslatePrefs::MigrateUserPrefs(profile_prefs, | 550 translate::TranslatePrefs::MigrateUserPrefs(profile_prefs, |
| 563 prefs::kAcceptLanguages); | 551 prefs::kAcceptLanguages); |
| 564 | 552 |
| 565 #if defined(OS_CHROMEOS) && defined(ENABLE_APP_LIST) | 553 #if defined(OS_CHROMEOS) && defined(ENABLE_APP_LIST) |
| 566 // Added 02/2015. | 554 // Added 02/2015. |
| 567 MigrateGoogleNowPrefs(profile); | 555 MigrateGoogleNowPrefs(profile); |
| 568 #endif | 556 #endif |
| 557 | |
| 558 #if defined(OS_WIN) | |
| 559 // Added 11/2015. | |
| 560 profile_prefs->ClearPref(kShownAutoLaunchInfobarDeprecated); | |
| 561 #endif | |
| 569 } | 562 } |
| 570 | 563 |
| 571 } // namespace chrome | 564 } // namespace chrome |
| OLD | NEW |