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

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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 1326 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
1327 return !browser_command_line.HasSwitch(switches::kChromeFrame); 1327 return !browser_command_line.HasSwitch(switches::kChromeFrame);
1328 } 1328 }
1329 1329
1330 void ChromeContentBrowserClient::OverrideWebkitPrefs( 1330 void ChromeContentBrowserClient::OverrideWebkitPrefs(
1331 RenderViewHost* rvh, const GURL& url, WebPreferences* web_prefs) { 1331 RenderViewHost* rvh, const GURL& url, WebPreferences* web_prefs) {
1332 Profile* profile = Profile::FromBrowserContext( 1332 Profile* profile = Profile::FromBrowserContext(
1333 rvh->GetProcess()->GetBrowserContext()); 1333 rvh->GetProcess()->GetBrowserContext());
1334 PrefService* prefs = profile->GetPrefs(); 1334 PrefService* prefs = profile->GetPrefs();
1335 1335
1336 web_prefs->standard_font_family =
1337 UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalStandardFontFamily));
1338 web_prefs->fixed_font_family =
1339 UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalFixedFontFamily));
1340 web_prefs->serif_font_family =
1341 UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalSerifFontFamily));
1342 web_prefs->sans_serif_font_family =
1343 UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalSansSerifFontFamily));
1344 web_prefs->cursive_font_family =
1345 UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalCursiveFontFamily));
1346 web_prefs->fantasy_font_family =
1347 UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalFantasyFontFamily));
1348
1349 FillFontFamilyMap(prefs, prefs::kWebKitStandardFontFamilyMap, 1336 FillFontFamilyMap(prefs, prefs::kWebKitStandardFontFamilyMap,
1350 &web_prefs->standard_font_family_map); 1337 &web_prefs->standard_font_family_map);
1351 FillFontFamilyMap(prefs, prefs::kWebKitFixedFontFamilyMap, 1338 FillFontFamilyMap(prefs, prefs::kWebKitFixedFontFamilyMap,
1352 &web_prefs->fixed_font_family_map); 1339 &web_prefs->fixed_font_family_map);
1353 FillFontFamilyMap(prefs, prefs::kWebKitSerifFontFamilyMap, 1340 FillFontFamilyMap(prefs, prefs::kWebKitSerifFontFamilyMap,
1354 &web_prefs->serif_font_family_map); 1341 &web_prefs->serif_font_family_map);
1355 FillFontFamilyMap(prefs, prefs::kWebKitSansSerifFontFamilyMap, 1342 FillFontFamilyMap(prefs, prefs::kWebKitSansSerifFontFamilyMap,
1356 &web_prefs->sans_serif_font_family_map); 1343 &web_prefs->sans_serif_font_family_map);
1357 FillFontFamilyMap(prefs, prefs::kWebKitCursiveFontFamilyMap, 1344 FillFontFamilyMap(prefs, prefs::kWebKitCursiveFontFamilyMap,
1358 &web_prefs->cursive_font_family_map); 1345 &web_prefs->cursive_font_family_map);
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 #if defined(USE_NSS) 1616 #if defined(USE_NSS)
1630 crypto::CryptoModuleBlockingPasswordDelegate* 1617 crypto::CryptoModuleBlockingPasswordDelegate*
1631 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 1618 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
1632 const GURL& url) { 1619 const GURL& url) {
1633 return browser::NewCryptoModuleBlockingDialogDelegate( 1620 return browser::NewCryptoModuleBlockingDialogDelegate(
1634 browser::kCryptoModulePasswordKeygen, url.host()); 1621 browser::kCryptoModulePasswordKeygen, url.host());
1635 } 1622 }
1636 #endif 1623 #endif
1637 1624
1638 } // namespace chrome 1625 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698