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

Side by Side Diff: chrome/browser/ui/prefs/prefs_tab_helper.cc

Issue 9749001: Fix prefs migration for font settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 316
317 static void MigratePreferences(PrefService* prefs) { 317 static void MigratePreferences(PrefService* prefs) {
318 RegisterFontsAndCharsetPrefs(prefs); 318 RegisterFontsAndCharsetPrefs(prefs);
319 for (int i = 0; i < kPrefsToMigrateLength; ++i) { 319 for (int i = 0; i < kPrefsToMigrateLength; ++i) {
320 const PrefService::Preference *pref = 320 const PrefService::Preference *pref =
321 prefs->FindPreference(kPrefNamesToMigrate[i].from); 321 prefs->FindPreference(kPrefNamesToMigrate[i].from);
322 if (!pref) continue; 322 if (!pref) continue;
323 if (!pref->IsDefaultValue()) { 323 if (!pref->IsDefaultValue()) {
324 prefs->Set(kPrefNamesToMigrate[i].to, *pref->GetValue()->DeepCopy()); 324 prefs->Set(kPrefNamesToMigrate[i].to, *pref->GetValue()->DeepCopy());
325 } 325 }
326 prefs->ClearPref(kPrefNamesToMigrate[i].from);
326 prefs->UnregisterPreference(kPrefNamesToMigrate[i].from); 327 prefs->UnregisterPreference(kPrefNamesToMigrate[i].from);
327 } 328 }
328 } 329 }
329 330
330 } // namespace 331 } // namespace
331 332
332 PrefsTabHelper::PrefsTabHelper(WebContents* contents) 333 PrefsTabHelper::PrefsTabHelper(WebContents* contents)
333 : content::WebContentsObserver(contents) { 334 : content::WebContentsObserver(contents) {
334 PrefService* prefs = GetProfile()->GetPrefs(); 335 PrefService* prefs = GetProfile()->GetPrefs();
335 pref_change_registrar_.Init(prefs); 336 pref_change_registrar_.Init(prefs);
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 659
659 void PrefsTabHelper::UpdateRendererPreferences() { 660 void PrefsTabHelper::UpdateRendererPreferences() {
660 renderer_preferences_util::UpdateFromSystemSettings( 661 renderer_preferences_util::UpdateFromSystemSettings(
661 web_contents()->GetMutableRendererPrefs(), GetProfile()); 662 web_contents()->GetMutableRendererPrefs(), GetProfile());
662 web_contents()->GetRenderViewHost()->SyncRendererPrefs(); 663 web_contents()->GetRenderViewHost()->SyncRendererPrefs();
663 } 664 }
664 665
665 Profile* PrefsTabHelper::GetProfile() { 666 Profile* PrefsTabHelper::GetProfile() {
666 return Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 667 return Profile::FromBrowserContext(web_contents()->GetBrowserContext());
667 } 668 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698