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