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

Side by Side Diff: chrome/browser/ui/prefs/prefs_tab_helper.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/ui/prefs/prefs_tab_helper.h" 5 #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/prefs/overlay_user_pref_store.h" 9 #include "base/prefs/overlay_user_pref_store.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 PrefRegistrySyncable::UNSYNCABLE_PREF); 569 PrefRegistrySyncable::UNSYNCABLE_PREF);
570 registry->RegisterLocalizedBooleanPref(prefs::kWebKitUsesUniversalDetector, 570 registry->RegisterLocalizedBooleanPref(prefs::kWebKitUsesUniversalDetector,
571 IDS_USES_UNIVERSAL_DETECTOR, 571 IDS_USES_UNIVERSAL_DETECTOR,
572 PrefRegistrySyncable::SYNCABLE_PREF); 572 PrefRegistrySyncable::SYNCABLE_PREF);
573 registry->RegisterLocalizedStringPref(prefs::kStaticEncodings, 573 registry->RegisterLocalizedStringPref(prefs::kStaticEncodings,
574 IDS_STATIC_ENCODING_LIST, 574 IDS_STATIC_ENCODING_LIST,
575 PrefRegistrySyncable::UNSYNCABLE_PREF); 575 PrefRegistrySyncable::UNSYNCABLE_PREF);
576 registry->RegisterStringPref(prefs::kRecentlySelectedEncoding, 576 registry->RegisterStringPref(prefs::kRecentlySelectedEncoding,
577 "", 577 "",
578 PrefRegistrySyncable::UNSYNCABLE_PREF); 578 PrefRegistrySyncable::UNSYNCABLE_PREF);
579
580 RegisterPrefsToMigrate(registry);
579 } 581 }
580 582
581 void PrefsTabHelper::MigrateUserPrefs(PrefService* prefs, 583 void PrefsTabHelper::MigrateUserPrefs(PrefService* prefs) {
582 PrefRegistrySyncable* registry) {
583 RegisterPrefsToMigrate(registry);
584 for (int i = 0; i < kPrefsToMigrateLength; ++i) { 584 for (int i = 0; i < kPrefsToMigrateLength; ++i) {
585 const PrefService::Preference* pref = 585 const PrefService::Preference* pref =
586 prefs->FindPreference(kPrefNamesToMigrate[i].from); 586 prefs->FindPreference(kPrefNamesToMigrate[i].from);
587 if (!pref) continue; 587 if (pref && !pref->IsDefaultValue()) {
588 if (!pref->IsDefaultValue()) {
589 prefs->Set(kPrefNamesToMigrate[i].to, *pref->GetValue()); 588 prefs->Set(kPrefNamesToMigrate[i].to, *pref->GetValue());
589 prefs->ClearPref(kPrefNamesToMigrate[i].from);
590 } 590 }
591 prefs->ClearPref(kPrefNamesToMigrate[i].from);
592 registry->DeprecatedUnregisterPreference(kPrefNamesToMigrate[i].from);
593 } 591 }
594 } 592 }
595 593
596 void PrefsTabHelper::Observe(int type, 594 void PrefsTabHelper::Observe(int type,
597 const content::NotificationSource& source, 595 const content::NotificationSource& source,
598 const content::NotificationDetails& details) { 596 const content::NotificationDetails& details) {
599 switch (type) { 597 switch (type) {
600 case chrome::NOTIFICATION_USER_STYLE_SHEET_UPDATED: 598 case chrome::NOTIFICATION_USER_STYLE_SHEET_UPDATED:
601 UpdateWebPreferences(); 599 UpdateWebPreferences();
602 break; 600 break;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 WebPreferences web_prefs = 654 WebPreferences web_prefs =
657 web_contents_->GetRenderViewHost()->GetWebkitPreferences(); 655 web_contents_->GetRenderViewHost()->GetWebkitPreferences();
658 OverrideFontFamily(&web_prefs, generic_family, script, ""); 656 OverrideFontFamily(&web_prefs, generic_family, script, "");
659 web_contents_->GetRenderViewHost()->UpdateWebkitPreferences(web_prefs); 657 web_contents_->GetRenderViewHost()->UpdateWebkitPreferences(web_prefs);
660 return; 658 return;
661 } 659 }
662 } 660 }
663 661
664 UpdateWebPreferences(); 662 UpdateWebPreferences();
665 } 663 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/prefs/prefs_tab_helper.h ('k') | chrome/browser/ui/prefs/prefs_tab_helper_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698