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"
7 #include "base/command_line.h"
8 #include "base/debug/crash_logging.h"
9 #include "base/files/file_util.h"
10 #include "base/json/json_reader.h"
11 #include "base/path_service.h"
12 #include "base/strings/string16.h"
13 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_split.h"
15 #include "base/strings/string_util.h"
16 #include "base/strings/stringprintf.h"
17 #include "base/strings/utf_string_conversions.h"
18 #include "build/build_config.h"
19 #include "chrome/common/child_process_logging.h"
20 #include "chrome/common/chrome_constants.h"
21 #include "chrome/common/chrome_paths.h"
22 #include "chrome/common/chrome_switches.h"
23 #include "chrome/common/chrome_version_info.h"
24 #include "chrome/common/crash_keys.h"
25 #include "chrome/common/pepper_flash.h"
26 #include "chrome/common/render_messages.h"
27 #include "chrome/common/url_constants.h"
28 #include "chrome/grit/common_resources.h"
29 #include "components/dom_distiller/core/url_constants.h"
30 #include "content/public/common/content_constants.h"
31 #include "content/public/common/content_switches.h"
32 #include "content/public/common/url_constants.h"
33 #include "content/public/common/user_agent.h"
34 #include "extensions/common/constants.h"
35 #include "gpu/config/gpu_info.h"
36 #include "net/http/http_util.h"
37 #include "ui/base/l10n/l10n_util.h"
38 #include "ui/base/layout.h"
39 #include "ui/base/resource/resource_bundle.h"
41 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
44 #include "base/win/registry.h"
45 #include "base/win/windows_version.h"
46 #elif defined(OS_MACOSX)
47 #include "components/nacl/common/nacl_sandbox_type_mac.h"
50 #if !defined(DISABLE_NACL)
51 #include "components/nacl/common/nacl_constants.h"
52 #include "components/nacl/common/nacl_process_type.h"
55 #if defined(ENABLE_PLUGINS)
56 #include "chrome/common/pepper_flash.h"
57 #include "content/public/common/pepper_plugin_info.h"
58 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR.
59 #include "ppapi/shared_impl/ppapi_permissions.h"
62 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \
63 !defined(WIDEVINE_CDM_IS_COMPONENT)
64 #include "chrome/common/widevine_cdm_constants.h"
69 #if defined(ENABLE_PLUGINS)
70 const char kPDFPluginExtension
[] = "pdf";
71 const char kPDFPluginDescription
[] = "Portable Document Format";
72 const char kPDFPluginOutOfProcessMimeType
[] =
73 "application/x-google-chrome-pdf";
74 const uint32 kPDFPluginPermissions
= ppapi::PERMISSION_PRIVATE
|
75 ppapi::PERMISSION_DEV
;
77 const char kEffectsPluginName
[] = "Google Talk Effects Plugin";
78 const char kEffectsPluginMimeType
[] ="application/x-ppapi-hangouts-effects";
79 const char kEffectsPluginExtension
[] = "";
80 const char kEffectsPluginDescription
[] = "Google Talk Effects Plugin";
81 const uint32 kEffectsPluginPermissions
= 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(ENABLE_REMOTING)
90 content::PepperPluginInfo::GetInterfaceFunc g_remoting_get_interface
;
91 content::PepperPluginInfo::PPP_InitializeModuleFunc
92 g_remoting_initialize_module
;
93 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_remoting_shutdown_module
;
95 #if defined(GOOGLE_CHROME_BUILD)
96 const char kRemotingViewerPluginName
[] = "Chrome Remote Desktop Viewer";
98 const char kRemotingViewerPluginName
[] = "Chromoting Viewer";
99 #endif // defined(GOOGLE_CHROME_BUILD)
100 const char kRemotingViewerPluginDescription
[] =
101 "This plugin allows you to securely access other computers that have been "
102 "shared with you. To use this plugin you must first install the "
103 "<a href=\"https://chrome.google.com/remotedesktop\">"
104 "Chrome Remote Desktop</a> webapp.";
105 // Use a consistent MIME-type regardless of branding.
106 const char kRemotingViewerPluginMimeType
[] =
107 "application/vnd.chromium.remoting-viewer";
108 const char kRemotingViewerPluginMimeExtension
[] = "";
109 const char kRemotingViewerPluginMimeDescription
[] = "";
110 const uint32 kRemotingViewerPluginPermissions
= ppapi::PERMISSION_PRIVATE
|
111 ppapi::PERMISSION_DEV
;
112 #endif // defined(ENABLE_REMOTING)
114 #if !defined(DISABLE_NACL)
115 content::PepperPluginInfo::GetInterfaceFunc g_nacl_get_interface
;
116 content::PepperPluginInfo::PPP_InitializeModuleFunc g_nacl_initialize_module
;
117 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_nacl_shutdown_module
;
120 // Appends the known built-in plugins to the given vector. Some built-in
121 // plugins are "internal" which means they are compiled into the Chrome binary,
122 // and some are extra shared libraries distributed with the browser (these are
123 // not marked internal, aside from being automatically registered, they're just
125 void ComputeBuiltInPlugins(std::vector
<content::PepperPluginInfo
>* plugins
) {
126 content::PepperPluginInfo pdf_info
;
127 pdf_info
.is_internal
= true;
128 pdf_info
.is_out_of_process
= true;
129 pdf_info
.name
= ChromeContentClient::kPDFPluginName
;
130 pdf_info
.description
= kPDFPluginDescription
;
131 pdf_info
.path
= base::FilePath::FromUTF8Unsafe(
132 ChromeContentClient::kPDFPluginPath
);
133 content::WebPluginMimeType
pdf_mime_type(
134 kPDFPluginOutOfProcessMimeType
,
136 kPDFPluginDescription
);
137 pdf_info
.mime_types
.push_back(pdf_mime_type
);
138 pdf_info
.internal_entry_points
.get_interface
= g_pdf_get_interface
;
139 pdf_info
.internal_entry_points
.initialize_module
= g_pdf_initialize_module
;
140 pdf_info
.internal_entry_points
.shutdown_module
= g_pdf_shutdown_module
;
141 pdf_info
.permissions
= kPDFPluginPermissions
;
142 plugins
->push_back(pdf_info
);
146 #if !defined(DISABLE_NACL)
147 // Handle Native Client just like the PDF plugin. This means that it is
148 // enabled by default for the non-portable case. This allows apps installed
149 // from the Chrome Web Store to use NaCl even if the command line switch
150 // isn't set. For other uses of NaCl we check for the command line switch.
151 if (PathService::Get(chrome::FILE_NACL_PLUGIN
, &path
)) {
152 content::PepperPluginInfo nacl
;
153 // The nacl plugin is now built into the Chromium binary.
154 nacl
.is_internal
= true;
156 nacl
.name
= nacl::kNaClPluginName
;
157 content::WebPluginMimeType
nacl_mime_type(nacl::kNaClPluginMimeType
,
158 nacl::kNaClPluginExtension
,
159 nacl::kNaClPluginDescription
);
160 nacl
.mime_types
.push_back(nacl_mime_type
);
161 content::WebPluginMimeType
pnacl_mime_type(nacl::kPnaclPluginMimeType
,
162 nacl::kPnaclPluginExtension
,
163 nacl::kPnaclPluginDescription
);
164 nacl
.mime_types
.push_back(pnacl_mime_type
);
165 nacl
.internal_entry_points
.get_interface
= g_nacl_get_interface
;
166 nacl
.internal_entry_points
.initialize_module
= g_nacl_initialize_module
;
167 nacl
.internal_entry_points
.shutdown_module
= g_nacl_shutdown_module
;
168 nacl
.permissions
= ppapi::PERMISSION_PRIVATE
| ppapi::PERMISSION_DEV
;
169 plugins
->push_back(nacl
);
171 #endif // !defined(DISABLE_NACL)
173 // TODO(vrk): Remove this when NaCl effects plugin replaces the ppapi effects
175 static bool skip_effects_file_check
= false;
176 if (PathService::Get(chrome::FILE_EFFECTS_PLUGIN
, &path
)) {
177 if (skip_effects_file_check
|| base::PathExists(path
)) {
178 content::PepperPluginInfo effects
;
180 effects
.name
= kEffectsPluginName
;
181 effects
.is_out_of_process
= true;
182 effects
.permissions
= kEffectsPluginPermissions
;
183 content::WebPluginMimeType
effects_mime_type(kEffectsPluginMimeType
,
184 kEffectsPluginExtension
,
185 kEffectsPluginDescription
);
186 effects
.mime_types
.push_back(effects_mime_type
);
187 plugins
->push_back(effects
);
189 skip_effects_file_check
= true;
193 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \
194 !defined(WIDEVINE_CDM_IS_COMPONENT)
195 static bool skip_widevine_cdm_file_check
= false;
196 if (PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER
, &path
)) {
197 if (skip_widevine_cdm_file_check
|| base::PathExists(path
)) {
198 content::PepperPluginInfo widevine_cdm
;
199 widevine_cdm
.is_out_of_process
= true;
200 widevine_cdm
.path
= path
;
201 widevine_cdm
.name
= kWidevineCdmDisplayName
;
202 widevine_cdm
.description
= kWidevineCdmDescription
+
203 std::string(" (version: ") +
204 WIDEVINE_CDM_VERSION_STRING
+ ")";
205 widevine_cdm
.version
= WIDEVINE_CDM_VERSION_STRING
;
206 content::WebPluginMimeType
widevine_cdm_mime_type(
207 kWidevineCdmPluginMimeType
,
208 kWidevineCdmPluginExtension
,
209 kWidevineCdmPluginMimeTypeDescription
);
211 // Add the supported codecs as if they came from the component manifest.
212 std::vector
<std::string
> codecs
;
213 codecs
.push_back(kCdmSupportedCodecVorbis
);
214 codecs
.push_back(kCdmSupportedCodecVp8
);
215 codecs
.push_back(kCdmSupportedCodecVp9
);
216 #if defined(USE_PROPRIETARY_CODECS)
217 codecs
.push_back(kCdmSupportedCodecAac
);
218 codecs
.push_back(kCdmSupportedCodecAvc1
);
219 #endif // defined(USE_PROPRIETARY_CODECS)
220 std::string codec_string
=
221 JoinString(codecs
, kCdmSupportedCodecsValueDelimiter
);
222 widevine_cdm_mime_type
.additional_param_names
.push_back(
223 base::ASCIIToUTF16(kCdmSupportedCodecsParamName
));
224 widevine_cdm_mime_type
.additional_param_values
.push_back(
225 base::ASCIIToUTF16(codec_string
));
227 widevine_cdm
.mime_types
.push_back(widevine_cdm_mime_type
);
228 widevine_cdm
.permissions
= kWidevineCdmPluginPermissions
;
229 plugins
->push_back(widevine_cdm
);
231 skip_widevine_cdm_file_check
= true;
234 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) &&
235 // !defined(WIDEVINE_CDM_IS_COMPONENT)
237 // The Remoting Viewer plugin is built-in.
238 #if defined(ENABLE_REMOTING)
239 content::PepperPluginInfo info
;
240 info
.is_internal
= true;
241 info
.is_out_of_process
= true;
242 info
.name
= kRemotingViewerPluginName
;
243 info
.description
= kRemotingViewerPluginDescription
;
244 info
.path
= base::FilePath::FromUTF8Unsafe(
245 ChromeContentClient::kRemotingViewerPluginPath
);
246 content::WebPluginMimeType
remoting_mime_type(
247 kRemotingViewerPluginMimeType
,
248 kRemotingViewerPluginMimeExtension
,
249 kRemotingViewerPluginMimeDescription
);
250 info
.mime_types
.push_back(remoting_mime_type
);
251 info
.internal_entry_points
.get_interface
= g_remoting_get_interface
;
252 info
.internal_entry_points
.initialize_module
= g_remoting_initialize_module
;
253 info
.internal_entry_points
.shutdown_module
= g_remoting_shutdown_module
;
254 info
.permissions
= kRemotingViewerPluginPermissions
;
256 plugins
->push_back(info
);
260 content::PepperPluginInfo
CreatePepperFlashInfo(const base::FilePath
& path
,
261 const std::string
& version
) {
262 content::PepperPluginInfo plugin
;
264 plugin
.is_out_of_process
= true;
265 plugin
.name
= content::kFlashPluginName
;
267 plugin
.permissions
= chrome::kPepperFlashPermissions
;
269 std::vector
<std::string
> flash_version_numbers
;
270 base::SplitString(version
, '.', &flash_version_numbers
);
271 if (flash_version_numbers
.size() < 1)
272 flash_version_numbers
.push_back("11");
273 // |SplitString()| puts in an empty string given an empty string. :(
274 else if (flash_version_numbers
[0].empty())
275 flash_version_numbers
[0] = "11";
276 if (flash_version_numbers
.size() < 2)
277 flash_version_numbers
.push_back("2");
278 if (flash_version_numbers
.size() < 3)
279 flash_version_numbers
.push_back("999");
280 if (flash_version_numbers
.size() < 4)
281 flash_version_numbers
.push_back("999");
282 // E.g., "Shockwave Flash 10.2 r154":
283 plugin
.description
= plugin
.name
+ " " + flash_version_numbers
[0] + "." +
284 flash_version_numbers
[1] + " r" + flash_version_numbers
[2];
285 plugin
.version
= JoinString(flash_version_numbers
, '.');
286 content::WebPluginMimeType
swf_mime_type(content::kFlashPluginSwfMimeType
,
287 content::kFlashPluginSwfExtension
,
288 content::kFlashPluginSwfDescription
);
289 plugin
.mime_types
.push_back(swf_mime_type
);
290 content::WebPluginMimeType
spl_mime_type(content::kFlashPluginSplMimeType
,
291 content::kFlashPluginSplExtension
,
292 content::kFlashPluginSplDescription
);
293 plugin
.mime_types
.push_back(spl_mime_type
);
298 void AddPepperFlashFromCommandLine(
299 std::vector
<content::PepperPluginInfo
>* plugins
) {
300 const base::CommandLine::StringType flash_path
=
301 base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(
302 switches::kPpapiFlashPath
);
303 if (flash_path
.empty())
306 // Also get the version from the command-line. Should be something like 11.2
308 std::string flash_version
=
309 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
310 switches::kPpapiFlashVersion
);
313 CreatePepperFlashInfo(base::FilePath(flash_path
), flash_version
));
316 bool GetBundledPepperFlash(content::PepperPluginInfo
* plugin
) {
317 #if defined(FLAPPER_AVAILABLE)
318 base::CommandLine
* command_line
= base::CommandLine::ForCurrentProcess();
320 // Ignore bundled Pepper Flash if there is Pepper Flash specified from the
322 if (command_line
->HasSwitch(switches::kPpapiFlashPath
))
326 command_line
->HasSwitch(switches::kDisableBundledPpapiFlash
);
330 base::FilePath flash_path
;
331 if (!PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN
, &flash_path
))
334 *plugin
= CreatePepperFlashInfo(flash_path
, FLAPPER_VERSION_STRING
);
338 #endif // FLAPPER_AVAILABLE
342 const char kPepperFlashDLLBaseName
[] =
343 #if defined(ARCH_CPU_X86)
345 #elif defined(ARCH_CPU_X86_64)
348 #error Unsupported Windows CPU architecture.
349 #endif // defined(ARCH_CPU_X86)
350 #endif // defined(OS_WIN)
352 bool GetSystemPepperFlash(content::PepperPluginInfo
* plugin
) {
353 base::CommandLine
* command_line
= base::CommandLine::ForCurrentProcess();
354 #if defined(FLAPPER_AVAILABLE)
355 // If flapper is available, only try system plugin if
356 // --disable-bundled-ppapi-flash is specified.
357 if (!command_line
->HasSwitch(switches::kDisableBundledPpapiFlash
))
359 #endif // defined(FLAPPER_AVAILABLE)
361 // Do not try and find System Pepper Flash if there is a specific path on
362 // the commmand-line.
363 if (command_line
->HasSwitch(switches::kPpapiFlashPath
))
366 base::FilePath flash_path
;
367 if (!PathService::Get(chrome::DIR_PEPPER_FLASH_SYSTEM_PLUGIN
, &flash_path
))
370 if (!base::PathExists(flash_path
))
373 base::FilePath
manifest_path(flash_path
.AppendASCII("manifest.json"));
375 std::string manifest_data
;
376 if (!base::ReadFileToString(manifest_path
, &manifest_data
))
378 scoped_ptr
<base::Value
> manifest_value(
379 base::JSONReader::Read(manifest_data
, base::JSON_ALLOW_TRAILING_COMMAS
));
380 if (!manifest_value
.get())
382 base::DictionaryValue
* manifest
= NULL
;
383 if (!manifest_value
->GetAsDictionary(&manifest
))
387 if (!chrome::CheckPepperFlashManifest(*manifest
, &version
))
391 // PepperFlash DLLs on Windows look like basename_v_x_y_z.dll.
392 std::string
filename(kPepperFlashDLLBaseName
);
393 filename
.append(version
.GetString());
394 base::ReplaceChars(filename
, ".", "_", &filename
);
395 filename
.append(".dll");
397 base::FilePath
path(flash_path
.Append(base::ASCIIToUTF16(filename
)));
399 // PepperFlash on OS X is called PepperFlashPlayer.plugin
400 base::FilePath
path(flash_path
.Append(chrome::kPepperFlashPluginFilename
));
403 if (!base::PathExists(path
))
406 *plugin
= CreatePepperFlashInfo(path
, version
.GetString());
409 #endif // defined(ENABLE_PLUGINS)
411 std::string
GetProduct() {
412 chrome::VersionInfo version_info
;
413 return version_info
.ProductNameAndVersionForUserAgent();
418 std::string
GetUserAgent() {
419 base::CommandLine
* command_line
= base::CommandLine::ForCurrentProcess();
420 if (command_line
->HasSwitch(switches::kUserAgent
)) {
421 std::string ua
= command_line
->GetSwitchValueASCII(switches::kUserAgent
);
422 if (net::HttpUtil::IsValidHeaderValue(ua
))
424 LOG(WARNING
) << "Ignored invalid value for flag --" << switches::kUserAgent
;
427 std::string product
= GetProduct();
428 #if defined(OS_ANDROID)
429 if (command_line
->HasSwitch(switches::kUseMobileUserAgent
))
430 product
+= " Mobile";
432 return content::BuildUserAgentFromProduct(product
);
436 #if defined(ENABLE_REMOTING)
438 void ChromeContentClient::SetRemotingEntryFunctions(
439 content::PepperPluginInfo::GetInterfaceFunc get_interface
,
440 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module
,
441 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module
) {
442 g_remoting_get_interface
= get_interface
;
443 g_remoting_initialize_module
= initialize_module
;
444 g_remoting_shutdown_module
= shutdown_module
;
448 #if !defined(DISABLE_NACL)
449 void ChromeContentClient::SetNaClEntryFunctions(
450 content::PepperPluginInfo::GetInterfaceFunc get_interface
,
451 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module
,
452 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module
) {
453 g_nacl_get_interface
= get_interface
;
454 g_nacl_initialize_module
= initialize_module
;
455 g_nacl_shutdown_module
= shutdown_module
;
459 #if defined(ENABLE_PLUGINS)
460 void ChromeContentClient::SetPDFEntryFunctions(
461 content::PepperPluginInfo::GetInterfaceFunc get_interface
,
462 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module
,
463 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module
) {
464 g_pdf_get_interface
= get_interface
;
465 g_pdf_initialize_module
= initialize_module
;
466 g_pdf_shutdown_module
= shutdown_module
;
470 void ChromeContentClient::SetActiveURL(const GURL
& url
) {
471 base::debug::SetCrashKeyValue(crash_keys::kActiveURL
,
472 url
.possibly_invalid_spec());
475 void ChromeContentClient::SetGpuInfo(const gpu::GPUInfo
& gpu_info
) {
476 #if !defined(OS_ANDROID)
477 base::debug::SetCrashKeyValue(crash_keys::kGPUVendorID
,
478 base::StringPrintf("0x%04x", gpu_info
.gpu
.vendor_id
));
479 base::debug::SetCrashKeyValue(crash_keys::kGPUDeviceID
,
480 base::StringPrintf("0x%04x", gpu_info
.gpu
.device_id
));
482 base::debug::SetCrashKeyValue(crash_keys::kGPUDriverVersion
,
483 gpu_info
.driver_version
);
484 base::debug::SetCrashKeyValue(crash_keys::kGPUPixelShaderVersion
,
485 gpu_info
.pixel_shader_version
);
486 base::debug::SetCrashKeyValue(crash_keys::kGPUVertexShaderVersion
,
487 gpu_info
.vertex_shader_version
);
488 #if defined(OS_MACOSX)
489 base::debug::SetCrashKeyValue(crash_keys::kGPUGLVersion
, gpu_info
.gl_version
);
490 #elif defined(OS_POSIX)
491 base::debug::SetCrashKeyValue(crash_keys::kGPUVendor
, gpu_info
.gl_vendor
);
492 base::debug::SetCrashKeyValue(crash_keys::kGPURenderer
, gpu_info
.gl_renderer
);
496 void ChromeContentClient::AddPepperPlugins(
497 std::vector
<content::PepperPluginInfo
>* plugins
) {
498 #if defined(ENABLE_PLUGINS)
499 ComputeBuiltInPlugins(plugins
);
500 AddPepperFlashFromCommandLine(plugins
);
502 content::PepperPluginInfo plugin
;
503 if (GetBundledPepperFlash(&plugin
))
504 plugins
->push_back(plugin
);
505 if (GetSystemPepperFlash(&plugin
))
506 plugins
->push_back(plugin
);
510 void ChromeContentClient::AddAdditionalSchemes(
511 std::vector
<std::string
>* standard_schemes
,
512 std::vector
<std::string
>* savable_schemes
) {
513 standard_schemes
->push_back(extensions::kExtensionScheme
);
514 savable_schemes
->push_back(extensions::kExtensionScheme
);
515 standard_schemes
->push_back(chrome::kChromeNativeScheme
);
516 standard_schemes
->push_back(extensions::kExtensionResourceScheme
);
517 savable_schemes
->push_back(extensions::kExtensionResourceScheme
);
518 standard_schemes
->push_back(chrome::kChromeSearchScheme
);
519 savable_schemes
->push_back(chrome::kChromeSearchScheme
);
520 standard_schemes
->push_back(dom_distiller::kDomDistillerScheme
);
521 savable_schemes
->push_back(dom_distiller::kDomDistillerScheme
);
522 #if defined(OS_CHROMEOS)
523 standard_schemes
->push_back(chrome::kCrosScheme
);
527 std::string
ChromeContentClient::GetProduct() const {
528 return ::GetProduct();
531 std::string
ChromeContentClient::GetUserAgent() const {
532 return ::GetUserAgent();
535 base::string16
ChromeContentClient::GetLocalizedString(int message_id
) const {
536 return l10n_util::GetStringUTF16(message_id
);
539 base::StringPiece
ChromeContentClient::GetDataResource(
541 ui::ScaleFactor scale_factor
) const {
542 return ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(
543 resource_id
, scale_factor
);
546 base::RefCountedStaticMemory
* ChromeContentClient::GetDataResourceBytes(
547 int resource_id
) const {
548 return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id
);
551 gfx::Image
& ChromeContentClient::GetNativeImageNamed(int resource_id
) const {
552 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id
);
555 std::string
ChromeContentClient::GetProcessTypeNameInEnglish(int type
) {
556 #if !defined(DISABLE_NACL)
558 case PROCESS_TYPE_NACL_LOADER
:
559 return "Native Client module";
560 case PROCESS_TYPE_NACL_BROKER
:
561 return "Native Client broker";
565 NOTREACHED() << "Unknown child process type!";
569 #if defined(OS_MACOSX) && !defined(OS_IOS)
570 bool ChromeContentClient::GetSandboxProfileForSandboxType(
572 int* sandbox_profile_resource_id
) const {
573 DCHECK(sandbox_profile_resource_id
);
574 if (sandbox_type
== NACL_SANDBOX_TYPE_NACL_LOADER
) {
575 *sandbox_profile_resource_id
= IDR_NACL_SANDBOX_PROFILE
;