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

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

Issue 9834068: Merge 127707 - Fix prefs migration for font settings. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1025/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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 312
313 static void MigratePreferences(PrefService* prefs) { 313 static void MigratePreferences(PrefService* prefs) {
314 RegisterFontsAndCharsetPrefs(prefs); 314 RegisterFontsAndCharsetPrefs(prefs);
315 for (int i = 0; i < kPrefsToMigrateLength; ++i) { 315 for (int i = 0; i < kPrefsToMigrateLength; ++i) {
316 const PrefService::Preference *pref = 316 const PrefService::Preference *pref =
317 prefs->FindPreference(kPrefNamesToMigrate[i].from); 317 prefs->FindPreference(kPrefNamesToMigrate[i].from);
318 if (!pref) continue; 318 if (!pref) continue;
319 if (!pref->IsDefaultValue()) { 319 if (!pref->IsDefaultValue()) {
320 prefs->Set(kPrefNamesToMigrate[i].to, *pref->GetValue()->DeepCopy()); 320 prefs->Set(kPrefNamesToMigrate[i].to, *pref->GetValue()->DeepCopy());
321 } 321 }
322 prefs->ClearPref(kPrefNamesToMigrate[i].from);
322 prefs->UnregisterPreference(kPrefNamesToMigrate[i].from); 323 prefs->UnregisterPreference(kPrefNamesToMigrate[i].from);
323 } 324 }
324 } 325 }
325 326
326 } // namespace 327 } // namespace
327 328
328 PrefsTabHelper::PrefsTabHelper(WebContents* contents) 329 PrefsTabHelper::PrefsTabHelper(WebContents* contents)
329 : content::WebContentsObserver(contents) { 330 : content::WebContentsObserver(contents) {
330 PrefService* prefs = GetProfile()->GetPrefs(); 331 PrefService* prefs = GetProfile()->GetPrefs();
331 pref_change_registrar_.Init(prefs); 332 pref_change_registrar_.Init(prefs);
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 650
650 void PrefsTabHelper::UpdateRendererPreferences() { 651 void PrefsTabHelper::UpdateRendererPreferences() {
651 renderer_preferences_util::UpdateFromSystemSettings( 652 renderer_preferences_util::UpdateFromSystemSettings(
652 web_contents()->GetMutableRendererPrefs(), GetProfile()); 653 web_contents()->GetMutableRendererPrefs(), GetProfile());
653 web_contents()->GetRenderViewHost()->SyncRendererPrefs(); 654 web_contents()->GetRenderViewHost()->SyncRendererPrefs();
654 } 655 }
655 656
656 Profile* PrefsTabHelper::GetProfile() { 657 Profile* PrefsTabHelper::GetProfile() {
657 return Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 658 return Profile::FromBrowserContext(web_contents()->GetBrowserContext());
658 } 659 }
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