Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(790)

Side by Side Diff: chrome/browser/prefs/browser_prefs.cc

Issue 12330008: Get rid of the ability to unregister preferences. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "apps/prefs.h" 7 #include "apps/prefs.h"
8 #include "base/prefs/pref_registry_simple.h" 8 #include "base/prefs/pref_registry_simple.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/about_flags.h" 10 #include "chrome/browser/about_flags.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 #if defined(TOOLKIT_GTK) 108 #if defined(TOOLKIT_GTK)
109 #include "chrome/browser/ui/gtk/browser_window_gtk.h" 109 #include "chrome/browser/ui/gtk/browser_window_gtk.h"
110 #endif 110 #endif
111 111
112 #if defined(OS_CHROMEOS) 112 #if defined(OS_CHROMEOS)
113 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" 113 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
114 #include "chrome/browser/chromeos/audio/audio_handler.h" 114 #include "chrome/browser/chromeos/audio/audio_handler.h"
115 #include "chrome/browser/chromeos/customization_document.h" 115 #include "chrome/browser/chromeos/customization_document.h"
116 #include "chrome/browser/chromeos/display/display_preferences.h" 116 #include "chrome/browser/chromeos/display/display_preferences.h"
117 #include "chrome/browser/chromeos/login/login_utils.h" 117 #include "chrome/browser/chromeos/login/login_utils.h"
118 #include "chrome/browser/chromeos/login/oauth2_login_manager.h"
118 #include "chrome/browser/chromeos/login/user_image_manager.h" 119 #include "chrome/browser/chromeos/login/user_image_manager.h"
119 #include "chrome/browser/chromeos/login/user_manager.h" 120 #include "chrome/browser/chromeos/login/user_manager.h"
120 #include "chrome/browser/chromeos/login/wallpaper_manager.h" 121 #include "chrome/browser/chromeos/login/wallpaper_manager.h"
121 #include "chrome/browser/chromeos/login/wizard_controller.h" 122 #include "chrome/browser/chromeos/login/wizard_controller.h"
122 #include "chrome/browser/chromeos/preferences.h" 123 #include "chrome/browser/chromeos/preferences.h"
123 #include "chrome/browser/chromeos/proxy_config_service_impl.h" 124 #include "chrome/browser/chromeos/proxy_config_service_impl.h"
124 #include "chrome/browser/chromeos/settings/device_settings_cache.h" 125 #include "chrome/browser/chromeos/settings/device_settings_cache.h"
125 #include "chrome/browser/chromeos/status/data_promo_notification.h" 126 #include "chrome/browser/chromeos/status/data_promo_notification.h"
126 #include "chrome/browser/policy/auto_enrollment_client.h" 127 #include "chrome/browser/policy/auto_enrollment_client.h"
127 #include "chrome/browser/policy/device_cloud_policy_manager_chromeos.h" 128 #include "chrome/browser/policy/device_cloud_policy_manager_chromeos.h"
(...skipping 20 matching lines...) Expand all
148 149
149 namespace { 150 namespace {
150 151
151 enum MigratedPreferences { 152 enum MigratedPreferences {
152 NO_PREFS = 0, 153 NO_PREFS = 0,
153 DNS_PREFS = 1 << 0, 154 DNS_PREFS = 1 << 0,
154 WINDOWS_PREFS = 1 << 1, 155 WINDOWS_PREFS = 1 << 1,
155 GOOGLE_URL_TRACKER_PREFS = 1 << 2, 156 GOOGLE_URL_TRACKER_PREFS = 1 << 2,
156 }; 157 };
157 158
159 // A previous feature (see
160 // chrome/browser/protector/protected_prefs_watcher.cc in source
161 // control history) used this string as a prefix for various prefs it
162 // registered. We keep it here for now to clear out those old prefs in
163 // MigrateUserPrefs.
164 const char kBackupPref[] = "backup";
165
158 } // namespace 166 } // namespace
159 167
160 namespace chrome { 168 namespace chrome {
161 169
162 void RegisterLocalState(PrefRegistrySimple* registry) { 170 void RegisterLocalState(PrefRegistrySimple* registry) {
163 // Prefs in Local State. 171 // Prefs in Local State.
164 registry->RegisterIntegerPref(prefs::kMultipleProfilePrefMigration, 0); 172 registry->RegisterIntegerPref(prefs::kMultipleProfilePrefMigration, 0);
165 173
166 // Please keep this list alphabetized. 174 // Please keep this list alphabetized.
167 apps::RegisterPrefs(registry); 175 apps::RegisterPrefs(registry);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 printing::StickySettings::RegisterUserPrefs(registry); 338 printing::StickySettings::RegisterUserPrefs(registry);
331 RegisterAutolaunchUserPrefs(registry); 339 RegisterAutolaunchUserPrefs(registry);
332 SyncPromoUI::RegisterUserPrefs(registry); 340 SyncPromoUI::RegisterUserPrefs(registry);
333 #endif 341 #endif
334 342
335 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) 343 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
336 default_apps::RegisterUserPrefs(registry); 344 default_apps::RegisterUserPrefs(registry);
337 #endif 345 #endif
338 346
339 #if defined(OS_CHROMEOS) 347 #if defined(OS_CHROMEOS)
348 chromeos::OAuth2LoginManager::RegisterUserPrefs(registry);
340 chromeos::Preferences::RegisterUserPrefs(registry); 349 chromeos::Preferences::RegisterUserPrefs(registry);
341 chromeos::ProxyConfigServiceImpl::RegisterUserPrefs(registry); 350 chromeos::ProxyConfigServiceImpl::RegisterUserPrefs(registry);
342 #endif 351 #endif
343 352
344 #if defined(OS_WIN) 353 #if defined(OS_WIN)
345 NetworkProfileBubble::RegisterUserPrefs(registry); 354 NetworkProfileBubble::RegisterUserPrefs(registry);
346 #endif 355 #endif
356
357 // Prefs registered only for migration (clearing or moving to a new
358 // key) go here.
359 registry->RegisterDictionaryPref(kBackupPref, new DictionaryValue(),
360 PrefRegistrySyncable::UNSYNCABLE_PREF);
347 } 361 }
348 362
349 void MigrateUserPrefs(Profile* profile) { 363 void MigrateUserPrefs(Profile* profile) {
350 // Cleanup old prefs.
351 static const char kBackupPref[] = "backup";
352 PrefService* prefs = profile->GetPrefs(); 364 PrefService* prefs = profile->GetPrefs();
353 // TODO(joi): Fix to not require post-construction registration? 365
354 scoped_refptr<PrefRegistrySyncable> registry( 366 // Cleanup prefs from now-removed protector feature.
355 static_cast<PrefRegistrySyncable*>(prefs->DeprecatedGetPrefRegistry()));
356 registry->RegisterDictionaryPref(kBackupPref, new DictionaryValue(),
357 PrefRegistrySyncable::UNSYNCABLE_PREF);
358 prefs->ClearPref(kBackupPref); 367 prefs->ClearPref(kBackupPref);
359 registry->DeprecatedUnregisterPreference(kBackupPref);
360 368
361 PrefsTabHelper::MigrateUserPrefs(prefs, registry); 369 PrefsTabHelper::MigrateUserPrefs(prefs);
362 } 370 }
363 371
364 void MigrateBrowserPrefs(Profile* profile, PrefService* local_state) { 372 void MigrateBrowserPrefs(Profile* profile, PrefService* local_state) {
365 // Copy pref values which have been migrated to user_prefs from local_state, 373 // Copy pref values which have been migrated to user_prefs from local_state,
366 // or remove them from local_state outright, if copying is not required. 374 // or remove them from local_state outright, if copying is not required.
367 int current_version = 375 int current_version =
368 local_state->GetInteger(prefs::kMultipleProfilePrefMigration); 376 local_state->GetInteger(prefs::kMultipleProfilePrefMigration);
369 PrefRegistrySimple* registry = static_cast<PrefRegistrySimple*>( 377 PrefRegistrySimple* registry = static_cast<PrefRegistrySimple*>(
370 local_state->DeprecatedGetPrefRegistry()); 378 local_state->DeprecatedGetPrefRegistry());
371 379
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 } 433 }
426 local_state->ClearPref(prefs::kLastPromptedGoogleURL); 434 local_state->ClearPref(prefs::kLastPromptedGoogleURL);
427 435
428 current_version |= GOOGLE_URL_TRACKER_PREFS; 436 current_version |= GOOGLE_URL_TRACKER_PREFS;
429 local_state->SetInteger(prefs::kMultipleProfilePrefMigration, 437 local_state->SetInteger(prefs::kMultipleProfilePrefMigration,
430 current_version); 438 current_version);
431 } 439 }
432 } 440 }
433 441
434 } // namespace chrome 442 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/oauth2_login_manager.cc ('k') | chrome/browser/prefs/pref_model_associator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698