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/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 #if defined(ENABLE_PLUGIN_INSTALLATION) | 130 #if defined(ENABLE_PLUGIN_INSTALLATION) |
131 #include "chrome/browser/plugins/plugins_resource_service.h" | 131 #include "chrome/browser/plugins/plugins_resource_service.h" |
132 #endif | 132 #endif |
133 | 133 |
134 #if defined(OS_ANDROID) | 134 #if defined(OS_ANDROID) |
135 #include "chrome/browser/android/bookmarks/partner_bookmarks_shim.h" | 135 #include "chrome/browser/android/bookmarks/partner_bookmarks_shim.h" |
136 #include "chrome/browser/android/new_tab_page_prefs.h" | 136 #include "chrome/browser/android/new_tab_page_prefs.h" |
137 #else | 137 #else |
138 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" | 138 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" |
139 #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h" | |
140 #include "chrome/browser/ui/autofill/generated_credit_card_bubble_controller.h" | 139 #include "chrome/browser/ui/autofill/generated_credit_card_bubble_controller.h" |
141 #endif | 140 #endif |
142 | 141 |
143 #if defined(OS_CHROMEOS) | 142 #if defined(OS_CHROMEOS) |
144 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 143 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
145 #include "chrome/browser/chromeos/attestation/platform_verification_flow.h" | 144 #include "chrome/browser/chromeos/attestation/platform_verification_flow.h" |
146 #include "chrome/browser/chromeos/audio/audio_devices_pref_handler_impl.h" | 145 #include "chrome/browser/chromeos/audio/audio_devices_pref_handler_impl.h" |
147 #include "chrome/browser/chromeos/customization_document.h" | 146 #include "chrome/browser/chromeos/customization_document.h" |
148 #include "chrome/browser/chromeos/display/display_preferences.h" | 147 #include "chrome/browser/chromeos/display/display_preferences.h" |
149 #include "chrome/browser/chromeos/extensions/echo_private_api.h" | 148 #include "chrome/browser/chromeos/extensions/echo_private_api.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 // chrome/browser/protector/protected_prefs_watcher.cc in source | 213 // chrome/browser/protector/protected_prefs_watcher.cc in source |
215 // control history) used this string as a prefix for various prefs it | 214 // control history) used this string as a prefix for various prefs it |
216 // registered. We keep it here for now to clear out those old prefs in | 215 // registered. We keep it here for now to clear out those old prefs in |
217 // MigrateUserPrefs. | 216 // MigrateUserPrefs. |
218 const char kBackupPref[] = "backup"; | 217 const char kBackupPref[] = "backup"; |
219 | 218 |
220 #if !defined(OS_ANDROID) | 219 #if !defined(OS_ANDROID) |
221 // The sync promo error message preference has been removed; this pref will | 220 // The sync promo error message preference has been removed; this pref will |
222 // be cleared from user data. | 221 // be cleared from user data. |
223 const char kSyncPromoErrorMessage[] = "sync_promo.error_message"; | 222 const char kSyncPromoErrorMessage[] = "sync_promo.error_message"; |
| 223 |
| 224 // The AutomaticProfileResetter service, which has since been unimplemented, |
| 225 // used this preference to save that the profile reset prompt had already been |
| 226 // shown. We keep the name here for now so that we can clear out legacy values. |
| 227 // TODO(engedy): Remove this and usages in M42 or later. See crbug.com/398813. |
| 228 const char kProfileResetPromptMemento[] = "profile.reset_prompt_memento"; |
224 #endif | 229 #endif |
225 | 230 |
226 } // namespace | 231 } // namespace |
227 | 232 |
228 namespace chrome { | 233 namespace chrome { |
229 | 234 |
230 void RegisterLocalState(PrefRegistrySimple* registry) { | 235 void RegisterLocalState(PrefRegistrySimple* registry) { |
231 // Prefs in Local State. | 236 // Prefs in Local State. |
232 registry->RegisterIntegerPref(prefs::kMultipleProfilePrefMigration, 0); | 237 registry->RegisterIntegerPref(prefs::kMultipleProfilePrefMigration, 0); |
233 | 238 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 284 |
280 #if defined(ENABLE_PLUGIN_INSTALLATION) | 285 #if defined(ENABLE_PLUGIN_INSTALLATION) |
281 PluginsResourceService::RegisterPrefs(registry); | 286 PluginsResourceService::RegisterPrefs(registry); |
282 #endif | 287 #endif |
283 | 288 |
284 #if defined(ENABLE_TASK_MANAGER) | 289 #if defined(ENABLE_TASK_MANAGER) |
285 TaskManager::RegisterPrefs(registry); | 290 TaskManager::RegisterPrefs(registry); |
286 #endif // defined(ENABLE_TASK_MANAGER) | 291 #endif // defined(ENABLE_TASK_MANAGER) |
287 | 292 |
288 #if !defined(OS_ANDROID) | 293 #if !defined(OS_ANDROID) |
289 AutomaticProfileResetterFactory::RegisterPrefs(registry); | |
290 BackgroundModeManager::RegisterPrefs(registry); | 294 BackgroundModeManager::RegisterPrefs(registry); |
291 RegisterBrowserPrefs(registry); | 295 RegisterBrowserPrefs(registry); |
292 #if !defined(OS_CHROMEOS) | 296 #if !defined(OS_CHROMEOS) |
293 RegisterDefaultBrowserPromptPrefs(registry); | 297 RegisterDefaultBrowserPromptPrefs(registry); |
294 #endif // !defined(OS_CHROMEOS) | 298 #endif // !defined(OS_CHROMEOS) |
295 #endif // !defined(OS_ANDROID) | 299 #endif // !defined(OS_ANDROID) |
296 | 300 |
297 #if defined(OS_CHROMEOS) | 301 #if defined(OS_CHROMEOS) |
298 ChromeOSMetricsProvider::RegisterPrefs(registry); | 302 ChromeOSMetricsProvider::RegisterPrefs(registry); |
299 chromeos::AudioDevicesPrefHandlerImpl::RegisterPrefs(registry); | 303 chromeos::AudioDevicesPrefHandlerImpl::RegisterPrefs(registry); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 340 |
337 #if defined(OS_WIN) | 341 #if defined(OS_WIN) |
338 app_metro_launch::RegisterPrefs(registry); | 342 app_metro_launch::RegisterPrefs(registry); |
339 component_updater::RegisterPrefsForSwReporter(registry); | 343 component_updater::RegisterPrefsForSwReporter(registry); |
340 password_manager::PasswordManager::RegisterLocalPrefs(registry); | 344 password_manager::PasswordManager::RegisterLocalPrefs(registry); |
341 #endif | 345 #endif |
342 | 346 |
343 #if defined(TOOLKIT_VIEWS) | 347 #if defined(TOOLKIT_VIEWS) |
344 RegisterBrowserViewLocalPrefs(registry); | 348 RegisterBrowserViewLocalPrefs(registry); |
345 #endif | 349 #endif |
| 350 |
| 351 // Preferences registered only for migration (clearing or moving to a new key) |
| 352 // go here. |
| 353 #if !defined(OS_ANDROID) |
| 354 registry->RegisterDictionaryPref(kProfileResetPromptMemento); |
| 355 #endif // !defined(OS_ANDROID) |
346 } | 356 } |
347 | 357 |
348 // Register prefs applicable to all profiles. | 358 // Register prefs applicable to all profiles. |
349 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 359 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
350 TRACE_EVENT0("browser", "chrome::RegisterUserPrefs"); | 360 TRACE_EVENT0("browser", "chrome::RegisterUserPrefs"); |
351 // User prefs. Please keep this list alphabetized. | 361 // User prefs. Please keep this list alphabetized. |
352 autofill::AutofillManager::RegisterProfilePrefs(registry); | 362 autofill::AutofillManager::RegisterProfilePrefs(registry); |
353 bookmarks::RegisterProfilePrefs(registry); | 363 bookmarks::RegisterProfilePrefs(registry); |
354 sync_driver::SyncPrefs::RegisterProfilePrefs(registry); | 364 sync_driver::SyncPrefs::RegisterProfilePrefs(registry); |
355 ChromeContentBrowserClient::RegisterProfilePrefs(registry); | 365 ChromeContentBrowserClient::RegisterProfilePrefs(registry); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 | 479 |
470 #if defined(TOOLKIT_VIEWS) | 480 #if defined(TOOLKIT_VIEWS) |
471 RegisterBrowserViewProfilePrefs(registry); | 481 RegisterBrowserViewProfilePrefs(registry); |
472 RegisterInvertBubbleUserPrefs(registry); | 482 RegisterInvertBubbleUserPrefs(registry); |
473 #endif | 483 #endif |
474 | 484 |
475 #if defined(USE_ASH) | 485 #if defined(USE_ASH) |
476 ash::RegisterChromeLauncherUserPrefs(registry); | 486 ash::RegisterChromeLauncherUserPrefs(registry); |
477 #endif | 487 #endif |
478 | 488 |
479 // Prefs registered only for migration (clearing or moving to a new | 489 // Preferences registered only for migration (clearing or moving to a new key) |
480 // key) go here. | 490 // go here. |
481 registry->RegisterDictionaryPref( | 491 registry->RegisterDictionaryPref( |
482 kBackupPref, | 492 kBackupPref, |
483 new base::DictionaryValue(), | 493 new base::DictionaryValue(), |
484 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 494 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
485 #if !defined(OS_ANDROID) | 495 #if !defined(OS_ANDROID) |
486 registry->RegisterStringPref( | 496 registry->RegisterStringPref( |
487 kSyncPromoErrorMessage, | 497 kSyncPromoErrorMessage, |
488 std::string(), | 498 std::string(), |
489 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 499 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
490 #endif | 500 #endif |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 prefs::kLastPromptedGoogleURL, | 593 prefs::kLastPromptedGoogleURL, |
584 local_state->GetString(prefs::kLastPromptedGoogleURL)); | 594 local_state->GetString(prefs::kLastPromptedGoogleURL)); |
585 } | 595 } |
586 local_state->ClearPref(prefs::kLastPromptedGoogleURL); | 596 local_state->ClearPref(prefs::kLastPromptedGoogleURL); |
587 | 597 |
588 current_version |= GOOGLE_URL_TRACKER_PREFS; | 598 current_version |= GOOGLE_URL_TRACKER_PREFS; |
589 local_state->SetInteger(prefs::kMultipleProfilePrefMigration, | 599 local_state->SetInteger(prefs::kMultipleProfilePrefMigration, |
590 current_version); | 600 current_version); |
591 } | 601 } |
592 | 602 |
| 603 #if !defined(OS_ANDROID) |
| 604 local_state->ClearPref(kProfileResetPromptMemento); |
| 605 #endif |
| 606 |
593 #if defined(OS_CHROMEOS) | 607 #if defined(OS_CHROMEOS) |
594 chromeos::default_pinned_apps_field_trial::MigratePrefs(local_state); | 608 chromeos::default_pinned_apps_field_trial::MigratePrefs(local_state); |
595 #endif | 609 #endif |
596 | 610 |
597 #if defined(TOOLKIT_VIEWS) | 611 #if defined(TOOLKIT_VIEWS) |
598 MigrateBrowserTabStripPrefs(local_state); | 612 MigrateBrowserTabStripPrefs(local_state); |
599 #endif | 613 #endif |
600 } | 614 } |
601 | 615 |
602 } // namespace chrome | 616 } // namespace chrome |
OLD | NEW |