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 21 matching lines...) Expand all Loading... | |
32 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 32 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
33 #include "chrome/browser/defaults.h" | 33 #include "chrome/browser/defaults.h" |
34 #include "chrome/browser/devtools/chrome_devtools_manager_delegate.h" | 34 #include "chrome/browser/devtools/chrome_devtools_manager_delegate.h" |
35 #include "chrome/browser/download/download_prefs.h" | 35 #include "chrome/browser/download/download_prefs.h" |
36 #include "chrome/browser/extensions/browser_permissions_policy_delegate.h" | 36 #include "chrome/browser/extensions/browser_permissions_policy_delegate.h" |
37 #include "chrome/browser/extensions/extension_service.h" | 37 #include "chrome/browser/extensions/extension_service.h" |
38 #include "chrome/browser/extensions/extension_util.h" | 38 #include "chrome/browser/extensions/extension_util.h" |
39 #include "chrome/browser/extensions/extension_web_ui.h" | 39 #include "chrome/browser/extensions/extension_web_ui.h" |
40 #include "chrome/browser/extensions/extension_webkit_preferences.h" | 40 #include "chrome/browser/extensions/extension_webkit_preferences.h" |
41 #include "chrome/browser/extensions/suggest_permission_util.h" | 41 #include "chrome/browser/extensions/suggest_permission_util.h" |
42 #include "chrome/browser/font_family_cache.h" | |
42 #include "chrome/browser/geolocation/chrome_access_token_store.h" | 43 #include "chrome/browser/geolocation/chrome_access_token_store.h" |
43 #include "chrome/browser/geolocation/geolocation_permission_context.h" | 44 #include "chrome/browser/geolocation/geolocation_permission_context.h" |
44 #include "chrome/browser/geolocation/geolocation_permission_context_factory.h" | 45 #include "chrome/browser/geolocation/geolocation_permission_context_factory.h" |
45 #include "chrome/browser/media/cast_transport_host_filter.h" | 46 #include "chrome/browser/media/cast_transport_host_filter.h" |
46 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 47 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
47 #include "chrome/browser/media/midi_permission_context.h" | 48 #include "chrome/browser/media/midi_permission_context.h" |
48 #include "chrome/browser/media/midi_permission_context_factory.h" | 49 #include "chrome/browser/media/midi_permission_context_factory.h" |
49 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" | 50 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" |
50 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" | 51 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" |
51 #include "chrome/browser/net/chrome_net_log.h" | 52 #include "chrome/browser/net/chrome_net_log.h" |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
495 | 496 |
496 std::string common_name; | 497 std::string common_name; |
497 if (filter.GetString("ISSUER.CN", &common_name) && | 498 if (filter.GetString("ISSUER.CN", &common_name) && |
498 (cert.issuer().common_name == common_name)) { | 499 (cert.issuer().common_name == common_name)) { |
499 return true; | 500 return true; |
500 } | 501 } |
501 return false; | 502 return false; |
502 } | 503 } |
503 | 504 |
504 #if !defined(OS_ANDROID) | 505 #if !defined(OS_ANDROID) |
505 // Fills |map| with the per-script font prefs under path |map_name|. | 506 void FillFontFamilyMap(Profile* profile, |
Lei Zhang
2014/08/05 19:26:49
How about making this a static method in FontFamil
erikchen
2014/08/05 20:49:22
Done.
| |
506 void FillFontFamilyMap(const PrefService* prefs, | |
507 const char* map_name, | 507 const char* map_name, |
508 content::ScriptFontFamilyMap* map) { | 508 content::ScriptFontFamilyMap* map) { |
509 // TODO(falken): Get rid of the brute-force scan over possible | 509 chrome::FontFamilyCache* cache = static_cast<chrome::FontFamilyCache*>( |
510 // (font family / script) combinations - see http://crbug.com/308095. | 510 profile->GetUserData(&chrome::kFontFamilyCacheKey)); |
511 for (size_t i = 0; i < prefs::kWebKitScriptsForFontFamilyMapsLength; ++i) { | 511 if (!cache) { |
512 const char* script = prefs::kWebKitScriptsForFontFamilyMaps[i]; | 512 PrefService* prefs = profile->GetPrefs(); |
513 std::string pref_name = base::StringPrintf("%s.%s", map_name, script); | 513 cache = new chrome::FontFamilyCache(prefs); |
514 std::string font_family = prefs->GetString(pref_name.c_str()); | 514 // The profile takes ownership of |cache|. |
515 if (!font_family.empty()) | 515 profile->SetUserData(&chrome::kFontFamilyCacheKey, cache); |
516 (*map)[script] = base::UTF8ToUTF16(font_family); | |
517 } | 516 } |
517 | |
518 cache->FillFontFamilyMap(map_name, map); | |
518 } | 519 } |
519 | 520 |
520 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 521 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
521 breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost( | 522 breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost( |
522 const std::string& process_type) { | 523 const std::string& process_type) { |
523 base::FilePath dumps_path; | 524 base::FilePath dumps_path; |
524 PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path); | 525 PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path); |
525 { | 526 { |
526 ANNOTATE_SCOPED_MEMORY_LEAK; | 527 ANNOTATE_SCOPED_MEMORY_LEAK; |
527 bool upload = (getenv(env_vars::kHeadless) == NULL); | 528 bool upload = (getenv(env_vars::kHeadless) == NULL); |
(...skipping 1888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2416 | 2417 |
2417 void ChromeContentBrowserClient::OverrideWebkitPrefs( | 2418 void ChromeContentBrowserClient::OverrideWebkitPrefs( |
2418 RenderViewHost* rvh, const GURL& url, WebPreferences* web_prefs) { | 2419 RenderViewHost* rvh, const GURL& url, WebPreferences* web_prefs) { |
2419 Profile* profile = Profile::FromBrowserContext( | 2420 Profile* profile = Profile::FromBrowserContext( |
2420 rvh->GetProcess()->GetBrowserContext()); | 2421 rvh->GetProcess()->GetBrowserContext()); |
2421 PrefService* prefs = profile->GetPrefs(); | 2422 PrefService* prefs = profile->GetPrefs(); |
2422 | 2423 |
2423 // Fill per-script font preferences. These are not registered on Android | 2424 // Fill per-script font preferences. These are not registered on Android |
2424 // - http://crbug.com/308033. | 2425 // - http://crbug.com/308033. |
2425 #if !defined(OS_ANDROID) | 2426 #if !defined(OS_ANDROID) |
2426 FillFontFamilyMap(prefs, prefs::kWebKitStandardFontFamilyMap, | 2427 FillFontFamilyMap(profile, prefs::kWebKitStandardFontFamilyMap, |
2427 &web_prefs->standard_font_family_map); | 2428 &web_prefs->standard_font_family_map); |
2428 FillFontFamilyMap(prefs, prefs::kWebKitFixedFontFamilyMap, | 2429 FillFontFamilyMap(profile, prefs::kWebKitFixedFontFamilyMap, |
2429 &web_prefs->fixed_font_family_map); | 2430 &web_prefs->fixed_font_family_map); |
2430 FillFontFamilyMap(prefs, prefs::kWebKitSerifFontFamilyMap, | 2431 FillFontFamilyMap(profile, prefs::kWebKitSerifFontFamilyMap, |
2431 &web_prefs->serif_font_family_map); | 2432 &web_prefs->serif_font_family_map); |
2432 FillFontFamilyMap(prefs, prefs::kWebKitSansSerifFontFamilyMap, | 2433 FillFontFamilyMap(profile, prefs::kWebKitSansSerifFontFamilyMap, |
2433 &web_prefs->sans_serif_font_family_map); | 2434 &web_prefs->sans_serif_font_family_map); |
2434 FillFontFamilyMap(prefs, prefs::kWebKitCursiveFontFamilyMap, | 2435 FillFontFamilyMap(profile, prefs::kWebKitCursiveFontFamilyMap, |
2435 &web_prefs->cursive_font_family_map); | 2436 &web_prefs->cursive_font_family_map); |
2436 FillFontFamilyMap(prefs, prefs::kWebKitFantasyFontFamilyMap, | 2437 FillFontFamilyMap(profile, prefs::kWebKitFantasyFontFamilyMap, |
2437 &web_prefs->fantasy_font_family_map); | 2438 &web_prefs->fantasy_font_family_map); |
2438 FillFontFamilyMap(prefs, prefs::kWebKitPictographFontFamilyMap, | 2439 FillFontFamilyMap(profile, prefs::kWebKitPictographFontFamilyMap, |
2439 &web_prefs->pictograph_font_family_map); | 2440 &web_prefs->pictograph_font_family_map); |
2440 #endif | 2441 #endif |
2441 | 2442 |
2442 web_prefs->default_font_size = | 2443 web_prefs->default_font_size = |
2443 prefs->GetInteger(prefs::kWebKitDefaultFontSize); | 2444 prefs->GetInteger(prefs::kWebKitDefaultFontSize); |
2444 web_prefs->default_fixed_font_size = | 2445 web_prefs->default_fixed_font_size = |
2445 prefs->GetInteger(prefs::kWebKitDefaultFixedFontSize); | 2446 prefs->GetInteger(prefs::kWebKitDefaultFixedFontSize); |
2446 web_prefs->minimum_font_size = | 2447 web_prefs->minimum_font_size = |
2447 prefs->GetInteger(prefs::kWebKitMinimumFontSize); | 2448 prefs->GetInteger(prefs::kWebKitMinimumFontSize); |
2448 web_prefs->minimum_logical_font_size = | 2449 web_prefs->minimum_logical_font_size = |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2950 switches::kDisableWebRtcEncryption, | 2951 switches::kDisableWebRtcEncryption, |
2951 }; | 2952 }; |
2952 to_command_line->CopySwitchesFrom(from_command_line, | 2953 to_command_line->CopySwitchesFrom(from_command_line, |
2953 kWebRtcDevSwitchNames, | 2954 kWebRtcDevSwitchNames, |
2954 arraysize(kWebRtcDevSwitchNames)); | 2955 arraysize(kWebRtcDevSwitchNames)); |
2955 } | 2956 } |
2956 } | 2957 } |
2957 #endif // defined(ENABLE_WEBRTC) | 2958 #endif // defined(ENABLE_WEBRTC) |
2958 | 2959 |
2959 } // namespace chrome | 2960 } // namespace chrome |
OLD | NEW |