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