Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(749)

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 10107014: Migrate WebKit "global script" font prefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 1320 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
1321 return !browser_command_line.HasSwitch(switches::kChromeFrame); 1321 return !browser_command_line.HasSwitch(switches::kChromeFrame);
1322 } 1322 }
1323 1323
1324 void ChromeContentBrowserClient::OverrideWebkitPrefs( 1324 void ChromeContentBrowserClient::OverrideWebkitPrefs(
1325 RenderViewHost* rvh, const GURL& url, WebPreferences* web_prefs) { 1325 RenderViewHost* rvh, const GURL& url, WebPreferences* web_prefs) {
1326 Profile* profile = Profile::FromBrowserContext( 1326 Profile* profile = Profile::FromBrowserContext(
1327 rvh->GetProcess()->GetBrowserContext()); 1327 rvh->GetProcess()->GetBrowserContext());
1328 PrefService* prefs = profile->GetPrefs(); 1328 PrefService* prefs = profile->GetPrefs();
1329 1329
1330 web_prefs->standard_font_family =
1331 UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalStandardFontFamily));
1332 web_prefs->fixed_font_family =
1333 UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalFixedFontFamily));
1334 web_prefs->serif_font_family =
1335 UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalSerifFontFamily));
1336 web_prefs->sans_serif_font_family =
1337 UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalSansSerifFontFamily));
1338 web_prefs->cursive_font_family =
1339 UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalCursiveFontFamily));
1340 web_prefs->fantasy_font_family =
1341 UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalFantasyFontFamily));
1342
1343 FillFontFamilyMap(prefs, prefs::kWebKitStandardFontFamilyMap, 1330 FillFontFamilyMap(prefs, prefs::kWebKitStandardFontFamilyMap,
1344 &web_prefs->standard_font_family_map); 1331 &web_prefs->standard_font_family_map);
1345 FillFontFamilyMap(prefs, prefs::kWebKitFixedFontFamilyMap, 1332 FillFontFamilyMap(prefs, prefs::kWebKitFixedFontFamilyMap,
1346 &web_prefs->fixed_font_family_map); 1333 &web_prefs->fixed_font_family_map);
1347 FillFontFamilyMap(prefs, prefs::kWebKitSerifFontFamilyMap, 1334 FillFontFamilyMap(prefs, prefs::kWebKitSerifFontFamilyMap,
1348 &web_prefs->serif_font_family_map); 1335 &web_prefs->serif_font_family_map);
1349 FillFontFamilyMap(prefs, prefs::kWebKitSansSerifFontFamilyMap, 1336 FillFontFamilyMap(prefs, prefs::kWebKitSansSerifFontFamilyMap,
1350 &web_prefs->sans_serif_font_family_map); 1337 &web_prefs->sans_serif_font_family_map);
1351 FillFontFamilyMap(prefs, prefs::kWebKitCursiveFontFamilyMap, 1338 FillFontFamilyMap(prefs, prefs::kWebKitCursiveFontFamilyMap,
1352 &web_prefs->cursive_font_family_map); 1339 &web_prefs->cursive_font_family_map);
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 #if defined(USE_NSS) 1610 #if defined(USE_NSS)
1624 crypto::CryptoModuleBlockingPasswordDelegate* 1611 crypto::CryptoModuleBlockingPasswordDelegate*
1625 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 1612 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
1626 const GURL& url) { 1613 const GURL& url) {
1627 return browser::NewCryptoModuleBlockingDialogDelegate( 1614 return browser::NewCryptoModuleBlockingDialogDelegate(
1628 browser::kCryptoModulePasswordKeygen, url.host()); 1615 browser::kCryptoModulePasswordKeygen, url.host());
1629 } 1616 }
1630 #endif 1617 #endif
1631 1618
1632 } // namespace chrome 1619 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698