| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |