Chromium Code Reviews| Index: chrome/browser/tab_contents/render_view_host_delegate_helper.cc |
| diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc |
| index 78cbf565985dff44932d3ae9d3a1bcf8bcb7138c..64379338042dfd458754c85f2c2fdcc7afc1a7f0 100644 |
| --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc |
| +++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc |
| @@ -299,6 +299,20 @@ RenderWidgetHostView* |
| return widget_host_view; |
| } |
| +// Fills |map| with the per-script font prefs under path |map_name|. |
| +static void FillFontFamilyMap(const PrefService* prefs, |
|
brettw
2011/08/22 23:23:28
Don't put static functions in the middle of the fi
falken
2011/08/23 12:05:53
Done.
|
| + const char* map_name, |
| + WebPreferences::ScriptFontFamilyMap* map) { |
| + for (size_t i = 0; i < prefs::kWebKitScriptsForFontFamilyMapsLength; ++i) { |
| + const char* script = prefs::kWebKitScriptsForFontFamilyMaps[i]; |
| + const char* pref_name = |
| + base::StringPrintf("%s.%s", map_name, script).c_str(); |
|
brettw
2011/08/22 23:23:28
This is wrong, the temporary string returned by st
falken
2011/08/23 12:05:53
Oops. Done.
|
| + std::string font_family = prefs->GetString(pref_name); |
| + if (!font_family.empty()) |
| + map->push_back(std::make_pair(script, UTF8ToUTF16(font_family))); |
| + } |
| +} |
| + |
| // static |
| WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs( |
| content::BrowserContext* browser_context, bool is_web_ui) { |
| @@ -319,6 +333,19 @@ WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs( |
| web_prefs.fantasy_font_family = |
| UTF8ToUTF16(prefs->GetString(prefs::kWebKitFantasyFontFamily)); |
| + FillFontFamilyMap(prefs, prefs::kWebKitStandardFontFamilyMap, |
| + &web_prefs.standard_font_family_map); |
| + FillFontFamilyMap(prefs, prefs::kWebKitFixedFontFamilyMap, |
| + &web_prefs.fixed_font_family_map); |
| + FillFontFamilyMap(prefs, prefs::kWebKitSerifFontFamilyMap, |
| + &web_prefs.serif_font_family_map); |
| + FillFontFamilyMap(prefs, prefs::kWebKitSansSerifFontFamilyMap, |
| + &web_prefs.sans_serif_font_family_map); |
| + FillFontFamilyMap(prefs, prefs::kWebKitCursiveFontFamilyMap, |
| + &web_prefs.cursive_font_family_map); |
| + FillFontFamilyMap(prefs, prefs::kWebKitFantasyFontFamilyMap, |
| + &web_prefs.fantasy_font_family_map); |
| + |
| web_prefs.default_font_size = |
| prefs->GetInteger(prefs::kWebKitDefaultFontSize); |
| web_prefs.default_fixed_font_size = |