| 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |