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

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

Issue 27527003: Skip per-script font preferences registration and filling on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address falken's remark. Created 7 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/ui/prefs/prefs_tab_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 (cert.issuer().common_name == common_name)) { 472 (cert.issuer().common_name == common_name)) {
473 return true; 473 return true;
474 } 474 }
475 return false; 475 return false;
476 } 476 }
477 477
478 // Fills |map| with the per-script font prefs under path |map_name|. 478 // Fills |map| with the per-script font prefs under path |map_name|.
479 void FillFontFamilyMap(const PrefService* prefs, 479 void FillFontFamilyMap(const PrefService* prefs,
480 const char* map_name, 480 const char* map_name,
481 webkit_glue::ScriptFontFamilyMap* map) { 481 webkit_glue::ScriptFontFamilyMap* map) {
482 // TODO: Get rid of the brute-force scan over possible (font family / script)
483 // combinations - see http://crbug.com/308095.
482 for (size_t i = 0; i < prefs::kWebKitScriptsForFontFamilyMapsLength; ++i) { 484 for (size_t i = 0; i < prefs::kWebKitScriptsForFontFamilyMapsLength; ++i) {
483 const char* script = prefs::kWebKitScriptsForFontFamilyMaps[i]; 485 const char* script = prefs::kWebKitScriptsForFontFamilyMaps[i];
484 std::string pref_name = base::StringPrintf("%s.%s", map_name, script); 486 std::string pref_name = base::StringPrintf("%s.%s", map_name, script);
485 std::string font_family = prefs->GetString(pref_name.c_str()); 487 std::string font_family = prefs->GetString(pref_name.c_str());
486 if (!font_family.empty()) 488 if (!font_family.empty())
487 (*map)[script] = UTF8ToUTF16(font_family); 489 (*map)[script] = UTF8ToUTF16(font_family);
488 } 490 }
489 } 491 }
490 492
491 #if defined(OS_POSIX) && !defined(OS_MACOSX) 493 #if defined(OS_POSIX) && !defined(OS_MACOSX)
(...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after
2083 bool ChromeContentBrowserClient::IsFastShutdownPossible() { 2085 bool ChromeContentBrowserClient::IsFastShutdownPossible() {
2084 return true; 2086 return true;
2085 } 2087 }
2086 2088
2087 void ChromeContentBrowserClient::OverrideWebkitPrefs( 2089 void ChromeContentBrowserClient::OverrideWebkitPrefs(
2088 RenderViewHost* rvh, const GURL& url, WebPreferences* web_prefs) { 2090 RenderViewHost* rvh, const GURL& url, WebPreferences* web_prefs) {
2089 Profile* profile = Profile::FromBrowserContext( 2091 Profile* profile = Profile::FromBrowserContext(
2090 rvh->GetProcess()->GetBrowserContext()); 2092 rvh->GetProcess()->GetBrowserContext());
2091 PrefService* prefs = profile->GetPrefs(); 2093 PrefService* prefs = profile->GetPrefs();
2092 2094
2095 // Fill per-script font preferences. These are not registered on Android
2096 // - http://crbug.com/308033.
2097 #if !defined(OS_ANDROID)
2093 FillFontFamilyMap(prefs, prefs::kWebKitStandardFontFamilyMap, 2098 FillFontFamilyMap(prefs, prefs::kWebKitStandardFontFamilyMap,
2094 &web_prefs->standard_font_family_map); 2099 &web_prefs->standard_font_family_map);
2095 FillFontFamilyMap(prefs, prefs::kWebKitFixedFontFamilyMap, 2100 FillFontFamilyMap(prefs, prefs::kWebKitFixedFontFamilyMap,
2096 &web_prefs->fixed_font_family_map); 2101 &web_prefs->fixed_font_family_map);
2097 FillFontFamilyMap(prefs, prefs::kWebKitSerifFontFamilyMap, 2102 FillFontFamilyMap(prefs, prefs::kWebKitSerifFontFamilyMap,
2098 &web_prefs->serif_font_family_map); 2103 &web_prefs->serif_font_family_map);
2099 FillFontFamilyMap(prefs, prefs::kWebKitSansSerifFontFamilyMap, 2104 FillFontFamilyMap(prefs, prefs::kWebKitSansSerifFontFamilyMap,
2100 &web_prefs->sans_serif_font_family_map); 2105 &web_prefs->sans_serif_font_family_map);
2101 FillFontFamilyMap(prefs, prefs::kWebKitCursiveFontFamilyMap, 2106 FillFontFamilyMap(prefs, prefs::kWebKitCursiveFontFamilyMap,
2102 &web_prefs->cursive_font_family_map); 2107 &web_prefs->cursive_font_family_map);
2103 FillFontFamilyMap(prefs, prefs::kWebKitFantasyFontFamilyMap, 2108 FillFontFamilyMap(prefs, prefs::kWebKitFantasyFontFamilyMap,
2104 &web_prefs->fantasy_font_family_map); 2109 &web_prefs->fantasy_font_family_map);
2105 FillFontFamilyMap(prefs, prefs::kWebKitPictographFontFamilyMap, 2110 FillFontFamilyMap(prefs, prefs::kWebKitPictographFontFamilyMap,
2106 &web_prefs->pictograph_font_family_map); 2111 &web_prefs->pictograph_font_family_map);
2112 #endif
2107 2113
2108 web_prefs->default_font_size = 2114 web_prefs->default_font_size =
2109 prefs->GetInteger(prefs::kWebKitDefaultFontSize); 2115 prefs->GetInteger(prefs::kWebKitDefaultFontSize);
2110 web_prefs->default_fixed_font_size = 2116 web_prefs->default_fixed_font_size =
2111 prefs->GetInteger(prefs::kWebKitDefaultFixedFontSize); 2117 prefs->GetInteger(prefs::kWebKitDefaultFixedFontSize);
2112 web_prefs->minimum_font_size = 2118 web_prefs->minimum_font_size =
2113 prefs->GetInteger(prefs::kWebKitMinimumFontSize); 2119 prefs->GetInteger(prefs::kWebKitMinimumFontSize);
2114 web_prefs->minimum_logical_font_size = 2120 web_prefs->minimum_logical_font_size =
2115 prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize); 2121 prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize);
2116 2122
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
2572 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, 2578 return IsExtensionOrSharedModuleWhitelisted(url, extension_set,
2573 allowed_file_handle_origins_) || 2579 allowed_file_handle_origins_) ||
2574 IsHostAllowedByCommandLine(url, extension_set, 2580 IsHostAllowedByCommandLine(url, extension_set,
2575 switches::kAllowNaClFileHandleAPI); 2581 switches::kAllowNaClFileHandleAPI);
2576 #else 2582 #else
2577 return false; 2583 return false;
2578 #endif 2584 #endif
2579 } 2585 }
2580 2586
2581 } // namespace chrome 2587 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/prefs/prefs_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698