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/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 298 |
299 // Fills |map| with the per-script font prefs under path |map_name|. | 299 // Fills |map| with the per-script font prefs under path |map_name|. |
300 void FillFontFamilyMap(const PrefService* prefs, | 300 void FillFontFamilyMap(const PrefService* prefs, |
301 const char* map_name, | 301 const char* map_name, |
302 WebPreferences::ScriptFontFamilyMap* map) { | 302 WebPreferences::ScriptFontFamilyMap* map) { |
303 for (size_t i = 0; i < prefs::kWebKitScriptsForFontFamilyMapsLength; ++i) { | 303 for (size_t i = 0; i < prefs::kWebKitScriptsForFontFamilyMapsLength; ++i) { |
304 const char* script = prefs::kWebKitScriptsForFontFamilyMaps[i]; | 304 const char* script = prefs::kWebKitScriptsForFontFamilyMaps[i]; |
305 std::string pref_name = base::StringPrintf("%s.%s", map_name, script); | 305 std::string pref_name = base::StringPrintf("%s.%s", map_name, script); |
306 std::string font_family = prefs->GetString(pref_name.c_str()); | 306 std::string font_family = prefs->GetString(pref_name.c_str()); |
307 if (!font_family.empty()) | 307 if (!font_family.empty()) |
308 map->push_back(std::make_pair(script, UTF8ToUTF16(font_family))); | 308 (*map)[script] = UTF8ToUTF16(font_family); |
309 } | 309 } |
310 } | 310 } |
311 | 311 |
312 } // namespace | 312 } // namespace |
313 | 313 |
314 namespace chrome { | 314 namespace chrome { |
315 | 315 |
316 ChromeContentBrowserClient::ChromeContentBrowserClient() { | 316 ChromeContentBrowserClient::ChromeContentBrowserClient() { |
317 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) | 317 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) |
318 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); | 318 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); |
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1327 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 1327 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
1328 return !browser_command_line.HasSwitch(switches::kChromeFrame); | 1328 return !browser_command_line.HasSwitch(switches::kChromeFrame); |
1329 } | 1329 } |
1330 | 1330 |
1331 void ChromeContentBrowserClient::OverrideWebkitPrefs( | 1331 void ChromeContentBrowserClient::OverrideWebkitPrefs( |
1332 RenderViewHost* rvh, const GURL& url, WebPreferences* web_prefs) { | 1332 RenderViewHost* rvh, const GURL& url, WebPreferences* web_prefs) { |
1333 Profile* profile = Profile::FromBrowserContext( | 1333 Profile* profile = Profile::FromBrowserContext( |
1334 rvh->GetProcess()->GetBrowserContext()); | 1334 rvh->GetProcess()->GetBrowserContext()); |
1335 PrefService* prefs = profile->GetPrefs(); | 1335 PrefService* prefs = profile->GetPrefs(); |
1336 | 1336 |
1337 web_prefs->standard_font_family = | |
1338 UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalStandardFontFamily)); | |
1339 web_prefs->fixed_font_family = | |
1340 UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalFixedFontFamily)); | |
1341 web_prefs->serif_font_family = | |
1342 UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalSerifFontFamily)); | |
1343 web_prefs->sans_serif_font_family = | |
1344 UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalSansSerifFontFamily)); | |
1345 web_prefs->cursive_font_family = | |
1346 UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalCursiveFontFamily)); | |
1347 web_prefs->fantasy_font_family = | |
1348 UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalFantasyFontFamily)); | |
1349 | |
1350 FillFontFamilyMap(prefs, prefs::kWebKitStandardFontFamilyMap, | 1337 FillFontFamilyMap(prefs, prefs::kWebKitStandardFontFamilyMap, |
1351 &web_prefs->standard_font_family_map); | 1338 &web_prefs->standard_font_family_map); |
1352 FillFontFamilyMap(prefs, prefs::kWebKitFixedFontFamilyMap, | 1339 FillFontFamilyMap(prefs, prefs::kWebKitFixedFontFamilyMap, |
1353 &web_prefs->fixed_font_family_map); | 1340 &web_prefs->fixed_font_family_map); |
1354 FillFontFamilyMap(prefs, prefs::kWebKitSerifFontFamilyMap, | 1341 FillFontFamilyMap(prefs, prefs::kWebKitSerifFontFamilyMap, |
1355 &web_prefs->serif_font_family_map); | 1342 &web_prefs->serif_font_family_map); |
1356 FillFontFamilyMap(prefs, prefs::kWebKitSansSerifFontFamilyMap, | 1343 FillFontFamilyMap(prefs, prefs::kWebKitSansSerifFontFamilyMap, |
1357 &web_prefs->sans_serif_font_family_map); | 1344 &web_prefs->sans_serif_font_family_map); |
1358 FillFontFamilyMap(prefs, prefs::kWebKitCursiveFontFamilyMap, | 1345 FillFontFamilyMap(prefs, prefs::kWebKitCursiveFontFamilyMap, |
1359 &web_prefs->cursive_font_family_map); | 1346 &web_prefs->cursive_font_family_map); |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1630 #if defined(USE_NSS) | 1617 #if defined(USE_NSS) |
1631 crypto::CryptoModuleBlockingPasswordDelegate* | 1618 crypto::CryptoModuleBlockingPasswordDelegate* |
1632 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 1619 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
1633 const GURL& url) { | 1620 const GURL& url) { |
1634 return browser::NewCryptoModuleBlockingDialogDelegate( | 1621 return browser::NewCryptoModuleBlockingDialogDelegate( |
1635 browser::kCryptoModulePasswordKeygen, url.host()); | 1622 browser::kCryptoModulePasswordKeygen, url.host()); |
1636 } | 1623 } |
1637 #endif | 1624 #endif |
1638 | 1625 |
1639 } // namespace chrome | 1626 } // namespace chrome |
OLD | NEW |