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
3 // found in the LICENSE file.
5 #include "chrome/common/chrome_content_client.h"
9 #endif // defined(OS_LINUX)
11 #include "base/command_line.h"
12 #include "base/debug/crash_logging.h"
13 #include "base/files/file_util.h"
14 #include "base/json/json_reader.h"
15 #include "base/memory/scoped_vector.h"
16 #include "base/path_service.h"
17 #include "base/strings/string16.h"
18 #include "base/strings/string_number_conversions.h"
19 #include "base/strings/string_split.h"
20 #include "base/strings/string_util.h"
21 #include "base/strings/stringprintf.h"
22 #include "base/strings/utf_string_conversions.h"
23 #include "build/build_config.h"
24 #include "chrome/common/child_process_logging.h"
25 #include "chrome/common/chrome_constants.h"
26 #include "chrome/common/chrome_paths.h"
27 #include "chrome/common/chrome_switches.h"
28 #include "chrome/common/crash_keys.h"
29 #include "chrome/common/pepper_flash.h"
30 #include "chrome/common/secure_origin_whitelist.h"
31 #include "chrome/common/url_constants.h"
32 #include "chrome/grit/common_resources.h"
33 #include "components/dom_distiller/core/url_constants.h"
34 #include "components/version_info/version_info.h"
35 #include "content/public/common/content_constants.h"
36 #include "content/public/common/content_switches.h"
37 #include "content/public/common/url_constants.h"
38 #include "content/public/common/user_agent.h"
39 #include "extensions/common/constants.h"
40 #include "gpu/config/gpu_info.h"
41 #include "net/http/http_util.h"
42 #include "ui/base/l10n/l10n_util.h"
43 #include "ui/base/layout.h"
44 #include "ui/base/resource/resource_bundle.h"
46 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
49 #include "chrome/common/component_flash_hint_file_linux.h"
50 #endif // defined(OS_LINUX)
53 #include "base/win/registry.h"
54 #include "base/win/windows_version.h"
57 #if !defined(DISABLE_NACL)
58 #include "components/nacl/common/nacl_constants.h"
59 #include "components/nacl/common/nacl_process_type.h"
60 #include "components/nacl/common/nacl_sandbox_type.h"
63 #if defined(ENABLE_PLUGINS)
64 #include "content/public/common/pepper_plugin_info.h"
65 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR.
66 #include "ppapi/shared_impl/ppapi_permissions.h"
69 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \
70 !defined(WIDEVINE_CDM_IS_COMPONENT)
71 #include "chrome/common/widevine_cdm_constants.h"
76 #if defined(ENABLE_PLUGINS)
77 const char kPDFPluginExtension
[] = "pdf";
78 const char kPDFPluginDescription
[] = "Portable Document Format";
79 const char kPDFPluginOutOfProcessMimeType
[] =
80 "application/x-google-chrome-pdf";
81 const uint32 kPDFPluginPermissions
= ppapi::PERMISSION_PRIVATE
|
82 ppapi::PERMISSION_DEV
;
84 content::PepperPluginInfo::GetInterfaceFunc g_pdf_get_interface
;
85 content::PepperPluginInfo::PPP_InitializeModuleFunc g_pdf_initialize_module
;
86 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_pdf_shutdown_module
;
88 #if !defined(DISABLE_NACL)
89 content::PepperPluginInfo::GetInterfaceFunc g_nacl_get_interface
;
90 content::PepperPluginInfo::PPP_InitializeModuleFunc g_nacl_initialize_module
;
91 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_nacl_shutdown_module
;
94 // Appends the known built-in plugins to the given vector. Some built-in
95 // plugins are "internal" which means they are compiled into the Chrome binary,
96 // and some are extra shared libraries distributed with the browser (these are
97 // not marked internal, aside from being automatically registered, they're just
99 void ComputeBuiltInPlugins(std::vector
<content::PepperPluginInfo
>* plugins
) {
100 content::PepperPluginInfo pdf_info
;
101 pdf_info
.is_internal
= true;
102 pdf_info
.is_out_of_process
= true;
103 pdf_info
.name
= ChromeContentClient::kPDFPluginName
;
104 pdf_info
.description
= kPDFPluginDescription
;
105 pdf_info
.path
= base::FilePath::FromUTF8Unsafe(
106 ChromeContentClient::kPDFPluginPath
);
107 content::WebPluginMimeType
pdf_mime_type(
108 kPDFPluginOutOfProcessMimeType
,
110 kPDFPluginDescription
);
111 pdf_info
.mime_types
.push_back(pdf_mime_type
);
112 pdf_info
.internal_entry_points
.get_interface
= g_pdf_get_interface
;
113 pdf_info
.internal_entry_points
.initialize_module
= g_pdf_initialize_module
;
114 pdf_info
.internal_entry_points
.shutdown_module
= g_pdf_shutdown_module
;
115 pdf_info
.permissions
= kPDFPluginPermissions
;
116 plugins
->push_back(pdf_info
);
120 #if !defined(DISABLE_NACL)
121 // Handle Native Client just like the PDF plugin. This means that it is
122 // enabled by default for the non-portable case. This allows apps installed
123 // from the Chrome Web Store to use NaCl even if the command line switch
124 // isn't set. For other uses of NaCl we check for the command line switch.
125 if (PathService::Get(chrome::FILE_NACL_PLUGIN
, &path
)) {
126 content::PepperPluginInfo nacl
;
127 // The nacl plugin is now built into the Chromium binary.
128 nacl
.is_internal
= true;
130 nacl
.name
= nacl::kNaClPluginName
;
131 content::WebPluginMimeType
nacl_mime_type(nacl::kNaClPluginMimeType
,
132 nacl::kNaClPluginExtension
,
133 nacl::kNaClPluginDescription
);
134 nacl
.mime_types
.push_back(nacl_mime_type
);
135 content::WebPluginMimeType
pnacl_mime_type(nacl::kPnaclPluginMimeType
,
136 nacl::kPnaclPluginExtension
,
137 nacl::kPnaclPluginDescription
);
138 nacl
.mime_types
.push_back(pnacl_mime_type
);
139 nacl
.internal_entry_points
.get_interface
= g_nacl_get_interface
;
140 nacl
.internal_entry_points
.initialize_module
= g_nacl_initialize_module
;
141 nacl
.internal_entry_points
.shutdown_module
= g_nacl_shutdown_module
;
142 nacl
.permissions
= ppapi::PERMISSION_PRIVATE
| ppapi::PERMISSION_DEV
;
143 plugins
->push_back(nacl
);
145 #endif // !defined(DISABLE_NACL)
147 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \
148 !defined(WIDEVINE_CDM_IS_COMPONENT)
149 static bool skip_widevine_cdm_file_check
= false;
150 if (PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER
, &path
)) {
151 if (skip_widevine_cdm_file_check
|| base::PathExists(path
)) {
152 content::PepperPluginInfo widevine_cdm
;
153 widevine_cdm
.is_out_of_process
= true;
154 widevine_cdm
.path
= path
;
155 widevine_cdm
.name
= kWidevineCdmDisplayName
;
156 widevine_cdm
.description
= kWidevineCdmDescription
+
157 std::string(" (version: ") +
158 WIDEVINE_CDM_VERSION_STRING
+ ")";
159 widevine_cdm
.version
= WIDEVINE_CDM_VERSION_STRING
;
160 content::WebPluginMimeType
widevine_cdm_mime_type(
161 kWidevineCdmPluginMimeType
,
162 kWidevineCdmPluginExtension
,
163 kWidevineCdmPluginMimeTypeDescription
);
165 // Add the supported codecs as if they came from the component manifest.
166 std::vector
<std::string
> codecs
;
167 codecs
.push_back(kCdmSupportedCodecVorbis
);
168 codecs
.push_back(kCdmSupportedCodecVp8
);
169 codecs
.push_back(kCdmSupportedCodecVp9
);
170 #if defined(USE_PROPRIETARY_CODECS)
171 codecs
.push_back(kCdmSupportedCodecAac
);
172 codecs
.push_back(kCdmSupportedCodecAvc1
);
173 #endif // defined(USE_PROPRIETARY_CODECS)
174 std::string codec_string
= base::JoinString(
175 codecs
, std::string(1, kCdmSupportedCodecsValueDelimiter
));
176 widevine_cdm_mime_type
.additional_param_names
.push_back(
177 base::ASCIIToUTF16(kCdmSupportedCodecsParamName
));
178 widevine_cdm_mime_type
.additional_param_values
.push_back(
179 base::ASCIIToUTF16(codec_string
));
181 widevine_cdm
.mime_types
.push_back(widevine_cdm_mime_type
);
182 widevine_cdm
.permissions
= kWidevineCdmPluginPermissions
;
183 plugins
->push_back(widevine_cdm
);
185 skip_widevine_cdm_file_check
= true;
188 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) &&
189 // !defined(WIDEVINE_CDM_IS_COMPONENT)
192 content::PepperPluginInfo
CreatePepperFlashInfo(const base::FilePath
& path
,
193 const std::string
& version
) {
194 content::PepperPluginInfo plugin
;
196 plugin
.is_out_of_process
= true;
197 plugin
.name
= content::kFlashPluginName
;
199 plugin
.permissions
= chrome::kPepperFlashPermissions
;
201 std::vector
<std::string
> flash_version_numbers
= base::SplitString(
202 version
, ".", base::TRIM_WHITESPACE
, base::SPLIT_WANT_NONEMPTY
);
203 if (flash_version_numbers
.size() < 1)
204 flash_version_numbers
.push_back("11");
205 if (flash_version_numbers
.size() < 2)
206 flash_version_numbers
.push_back("2");
207 if (flash_version_numbers
.size() < 3)
208 flash_version_numbers
.push_back("999");
209 if (flash_version_numbers
.size() < 4)
210 flash_version_numbers
.push_back("999");
211 // E.g., "Shockwave Flash 10.2 r154":
212 plugin
.description
= plugin
.name
+ " " + flash_version_numbers
[0] + "." +
213 flash_version_numbers
[1] + " r" + flash_version_numbers
[2];
214 plugin
.version
= base::JoinString(flash_version_numbers
, ".");
215 content::WebPluginMimeType
swf_mime_type(content::kFlashPluginSwfMimeType
,
216 content::kFlashPluginSwfExtension
,
217 content::kFlashPluginSwfDescription
);
218 plugin
.mime_types
.push_back(swf_mime_type
);
219 content::WebPluginMimeType
spl_mime_type(content::kFlashPluginSplMimeType
,
220 content::kFlashPluginSplExtension
,
221 content::kFlashPluginSplDescription
);
222 plugin
.mime_types
.push_back(spl_mime_type
);
227 void AddPepperFlashFromCommandLine(
228 std::vector
<content::PepperPluginInfo
>* plugins
) {
229 const base::CommandLine::StringType flash_path
=
230 base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(
231 switches::kPpapiFlashPath
);
232 if (flash_path
.empty())
235 // Also get the version from the command-line. Should be something like 11.2
237 std::string flash_version
=
238 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
239 switches::kPpapiFlashVersion
);
242 CreatePepperFlashInfo(base::FilePath(flash_path
), flash_version
));
245 #if defined(OS_LINUX)
246 // This function tests if DIR_USER_DATA can be accessed, as a simple check to
247 // see if the zygote has been sandboxed at this point.
248 bool IsUserDataDirAvailable() {
249 base::FilePath user_data_dir
;
250 return PathService::Get(chrome::DIR_USER_DATA
, &user_data_dir
);
253 // This method is used on Linux only because of architectural differences in how
254 // it loads the component updated flash plugin, and not because the other
255 // platforms do not support component updated flash. On other platforms, the
256 // component updater sends an IPC message to all threads, at undefined points in
257 // time, with the URL of the component updated flash. Because the linux zygote
258 // thread has no access to the file system after it warms up, it must preload
259 // the component updated flash.
260 bool GetComponentUpdatedPepperFlash(content::PepperPluginInfo
* plugin
) {
261 #if defined(FLAPPER_AVAILABLE)
262 if (component_flash_hint_file::DoesHintFileExist()) {
263 base::FilePath flash_path
;
265 if (component_flash_hint_file::VerifyAndReturnFlashLocation(&flash_path
,
267 // Test if the file can be mapped as executable. If the user's home
268 // directory is mounted noexec, the component flash plugin will not load.
269 // By testing for this, Chrome can fallback to the bundled flash plugin.
270 if (!component_flash_hint_file::TestExecutableMapping(flash_path
)) {
271 LOG(WARNING
) << "The component updated flash plugin could not be "
272 "mapped as executable. Attempting to fallback to the "
273 "bundled or system plugin.";
276 *plugin
= CreatePepperFlashInfo(flash_path
, version
);
280 << "Failed to locate and load the component updated flash plugin.";
282 #endif // defined(FLAPPER_AVAILABLE)
285 #endif // defined(OS_LINUX)
287 bool GetBundledPepperFlash(content::PepperPluginInfo
* plugin
) {
288 #if defined(FLAPPER_AVAILABLE)
289 base::CommandLine
* command_line
= base::CommandLine::ForCurrentProcess();
291 // Ignore bundled Pepper Flash if there is Pepper Flash specified from the
293 if (command_line
->HasSwitch(switches::kPpapiFlashPath
))
297 command_line
->HasSwitch(switches::kDisableBundledPpapiFlash
);
301 base::FilePath flash_path
;
302 if (!PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN
, &flash_path
))
305 *plugin
= CreatePepperFlashInfo(flash_path
, FLAPPER_VERSION_STRING
);
309 #endif // FLAPPER_AVAILABLE
312 #if defined(FLAPPER_AVAILABLE)
313 bool IsSystemFlashScriptDebuggerPresent() {
315 const wchar_t kFlashRegistryRoot
[] =
316 L
"SOFTWARE\\Macromedia\\FlashPlayerPepper";
317 const wchar_t kIsDebuggerValueName
[] = L
"isScriptDebugger";
319 base::win::RegKey
path_key(HKEY_LOCAL_MACHINE
, kFlashRegistryRoot
, KEY_READ
);
321 if (FAILED(path_key
.ReadValueDW(kIsDebuggerValueName
, &debug_value
)))
324 return (debug_value
== 1);
326 // TODO(wfh): implement this on OS X and Linux. crbug.com/497996.
332 bool GetSystemPepperFlash(content::PepperPluginInfo
* plugin
) {
333 base::CommandLine
* command_line
= base::CommandLine::ForCurrentProcess();
335 #if defined(FLAPPER_AVAILABLE)
336 // If flapper is available, only try the system plugin if either:
337 // --disable-bundled-ppapi-flash is specified, or the system debugger is the
338 // Flash Script Debugger.
339 if (!command_line
->HasSwitch(switches::kDisableBundledPpapiFlash
) &&
340 !IsSystemFlashScriptDebuggerPresent())
342 #endif // defined(FLAPPER_AVAILABLE)
344 // Do not try and find System Pepper Flash if there is a specific path on
345 // the commmand-line.
346 if (command_line
->HasSwitch(switches::kPpapiFlashPath
))
349 base::FilePath flash_filename
;
350 if (!PathService::Get(chrome::FILE_PEPPER_FLASH_SYSTEM_PLUGIN
,
354 if (!base::PathExists(flash_filename
))
357 base::FilePath
manifest_path(
358 flash_filename
.DirName().AppendASCII("manifest.json"));
360 std::string manifest_data
;
361 if (!base::ReadFileToString(manifest_path
, &manifest_data
))
363 scoped_ptr
<base::Value
> manifest_value(
364 base::JSONReader::Read(manifest_data
, base::JSON_ALLOW_TRAILING_COMMAS
));
365 if (!manifest_value
.get())
367 base::DictionaryValue
* manifest
= NULL
;
368 if (!manifest_value
->GetAsDictionary(&manifest
))
372 if (!chrome::CheckPepperFlashManifest(*manifest
, &version
))
375 *plugin
= CreatePepperFlashInfo(flash_filename
, version
.GetString());
378 #endif // defined(ENABLE_PLUGINS)
380 std::string
GetProduct() {
381 return version_info::GetProductNameAndVersionForUserAgent();
386 std::string
GetUserAgent() {
387 base::CommandLine
* command_line
= base::CommandLine::ForCurrentProcess();
388 if (command_line
->HasSwitch(switches::kUserAgent
)) {
389 std::string ua
= command_line
->GetSwitchValueASCII(switches::kUserAgent
);
390 if (net::HttpUtil::IsValidHeaderValue(ua
))
392 LOG(WARNING
) << "Ignored invalid value for flag --" << switches::kUserAgent
;
395 std::string product
= GetProduct();
396 #if defined(OS_ANDROID)
397 if (command_line
->HasSwitch(switches::kUseMobileUserAgent
))
398 product
+= " Mobile";
400 return content::BuildUserAgentFromProduct(product
);
403 #if !defined(DISABLE_NACL)
404 void ChromeContentClient::SetNaClEntryFunctions(
405 content::PepperPluginInfo::GetInterfaceFunc get_interface
,
406 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module
,
407 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module
) {
408 g_nacl_get_interface
= get_interface
;
409 g_nacl_initialize_module
= initialize_module
;
410 g_nacl_shutdown_module
= shutdown_module
;
414 #if defined(ENABLE_PLUGINS)
415 void ChromeContentClient::SetPDFEntryFunctions(
416 content::PepperPluginInfo::GetInterfaceFunc get_interface
,
417 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module
,
418 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module
) {
419 g_pdf_get_interface
= get_interface
;
420 g_pdf_initialize_module
= initialize_module
;
421 g_pdf_shutdown_module
= shutdown_module
;
425 void ChromeContentClient::SetActiveURL(const GURL
& url
) {
426 base::debug::SetCrashKeyValue(crash_keys::kActiveURL
,
427 url
.possibly_invalid_spec());
430 void ChromeContentClient::SetGpuInfo(const gpu::GPUInfo
& gpu_info
) {
431 #if !defined(OS_ANDROID)
432 base::debug::SetCrashKeyValue(crash_keys::kGPUVendorID
,
433 base::StringPrintf("0x%04x", gpu_info
.gpu
.vendor_id
));
434 base::debug::SetCrashKeyValue(crash_keys::kGPUDeviceID
,
435 base::StringPrintf("0x%04x", gpu_info
.gpu
.device_id
));
437 base::debug::SetCrashKeyValue(crash_keys::kGPUDriverVersion
,
438 gpu_info
.driver_version
);
439 base::debug::SetCrashKeyValue(crash_keys::kGPUPixelShaderVersion
,
440 gpu_info
.pixel_shader_version
);
441 base::debug::SetCrashKeyValue(crash_keys::kGPUVertexShaderVersion
,
442 gpu_info
.vertex_shader_version
);
443 #if defined(OS_MACOSX)
444 base::debug::SetCrashKeyValue(crash_keys::kGPUGLVersion
, gpu_info
.gl_version
);
445 #elif defined(OS_POSIX)
446 base::debug::SetCrashKeyValue(crash_keys::kGPUVendor
, gpu_info
.gl_vendor
);
447 base::debug::SetCrashKeyValue(crash_keys::kGPURenderer
, gpu_info
.gl_renderer
);
451 #if defined(ENABLE_PLUGINS)
453 content::PepperPluginInfo
* ChromeContentClient::FindMostRecentPlugin(
454 const std::vector
<content::PepperPluginInfo
*>& plugins
) {
455 auto it
= std::max_element(
456 plugins
.begin(), plugins
.end(),
457 [](content::PepperPluginInfo
* x
, content::PepperPluginInfo
* y
) {
458 Version
version_x(x
->version
);
459 DCHECK(version_x
.IsValid());
460 return version_x
.IsOlderThan(y
->version
);
462 return it
!= plugins
.end() ? *it
: nullptr;
464 #endif // defined(ENABLE_PLUGINS)
466 void ChromeContentClient::AddPepperPlugins(
467 std::vector
<content::PepperPluginInfo
>* plugins
) {
468 #if defined(ENABLE_PLUGINS)
469 ComputeBuiltInPlugins(plugins
);
470 AddPepperFlashFromCommandLine(plugins
);
472 #if defined(OS_LINUX)
473 // Depending on the sandbox configurtion, the user data directory
474 // is not always available. If it is not available, do not try and load any
475 // flash plugin. The flash player, if any, preloaded before the sandbox
476 // initialization will continue to be used.
477 if (!IsUserDataDirAvailable()) {
480 #endif // defined(OS_LINUX)
482 ScopedVector
<content::PepperPluginInfo
> flash_versions
;
484 #if defined(OS_LINUX)
485 scoped_ptr
<content::PepperPluginInfo
> component_flash(
486 new content::PepperPluginInfo
);
487 if (GetComponentUpdatedPepperFlash(component_flash
.get()))
488 flash_versions
.push_back(component_flash
.release());
489 #endif // defined(OS_LINUX)
491 scoped_ptr
<content::PepperPluginInfo
> bundled_flash(
492 new content::PepperPluginInfo
);
493 if (GetBundledPepperFlash(bundled_flash
.get()))
494 flash_versions
.push_back(bundled_flash
.release());
496 scoped_ptr
<content::PepperPluginInfo
> system_flash(
497 new content::PepperPluginInfo
);
498 if (GetSystemPepperFlash(system_flash
.get()))
499 flash_versions
.push_back(system_flash
.release());
501 // This function will return only the most recent version of the flash plugin.
502 content::PepperPluginInfo
* max_flash
=
503 FindMostRecentPlugin(flash_versions
.get());
505 plugins
->push_back(*max_flash
);
506 #endif // defined(ENABLE_PLUGINS)
509 #if defined(OS_CHROMEOS)
510 static const int kNumChromeStandardURLSchemes
= 6;
512 static const int kNumChromeStandardURLSchemes
= 5;
514 static const url::SchemeWithType kChromeStandardURLSchemes
[
515 kNumChromeStandardURLSchemes
] = {
516 {extensions::kExtensionScheme
, url::SCHEME_WITHOUT_PORT
},
517 {chrome::kChromeNativeScheme
, url::SCHEME_WITHOUT_PORT
},
518 {extensions::kExtensionResourceScheme
, url::SCHEME_WITHOUT_PORT
},
519 {chrome::kChromeSearchScheme
, url::SCHEME_WITHOUT_PORT
},
520 {dom_distiller::kDomDistillerScheme
, url::SCHEME_WITHOUT_PORT
},
521 #if defined(OS_CHROMEOS)
522 {chrome::kCrosScheme
, url::SCHEME_WITHOUT_PORT
},
526 void ChromeContentClient::AddAdditionalSchemes(
527 std::vector
<url::SchemeWithType
>* standard_schemes
,
528 std::vector
<std::string
>* savable_schemes
) {
529 for (int i
= 0; i
< kNumChromeStandardURLSchemes
; i
++)
530 standard_schemes
->push_back(kChromeStandardURLSchemes
[i
]);
532 savable_schemes
->push_back(extensions::kExtensionScheme
);
533 savable_schemes
->push_back(extensions::kExtensionResourceScheme
);
534 savable_schemes
->push_back(chrome::kChromeSearchScheme
);
535 savable_schemes
->push_back(dom_distiller::kDomDistillerScheme
);
538 std::string
ChromeContentClient::GetProduct() const {
539 return ::GetProduct();
542 std::string
ChromeContentClient::GetUserAgent() const {
543 return ::GetUserAgent();
546 base::string16
ChromeContentClient::GetLocalizedString(int message_id
) const {
547 return l10n_util::GetStringUTF16(message_id
);
550 base::StringPiece
ChromeContentClient::GetDataResource(
552 ui::ScaleFactor scale_factor
) const {
553 return ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(
554 resource_id
, scale_factor
);
557 base::RefCountedStaticMemory
* ChromeContentClient::GetDataResourceBytes(
558 int resource_id
) const {
559 return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id
);
562 gfx::Image
& ChromeContentClient::GetNativeImageNamed(int resource_id
) const {
563 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id
);
566 std::string
ChromeContentClient::GetProcessTypeNameInEnglish(int type
) {
567 #if !defined(DISABLE_NACL)
569 case PROCESS_TYPE_NACL_LOADER
:
570 return "Native Client module";
571 case PROCESS_TYPE_NACL_BROKER
:
572 return "Native Client broker";
576 NOTREACHED() << "Unknown child process type!";
580 #if defined(OS_MACOSX) && !defined(OS_IOS)
581 bool ChromeContentClient::GetSandboxProfileForSandboxType(
583 int* sandbox_profile_resource_id
) const {
584 DCHECK(sandbox_profile_resource_id
);
585 #if !defined(DISABLE_NACL)
586 if (sandbox_type
== NACL_SANDBOX_TYPE_NACL_LOADER
) {
587 *sandbox_profile_resource_id
= IDR_NACL_SANDBOX_PROFILE
;
595 void ChromeContentClient::AddSecureSchemesAndOrigins(
596 std::set
<std::string
>* schemes
,
597 std::set
<GURL
>* origins
) {
598 schemes
->insert(chrome::kChromeSearchScheme
);
599 schemes
->insert(content::kChromeUIScheme
);
600 schemes
->insert(extensions::kExtensionScheme
);
601 schemes
->insert(extensions::kExtensionResourceScheme
);
602 GetSecureOriginWhitelist(origins
);
605 void ChromeContentClient::AddServiceWorkerSchemes(
606 std::set
<std::string
>* schemes
) {
607 schemes
->insert(extensions::kExtensionScheme
);