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

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: 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 | no next file » | 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 available on Android and
2096 // filling the maps is CPU intensive (http://crbug.com/308033). The ifdef can
2097 // be removed after http://crbug.com/308095 is solved.
2098 #if !defined(OS_ANDROID)
Yaron 2013/10/16 16:24:13 Theres' some related code in chrome/browser/ui/pre
ppi 2013/10/16 18:02:36 Thanks for the pointer! Actually, it looks like th
Yaron 2013/10/16 18:08:53 Ya, I measured after the observers were removed. W
2093 FillFontFamilyMap(prefs, prefs::kWebKitStandardFontFamilyMap, 2099 FillFontFamilyMap(prefs, prefs::kWebKitStandardFontFamilyMap,
2094 &web_prefs->standard_font_family_map); 2100 &web_prefs->standard_font_family_map);
2095 FillFontFamilyMap(prefs, prefs::kWebKitFixedFontFamilyMap, 2101 FillFontFamilyMap(prefs, prefs::kWebKitFixedFontFamilyMap,
2096 &web_prefs->fixed_font_family_map); 2102 &web_prefs->fixed_font_family_map);
2097 FillFontFamilyMap(prefs, prefs::kWebKitSerifFontFamilyMap, 2103 FillFontFamilyMap(prefs, prefs::kWebKitSerifFontFamilyMap,
2098 &web_prefs->serif_font_family_map); 2104 &web_prefs->serif_font_family_map);
2099 FillFontFamilyMap(prefs, prefs::kWebKitSansSerifFontFamilyMap, 2105 FillFontFamilyMap(prefs, prefs::kWebKitSansSerifFontFamilyMap,
2100 &web_prefs->sans_serif_font_family_map); 2106 &web_prefs->sans_serif_font_family_map);
2101 FillFontFamilyMap(prefs, prefs::kWebKitCursiveFontFamilyMap, 2107 FillFontFamilyMap(prefs, prefs::kWebKitCursiveFontFamilyMap,
2102 &web_prefs->cursive_font_family_map); 2108 &web_prefs->cursive_font_family_map);
2103 FillFontFamilyMap(prefs, prefs::kWebKitFantasyFontFamilyMap, 2109 FillFontFamilyMap(prefs, prefs::kWebKitFantasyFontFamilyMap,
2104 &web_prefs->fantasy_font_family_map); 2110 &web_prefs->fantasy_font_family_map);
2105 FillFontFamilyMap(prefs, prefs::kWebKitPictographFontFamilyMap, 2111 FillFontFamilyMap(prefs, prefs::kWebKitPictographFontFamilyMap,
2106 &web_prefs->pictograph_font_family_map); 2112 &web_prefs->pictograph_font_family_map);
2113 #endif
2107 2114
2108 web_prefs->default_font_size = 2115 web_prefs->default_font_size =
2109 prefs->GetInteger(prefs::kWebKitDefaultFontSize); 2116 prefs->GetInteger(prefs::kWebKitDefaultFontSize);
2110 web_prefs->default_fixed_font_size = 2117 web_prefs->default_fixed_font_size =
2111 prefs->GetInteger(prefs::kWebKitDefaultFixedFontSize); 2118 prefs->GetInteger(prefs::kWebKitDefaultFixedFontSize);
2112 web_prefs->minimum_font_size = 2119 web_prefs->minimum_font_size =
2113 prefs->GetInteger(prefs::kWebKitMinimumFontSize); 2120 prefs->GetInteger(prefs::kWebKitMinimumFontSize);
2114 web_prefs->minimum_logical_font_size = 2121 web_prefs->minimum_logical_font_size =
2115 prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize); 2122 prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize);
2116 2123
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
2572 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, 2579 return IsExtensionOrSharedModuleWhitelisted(url, extension_set,
2573 allowed_file_handle_origins_) || 2580 allowed_file_handle_origins_) ||
2574 IsHostAllowedByCommandLine(url, extension_set, 2581 IsHostAllowedByCommandLine(url, extension_set,
2575 switches::kAllowNaClFileHandleAPI); 2582 switches::kAllowNaClFileHandleAPI);
2576 #else 2583 #else
2577 return false; 2584 return false;
2578 #endif 2585 #endif
2579 } 2586 }
2580 2587
2581 } // namespace chrome 2588 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698