| 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 16 matching lines...) Expand all Loading... |
| 27 #include "chrome/browser/chrome_quota_permission_context.h" | 27 #include "chrome/browser/chrome_quota_permission_context.h" |
| 28 #include "chrome/browser/content_settings/content_settings_utils.h" | 28 #include "chrome/browser/content_settings/content_settings_utils.h" |
| 29 #include "chrome/browser/content_settings/cookie_settings.h" | 29 #include "chrome/browser/content_settings/cookie_settings.h" |
| 30 #include "chrome/browser/content_settings/host_content_settings_map.h" | 30 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 31 #include "chrome/browser/content_settings/permission_request_id.h" | 31 #include "chrome/browser/content_settings/permission_request_id.h" |
| 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/chrome_content_browser_client_extensions_par
t.h" | 36 #include "chrome/browser/extensions/chrome_content_browser_client_extensions_par
t.h" |
| 37 #include "chrome/browser/font_family_cache.h" |
| 37 #include "chrome/browser/geolocation/chrome_access_token_store.h" | 38 #include "chrome/browser/geolocation/chrome_access_token_store.h" |
| 38 #include "chrome/browser/geolocation/geolocation_permission_context.h" | 39 #include "chrome/browser/geolocation/geolocation_permission_context.h" |
| 39 #include "chrome/browser/geolocation/geolocation_permission_context_factory.h" | 40 #include "chrome/browser/geolocation/geolocation_permission_context_factory.h" |
| 40 #include "chrome/browser/media/cast_transport_host_filter.h" | 41 #include "chrome/browser/media/cast_transport_host_filter.h" |
| 41 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 42 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
| 42 #include "chrome/browser/media/midi_permission_context.h" | 43 #include "chrome/browser/media/midi_permission_context.h" |
| 43 #include "chrome/browser/media/midi_permission_context_factory.h" | 44 #include "chrome/browser/media/midi_permission_context_factory.h" |
| 44 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" | 45 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" |
| 45 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" | 46 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" |
| 46 #include "chrome/browser/net/chrome_net_log.h" | 47 #include "chrome/browser/net/chrome_net_log.h" |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 return true; | 418 return true; |
| 418 | 419 |
| 419 std::string common_name; | 420 std::string common_name; |
| 420 if (filter.GetString("ISSUER.CN", &common_name) && | 421 if (filter.GetString("ISSUER.CN", &common_name) && |
| 421 (cert.issuer().common_name == common_name)) { | 422 (cert.issuer().common_name == common_name)) { |
| 422 return true; | 423 return true; |
| 423 } | 424 } |
| 424 return false; | 425 return false; |
| 425 } | 426 } |
| 426 | 427 |
| 427 #if !defined(OS_ANDROID) | 428 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) |
| 428 // Fills |map| with the per-script font prefs under path |map_name|. | |
| 429 void FillFontFamilyMap(const PrefService* prefs, | |
| 430 const char* map_name, | |
| 431 content::ScriptFontFamilyMap* map) { | |
| 432 // TODO(falken): Get rid of the brute-force scan over possible | |
| 433 // (font family / script) combinations - see http://crbug.com/308095. | |
| 434 for (size_t i = 0; i < prefs::kWebKitScriptsForFontFamilyMapsLength; ++i) { | |
| 435 const char* script = prefs::kWebKitScriptsForFontFamilyMaps[i]; | |
| 436 std::string pref_name = base::StringPrintf("%s.%s", map_name, script); | |
| 437 std::string font_family = prefs->GetString(pref_name.c_str()); | |
| 438 if (!font_family.empty()) | |
| 439 (*map)[script] = base::UTF8ToUTF16(font_family); | |
| 440 } | |
| 441 } | |
| 442 | |
| 443 #if defined(OS_POSIX) && !defined(OS_MACOSX) | |
| 444 breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost( | 429 breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost( |
| 445 const std::string& process_type) { | 430 const std::string& process_type) { |
| 446 base::FilePath dumps_path; | 431 base::FilePath dumps_path; |
| 447 PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path); | 432 PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path); |
| 448 { | 433 { |
| 449 ANNOTATE_SCOPED_MEMORY_LEAK; | 434 ANNOTATE_SCOPED_MEMORY_LEAK; |
| 450 bool upload = (getenv(env_vars::kHeadless) == NULL); | 435 bool upload = (getenv(env_vars::kHeadless) == NULL); |
| 451 breakpad::CrashHandlerHostLinux* crash_handler = | 436 breakpad::CrashHandlerHostLinux* crash_handler = |
| 452 new breakpad::CrashHandlerHostLinux(process_type, dumps_path, upload); | 437 new breakpad::CrashHandlerHostLinux(process_type, dumps_path, upload); |
| 453 crash_handler->StartUploaderThread(); | 438 crash_handler->StartUploaderThread(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 | 475 |
| 491 if (process_type == switches::kGpuProcess) { | 476 if (process_type == switches::kGpuProcess) { |
| 492 static breakpad::CrashHandlerHostLinux* crash_handler = NULL; | 477 static breakpad::CrashHandlerHostLinux* crash_handler = NULL; |
| 493 if (!crash_handler) | 478 if (!crash_handler) |
| 494 crash_handler = CreateCrashHandlerHost(process_type); | 479 crash_handler = CreateCrashHandlerHost(process_type); |
| 495 return crash_handler->GetDeathSignalSocket(); | 480 return crash_handler->GetDeathSignalSocket(); |
| 496 } | 481 } |
| 497 | 482 |
| 498 return -1; | 483 return -1; |
| 499 } | 484 } |
| 500 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) | 485 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) |
| 501 #endif // !defined(OS_ANDROID) | |
| 502 | 486 |
| 503 #if !defined(OS_CHROMEOS) | 487 #if !defined(OS_CHROMEOS) |
| 504 GURL GetEffectiveURLForSignin(const GURL& url) { | 488 GURL GetEffectiveURLForSignin(const GURL& url) { |
| 505 CHECK(SigninManager::IsWebBasedSigninFlowURL(url)); | 489 CHECK(SigninManager::IsWebBasedSigninFlowURL(url)); |
| 506 | 490 |
| 507 GURL effective_url(SigninManager::kChromeSigninEffectiveSite); | 491 GURL effective_url(SigninManager::kChromeSigninEffectiveSite); |
| 508 // Copy the path because the argument to SetPathStr must outlive | 492 // Copy the path because the argument to SetPathStr must outlive |
| 509 // the Replacements object. | 493 // the Replacements object. |
| 510 const std::string path_copy(url.path()); | 494 const std::string path_copy(url.path()); |
| 511 GURL::Replacements replacements; | 495 GURL::Replacements replacements; |
| (...skipping 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2087 | 2071 |
| 2088 void ChromeContentBrowserClient::OverrideWebkitPrefs( | 2072 void ChromeContentBrowserClient::OverrideWebkitPrefs( |
| 2089 RenderViewHost* rvh, const GURL& url, WebPreferences* web_prefs) { | 2073 RenderViewHost* rvh, const GURL& url, WebPreferences* web_prefs) { |
| 2090 Profile* profile = Profile::FromBrowserContext( | 2074 Profile* profile = Profile::FromBrowserContext( |
| 2091 rvh->GetProcess()->GetBrowserContext()); | 2075 rvh->GetProcess()->GetBrowserContext()); |
| 2092 PrefService* prefs = profile->GetPrefs(); | 2076 PrefService* prefs = profile->GetPrefs(); |
| 2093 | 2077 |
| 2094 // Fill per-script font preferences. These are not registered on Android | 2078 // Fill per-script font preferences. These are not registered on Android |
| 2095 // - http://crbug.com/308033. | 2079 // - http://crbug.com/308033. |
| 2096 #if !defined(OS_ANDROID) | 2080 #if !defined(OS_ANDROID) |
| 2097 FillFontFamilyMap(prefs, prefs::kWebKitStandardFontFamilyMap, | 2081 FontFamilyCache::FillFontFamilyMap(profile, |
| 2098 &web_prefs->standard_font_family_map); | 2082 prefs::kWebKitStandardFontFamilyMap, |
| 2099 FillFontFamilyMap(prefs, prefs::kWebKitFixedFontFamilyMap, | 2083 &web_prefs->standard_font_family_map); |
| 2100 &web_prefs->fixed_font_family_map); | 2084 FontFamilyCache::FillFontFamilyMap(profile, |
| 2101 FillFontFamilyMap(prefs, prefs::kWebKitSerifFontFamilyMap, | 2085 prefs::kWebKitFixedFontFamilyMap, |
| 2102 &web_prefs->serif_font_family_map); | 2086 &web_prefs->fixed_font_family_map); |
| 2103 FillFontFamilyMap(prefs, prefs::kWebKitSansSerifFontFamilyMap, | 2087 FontFamilyCache::FillFontFamilyMap(profile, |
| 2104 &web_prefs->sans_serif_font_family_map); | 2088 prefs::kWebKitSerifFontFamilyMap, |
| 2105 FillFontFamilyMap(prefs, prefs::kWebKitCursiveFontFamilyMap, | 2089 &web_prefs->serif_font_family_map); |
| 2106 &web_prefs->cursive_font_family_map); | 2090 FontFamilyCache::FillFontFamilyMap(profile, |
| 2107 FillFontFamilyMap(prefs, prefs::kWebKitFantasyFontFamilyMap, | 2091 prefs::kWebKitSansSerifFontFamilyMap, |
| 2108 &web_prefs->fantasy_font_family_map); | 2092 &web_prefs->sans_serif_font_family_map); |
| 2109 FillFontFamilyMap(prefs, prefs::kWebKitPictographFontFamilyMap, | 2093 FontFamilyCache::FillFontFamilyMap(profile, |
| 2110 &web_prefs->pictograph_font_family_map); | 2094 prefs::kWebKitCursiveFontFamilyMap, |
| 2095 &web_prefs->cursive_font_family_map); |
| 2096 FontFamilyCache::FillFontFamilyMap(profile, |
| 2097 prefs::kWebKitFantasyFontFamilyMap, |
| 2098 &web_prefs->fantasy_font_family_map); |
| 2099 FontFamilyCache::FillFontFamilyMap(profile, |
| 2100 prefs::kWebKitPictographFontFamilyMap, |
| 2101 &web_prefs->pictograph_font_family_map); |
| 2111 #endif | 2102 #endif |
| 2112 | 2103 |
| 2113 web_prefs->default_font_size = | 2104 web_prefs->default_font_size = |
| 2114 prefs->GetInteger(prefs::kWebKitDefaultFontSize); | 2105 prefs->GetInteger(prefs::kWebKitDefaultFontSize); |
| 2115 web_prefs->default_fixed_font_size = | 2106 web_prefs->default_fixed_font_size = |
| 2116 prefs->GetInteger(prefs::kWebKitDefaultFixedFontSize); | 2107 prefs->GetInteger(prefs::kWebKitDefaultFixedFontSize); |
| 2117 web_prefs->minimum_font_size = | 2108 web_prefs->minimum_font_size = |
| 2118 prefs->GetInteger(prefs::kWebKitMinimumFontSize); | 2109 prefs->GetInteger(prefs::kWebKitMinimumFontSize); |
| 2119 web_prefs->minimum_logical_font_size = | 2110 web_prefs->minimum_logical_font_size = |
| 2120 prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize); | 2111 prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize); |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2596 switches::kDisableWebRtcEncryption, | 2587 switches::kDisableWebRtcEncryption, |
| 2597 }; | 2588 }; |
| 2598 to_command_line->CopySwitchesFrom(from_command_line, | 2589 to_command_line->CopySwitchesFrom(from_command_line, |
| 2599 kWebRtcDevSwitchNames, | 2590 kWebRtcDevSwitchNames, |
| 2600 arraysize(kWebRtcDevSwitchNames)); | 2591 arraysize(kWebRtcDevSwitchNames)); |
| 2601 } | 2592 } |
| 2602 } | 2593 } |
| 2603 #endif // defined(ENABLE_WEBRTC) | 2594 #endif // defined(ENABLE_WEBRTC) |
| 2604 | 2595 |
| 2605 } // namespace chrome | 2596 } // namespace chrome |
| OLD | NEW |