Roll src/third_party/WebKit 116cf7f:79abaa8 (svn 189234:189235)
[chromium-blink-merge.git] / chrome / common / chrome_content_client.cc
blob587b2aaa95fbbfc17b23b3e353873ca54bcfd98f
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/path_service.h"
11 #include "base/strings/string16.h"
12 #include "base/strings/string_number_conversions.h"
13 #include "base/strings/string_split.h"
14 #include "base/strings/string_util.h"
15 #include "base/strings/stringprintf.h"
16 #include "base/strings/utf_string_conversions.h"
17 #include "build/build_config.h"
18 #include "chrome/common/child_process_logging.h"
19 #include "chrome/common/chrome_paths.h"
20 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/chrome_version_info.h"
22 #include "chrome/common/crash_keys.h"
23 #include "chrome/common/render_messages.h"
24 #include "chrome/common/url_constants.h"
25 #include "chrome/grit/common_resources.h"
26 #include "components/dom_distiller/core/url_constants.h"
27 #include "content/public/common/content_constants.h"
28 #include "content/public/common/content_switches.h"
29 #include "content/public/common/url_constants.h"
30 #include "content/public/common/user_agent.h"
31 #include "extensions/common/constants.h"
32 #include "gpu/config/gpu_info.h"
33 #include "net/http/http_util.h"
34 #include "ui/base/l10n/l10n_util.h"
35 #include "ui/base/layout.h"
36 #include "ui/base/resource/resource_bundle.h"
38 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
40 #if defined(OS_WIN)
41 #include "base/win/registry.h"
42 #include "base/win/windows_version.h"
43 #elif defined(OS_MACOSX)
44 #include "components/nacl/common/nacl_sandbox_type_mac.h"
45 #endif
47 #if !defined(DISABLE_NACL)
48 #include "components/nacl/common/nacl_constants.h"
49 #include "components/nacl/common/nacl_process_type.h"
50 #endif
52 #if defined(ENABLE_PLUGINS)
53 #include "chrome/common/pepper_flash.h"
54 #include "content/public/common/pepper_plugin_info.h"
55 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR.
56 #include "ppapi/shared_impl/ppapi_permissions.h"
57 #endif
59 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \
60 !defined(WIDEVINE_CDM_IS_COMPONENT)
61 #include "chrome/common/widevine_cdm_constants.h"
62 #endif
64 namespace {
66 #if defined(ENABLE_PLUGINS)
67 const char kPDFPluginMimeType[] = "application/pdf";
68 const char kPDFPluginExtension[] = "pdf";
69 const char kPDFPluginDescription[] = "Portable Document Format";
70 const char kPDFPluginPrintPreviewMimeType[] =
71 "application/x-google-chrome-print-preview-pdf";
72 const char kPDFPluginOutOfProcessMimeType[] =
73 "application/x-google-chrome-pdf";
74 const uint32 kPDFPluginPermissions = ppapi::PERMISSION_PRIVATE |
75 ppapi::PERMISSION_DEV;
77 const char kO1DPluginName[] = "Google Talk Plugin Video Renderer";
78 const char kO1DPluginMimeType[] ="application/o1d";
79 const char kO1DPluginExtension[] = "";
80 const char kO1DPluginDescription[] = "Google Talk Plugin Video Renderer";
81 const uint32 kO1DPluginPermissions = ppapi::PERMISSION_PRIVATE |
82 ppapi::PERMISSION_DEV;
84 const char kEffectsPluginName[] = "Google Talk Effects Plugin";
85 const char kEffectsPluginMimeType[] ="application/x-ppapi-hangouts-effects";
86 const char kEffectsPluginExtension[] = "";
87 const char kEffectsPluginDescription[] = "Google Talk Effects Plugin";
88 const uint32 kEffectsPluginPermissions = ppapi::PERMISSION_PRIVATE |
89 ppapi::PERMISSION_DEV;
91 const char kGTalkPluginName[] = "Google Talk Plugin";
92 const char kGTalkPluginMimeType[] ="application/googletalk";
93 const char kGTalkPluginExtension[] = ".googletalk";
94 const char kGTalkPluginDescription[] = "Google Talk Plugin";
95 const uint32 kGTalkPluginPermissions = ppapi::PERMISSION_PRIVATE |
96 ppapi::PERMISSION_DEV;
98 #if defined(ENABLE_REMOTING)
100 content::PepperPluginInfo::GetInterfaceFunc g_remoting_get_interface;
101 content::PepperPluginInfo::PPP_InitializeModuleFunc
102 g_remoting_initialize_module;
103 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_remoting_shutdown_module;
105 #if defined(GOOGLE_CHROME_BUILD)
106 const char kRemotingViewerPluginName[] = "Chrome Remote Desktop Viewer";
107 #else
108 const char kRemotingViewerPluginName[] = "Chromoting Viewer";
109 #endif // defined(GOOGLE_CHROME_BUILD)
110 const char kRemotingViewerPluginDescription[] =
111 "This plugin allows you to securely access other computers that have been "
112 "shared with you. To use this plugin you must first install the "
113 "<a href=\"https://chrome.google.com/remotedesktop\">"
114 "Chrome Remote Desktop</a> webapp.";
115 // Use a consistent MIME-type regardless of branding.
116 const char kRemotingViewerPluginMimeType[] =
117 "application/vnd.chromium.remoting-viewer";
118 const char kRemotingViewerPluginMimeExtension[] = "";
119 const char kRemotingViewerPluginMimeDescription[] = "";
120 const uint32 kRemotingViewerPluginPermissions = ppapi::PERMISSION_PRIVATE |
121 ppapi::PERMISSION_DEV;
122 #endif // defined(ENABLE_REMOTING)
124 #if !defined(DISABLE_NACL)
125 content::PepperPluginInfo::GetInterfaceFunc g_nacl_get_interface;
126 content::PepperPluginInfo::PPP_InitializeModuleFunc g_nacl_initialize_module;
127 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_nacl_shutdown_module;
128 #endif
130 // Appends the known built-in plugins to the given vector. Some built-in
131 // plugins are "internal" which means they are compiled into the Chrome binary,
132 // and some are extra shared libraries distributed with the browser (these are
133 // not marked internal, aside from being automatically registered, they're just
134 // regular plugins).
135 void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) {
136 // PDF.
138 // Once we're sandboxed, we can't know if the PDF plugin is available or not;
139 // but (on Linux) this function is always called once before we're sandboxed.
140 // So the first time through test if the file is available and then skip the
141 // check on subsequent calls if yes.
142 static bool skip_pdf_file_check = false;
143 base::FilePath path;
144 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) {
145 if (skip_pdf_file_check || base::PathExists(path)) {
146 content::PepperPluginInfo pdf;
147 pdf.path = path;
148 pdf.name = ChromeContentClient::kPDFPluginName;
149 if (switches::OutOfProcessPdfEnabled()) {
150 pdf.is_out_of_process = true;
151 content::WebPluginMimeType pdf_mime_type(kPDFPluginOutOfProcessMimeType,
152 kPDFPluginExtension,
153 kPDFPluginDescription);
154 pdf.mime_types.push_back(pdf_mime_type);
155 // TODO(raymes): Make print preview work with out of process PDF.
156 } else {
157 content::WebPluginMimeType pdf_mime_type(kPDFPluginMimeType,
158 kPDFPluginExtension,
159 kPDFPluginDescription);
160 content::WebPluginMimeType print_preview_pdf_mime_type(
161 kPDFPluginPrintPreviewMimeType,
162 kPDFPluginExtension,
163 kPDFPluginDescription);
164 pdf.mime_types.push_back(pdf_mime_type);
165 pdf.mime_types.push_back(print_preview_pdf_mime_type);
167 pdf.permissions = kPDFPluginPermissions;
168 plugins->push_back(pdf);
170 skip_pdf_file_check = true;
174 #if !defined(DISABLE_NACL)
175 // Handle Native Client just like the PDF plugin. This means that it is
176 // enabled by default for the non-portable case. This allows apps installed
177 // from the Chrome Web Store to use NaCl even if the command line switch
178 // isn't set. For other uses of NaCl we check for the command line switch.
179 if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) {
180 content::PepperPluginInfo nacl;
181 // The nacl plugin is now built into the Chromium binary.
182 nacl.is_internal = true;
183 nacl.path = path;
184 nacl.name = nacl::kNaClPluginName;
185 content::WebPluginMimeType nacl_mime_type(nacl::kNaClPluginMimeType,
186 nacl::kNaClPluginExtension,
187 nacl::kNaClPluginDescription);
188 nacl.mime_types.push_back(nacl_mime_type);
189 content::WebPluginMimeType pnacl_mime_type(nacl::kPnaclPluginMimeType,
190 nacl::kPnaclPluginExtension,
191 nacl::kPnaclPluginDescription);
192 nacl.mime_types.push_back(pnacl_mime_type);
193 nacl.internal_entry_points.get_interface = g_nacl_get_interface;
194 nacl.internal_entry_points.initialize_module = g_nacl_initialize_module;
195 nacl.internal_entry_points.shutdown_module = g_nacl_shutdown_module;
196 nacl.permissions = ppapi::PERMISSION_PRIVATE | ppapi::PERMISSION_DEV;
197 plugins->push_back(nacl);
199 #endif // !defined(DISABLE_NACL)
201 static bool skip_o1d_file_check = false;
202 if (PathService::Get(chrome::FILE_O1D_PLUGIN, &path)) {
203 if (skip_o1d_file_check || base::PathExists(path)) {
204 content::PepperPluginInfo o1d;
205 o1d.path = path;
206 o1d.name = kO1DPluginName;
207 o1d.is_out_of_process = true;
208 o1d.is_sandboxed = false;
209 o1d.permissions = kO1DPluginPermissions;
210 content::WebPluginMimeType o1d_mime_type(kO1DPluginMimeType,
211 kO1DPluginExtension,
212 kO1DPluginDescription);
213 o1d.mime_types.push_back(o1d_mime_type);
214 plugins->push_back(o1d);
216 skip_o1d_file_check = true;
220 // TODO(vrk): Remove this when NaCl effects plugin replaces the ppapi effects
221 // plugin.
222 static bool skip_effects_file_check = false;
223 if (PathService::Get(chrome::FILE_EFFECTS_PLUGIN, &path)) {
224 if (skip_effects_file_check || base::PathExists(path)) {
225 content::PepperPluginInfo effects;
226 effects.path = path;
227 effects.name = kEffectsPluginName;
228 effects.is_out_of_process = true;
229 effects.is_sandboxed = true;
230 effects.permissions = kEffectsPluginPermissions;
231 content::WebPluginMimeType effects_mime_type(kEffectsPluginMimeType,
232 kEffectsPluginExtension,
233 kEffectsPluginDescription);
234 effects.mime_types.push_back(effects_mime_type);
235 plugins->push_back(effects);
237 skip_effects_file_check = true;
241 static bool skip_gtalk_file_check = false;
242 if (PathService::Get(chrome::FILE_GTALK_PLUGIN, &path)) {
243 if (skip_gtalk_file_check || base::PathExists(path)) {
244 content::PepperPluginInfo gtalk;
245 gtalk.path = path;
246 gtalk.name = kGTalkPluginName;
247 gtalk.is_out_of_process = true;
248 gtalk.is_sandboxed = false;
249 gtalk.permissions = kGTalkPluginPermissions;
250 content::WebPluginMimeType gtalk_mime_type(kGTalkPluginMimeType,
251 kGTalkPluginExtension,
252 kGTalkPluginDescription);
253 gtalk.mime_types.push_back(gtalk_mime_type);
254 plugins->push_back(gtalk);
256 skip_gtalk_file_check = true;
260 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \
261 !defined(WIDEVINE_CDM_IS_COMPONENT)
262 static bool skip_widevine_cdm_file_check = false;
263 if (PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER, &path)) {
264 if (skip_widevine_cdm_file_check || base::PathExists(path)) {
265 content::PepperPluginInfo widevine_cdm;
266 widevine_cdm.is_out_of_process = true;
267 widevine_cdm.path = path;
268 widevine_cdm.name = kWidevineCdmDisplayName;
269 widevine_cdm.description = kWidevineCdmDescription +
270 std::string(" (version: ") +
271 WIDEVINE_CDM_VERSION_STRING + ")";
272 widevine_cdm.version = WIDEVINE_CDM_VERSION_STRING;
273 content::WebPluginMimeType widevine_cdm_mime_type(
274 kWidevineCdmPluginMimeType,
275 kWidevineCdmPluginExtension,
276 kWidevineCdmPluginMimeTypeDescription);
278 // Add the supported codecs as if they came from the component manifest.
279 std::vector<std::string> codecs;
280 codecs.push_back(kCdmSupportedCodecVorbis);
281 codecs.push_back(kCdmSupportedCodecVp8);
282 codecs.push_back(kCdmSupportedCodecVp9);
283 #if defined(USE_PROPRIETARY_CODECS)
284 codecs.push_back(kCdmSupportedCodecAac);
285 codecs.push_back(kCdmSupportedCodecAvc1);
286 #endif // defined(USE_PROPRIETARY_CODECS)
287 std::string codec_string =
288 JoinString(codecs, kCdmSupportedCodecsValueDelimiter);
289 widevine_cdm_mime_type.additional_param_names.push_back(
290 base::ASCIIToUTF16(kCdmSupportedCodecsParamName));
291 widevine_cdm_mime_type.additional_param_values.push_back(
292 base::ASCIIToUTF16(codec_string));
294 widevine_cdm.mime_types.push_back(widevine_cdm_mime_type);
295 widevine_cdm.permissions = kWidevineCdmPluginPermissions;
296 plugins->push_back(widevine_cdm);
298 skip_widevine_cdm_file_check = true;
301 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) &&
302 // !defined(WIDEVINE_CDM_IS_COMPONENT)
304 // The Remoting Viewer plugin is built-in.
305 #if defined(ENABLE_REMOTING)
306 content::PepperPluginInfo info;
307 info.is_internal = true;
308 info.is_out_of_process = true;
309 info.name = kRemotingViewerPluginName;
310 info.description = kRemotingViewerPluginDescription;
311 info.path = base::FilePath::FromUTF8Unsafe(
312 ChromeContentClient::kRemotingViewerPluginPath);
313 content::WebPluginMimeType remoting_mime_type(
314 kRemotingViewerPluginMimeType,
315 kRemotingViewerPluginMimeExtension,
316 kRemotingViewerPluginMimeDescription);
317 info.mime_types.push_back(remoting_mime_type);
318 info.internal_entry_points.get_interface = g_remoting_get_interface;
319 info.internal_entry_points.initialize_module = g_remoting_initialize_module;
320 info.internal_entry_points.shutdown_module = g_remoting_shutdown_module;
321 info.permissions = kRemotingViewerPluginPermissions;
323 plugins->push_back(info);
324 #endif
327 content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path,
328 const std::string& version) {
329 content::PepperPluginInfo plugin;
331 plugin.is_out_of_process = true;
332 plugin.name = content::kFlashPluginName;
333 plugin.path = path;
334 plugin.permissions = kPepperFlashPermissions;
336 std::vector<std::string> flash_version_numbers;
337 base::SplitString(version, '.', &flash_version_numbers);
338 if (flash_version_numbers.size() < 1)
339 flash_version_numbers.push_back("11");
340 // |SplitString()| puts in an empty string given an empty string. :(
341 else if (flash_version_numbers[0].empty())
342 flash_version_numbers[0] = "11";
343 if (flash_version_numbers.size() < 2)
344 flash_version_numbers.push_back("2");
345 if (flash_version_numbers.size() < 3)
346 flash_version_numbers.push_back("999");
347 if (flash_version_numbers.size() < 4)
348 flash_version_numbers.push_back("999");
349 // E.g., "Shockwave Flash 10.2 r154":
350 plugin.description = plugin.name + " " + flash_version_numbers[0] + "." +
351 flash_version_numbers[1] + " r" + flash_version_numbers[2];
352 plugin.version = JoinString(flash_version_numbers, '.');
353 content::WebPluginMimeType swf_mime_type(content::kFlashPluginSwfMimeType,
354 content::kFlashPluginSwfExtension,
355 content::kFlashPluginSwfDescription);
356 plugin.mime_types.push_back(swf_mime_type);
357 content::WebPluginMimeType spl_mime_type(content::kFlashPluginSplMimeType,
358 content::kFlashPluginSplExtension,
359 content::kFlashPluginSplDescription);
360 plugin.mime_types.push_back(spl_mime_type);
362 return plugin;
365 void AddPepperFlashFromCommandLine(
366 std::vector<content::PepperPluginInfo>* plugins) {
367 const base::CommandLine::StringType flash_path =
368 base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(
369 switches::kPpapiFlashPath);
370 if (flash_path.empty())
371 return;
373 // Also get the version from the command-line. Should be something like 11.2
374 // or 11.2.123.45.
375 std::string flash_version =
376 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
377 switches::kPpapiFlashVersion);
379 plugins->push_back(
380 CreatePepperFlashInfo(base::FilePath(flash_path), flash_version));
383 bool GetBundledPepperFlash(content::PepperPluginInfo* plugin) {
384 #if defined(FLAPPER_AVAILABLE)
385 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
387 // Ignore bundled Pepper Flash if there is Pepper Flash specified from the
388 // command-line.
389 if (command_line->HasSwitch(switches::kPpapiFlashPath))
390 return false;
392 bool force_disable =
393 command_line->HasSwitch(switches::kDisableBundledPpapiFlash);
394 if (force_disable)
395 return false;
397 base::FilePath flash_path;
398 if (!PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, &flash_path))
399 return false;
401 *plugin = CreatePepperFlashInfo(flash_path, FLAPPER_VERSION_STRING);
402 return true;
403 #else
404 return false;
405 #endif // FLAPPER_AVAILABLE
407 #endif // defined(ENABLE_PLUGINS)
409 std::string GetProduct() {
410 chrome::VersionInfo version_info;
411 return version_info.ProductNameAndVersionForUserAgent();
414 } // namespace
416 std::string GetUserAgent() {
417 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
418 if (command_line->HasSwitch(switches::kUserAgent)) {
419 std::string ua = command_line->GetSwitchValueASCII(switches::kUserAgent);
420 if (net::HttpUtil::IsValidHeaderValue(ua))
421 return ua;
422 LOG(WARNING) << "Ignored invalid value for flag --" << switches::kUserAgent;
425 std::string product = GetProduct();
426 #if defined(OS_ANDROID)
427 if (command_line->HasSwitch(switches::kUseMobileUserAgent))
428 product += " Mobile";
429 #endif
430 return content::BuildUserAgentFromProduct(product);
434 #if defined(ENABLE_REMOTING)
436 void ChromeContentClient::SetRemotingEntryFunctions(
437 content::PepperPluginInfo::GetInterfaceFunc get_interface,
438 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module,
439 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module) {
440 g_remoting_get_interface = get_interface;
441 g_remoting_initialize_module = initialize_module;
442 g_remoting_shutdown_module = shutdown_module;
444 #endif
446 #if !defined(DISABLE_NACL)
447 void ChromeContentClient::SetNaClEntryFunctions(
448 content::PepperPluginInfo::GetInterfaceFunc get_interface,
449 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module,
450 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module) {
451 g_nacl_get_interface = get_interface;
452 g_nacl_initialize_module = initialize_module;
453 g_nacl_shutdown_module = shutdown_module;
455 #endif
457 void ChromeContentClient::SetActiveURL(const GURL& url) {
458 base::debug::SetCrashKeyValue(crash_keys::kActiveURL,
459 url.possibly_invalid_spec());
462 void ChromeContentClient::SetGpuInfo(const gpu::GPUInfo& gpu_info) {
463 #if !defined(OS_ANDROID)
464 base::debug::SetCrashKeyValue(crash_keys::kGPUVendorID,
465 base::StringPrintf("0x%04x", gpu_info.gpu.vendor_id));
466 base::debug::SetCrashKeyValue(crash_keys::kGPUDeviceID,
467 base::StringPrintf("0x%04x", gpu_info.gpu.device_id));
468 #endif
469 base::debug::SetCrashKeyValue(crash_keys::kGPUDriverVersion,
470 gpu_info.driver_version);
471 base::debug::SetCrashKeyValue(crash_keys::kGPUPixelShaderVersion,
472 gpu_info.pixel_shader_version);
473 base::debug::SetCrashKeyValue(crash_keys::kGPUVertexShaderVersion,
474 gpu_info.vertex_shader_version);
475 #if defined(OS_MACOSX)
476 base::debug::SetCrashKeyValue(crash_keys::kGPUGLVersion, gpu_info.gl_version);
477 #elif defined(OS_POSIX)
478 base::debug::SetCrashKeyValue(crash_keys::kGPUVendor, gpu_info.gl_vendor);
479 base::debug::SetCrashKeyValue(crash_keys::kGPURenderer, gpu_info.gl_renderer);
480 #endif
483 void ChromeContentClient::AddPepperPlugins(
484 std::vector<content::PepperPluginInfo>* plugins) {
485 #if defined(ENABLE_PLUGINS)
486 ComputeBuiltInPlugins(plugins);
487 AddPepperFlashFromCommandLine(plugins);
489 content::PepperPluginInfo plugin;
490 if (GetBundledPepperFlash(&plugin))
491 plugins->push_back(plugin);
492 #endif
495 void ChromeContentClient::AddAdditionalSchemes(
496 std::vector<std::string>* standard_schemes,
497 std::vector<std::string>* savable_schemes) {
498 standard_schemes->push_back(extensions::kExtensionScheme);
499 savable_schemes->push_back(extensions::kExtensionScheme);
500 standard_schemes->push_back(chrome::kChromeNativeScheme);
501 standard_schemes->push_back(extensions::kExtensionResourceScheme);
502 savable_schemes->push_back(extensions::kExtensionResourceScheme);
503 standard_schemes->push_back(chrome::kChromeSearchScheme);
504 savable_schemes->push_back(chrome::kChromeSearchScheme);
505 standard_schemes->push_back(dom_distiller::kDomDistillerScheme);
506 savable_schemes->push_back(dom_distiller::kDomDistillerScheme);
507 #if defined(OS_CHROMEOS)
508 standard_schemes->push_back(chrome::kCrosScheme);
509 #endif
512 std::string ChromeContentClient::GetProduct() const {
513 return ::GetProduct();
516 std::string ChromeContentClient::GetUserAgent() const {
517 return ::GetUserAgent();
520 base::string16 ChromeContentClient::GetLocalizedString(int message_id) const {
521 return l10n_util::GetStringUTF16(message_id);
524 base::StringPiece ChromeContentClient::GetDataResource(
525 int resource_id,
526 ui::ScaleFactor scale_factor) const {
527 return ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(
528 resource_id, scale_factor);
531 base::RefCountedStaticMemory* ChromeContentClient::GetDataResourceBytes(
532 int resource_id) const {
533 return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id);
536 gfx::Image& ChromeContentClient::GetNativeImageNamed(int resource_id) const {
537 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id);
540 std::string ChromeContentClient::GetProcessTypeNameInEnglish(int type) {
541 #if !defined(DISABLE_NACL)
542 switch (type) {
543 case PROCESS_TYPE_NACL_LOADER:
544 return "Native Client module";
545 case PROCESS_TYPE_NACL_BROKER:
546 return "Native Client broker";
548 #endif
550 NOTREACHED() << "Unknown child process type!";
551 return "Unknown";
554 #if defined(OS_MACOSX) && !defined(OS_IOS)
555 bool ChromeContentClient::GetSandboxProfileForSandboxType(
556 int sandbox_type,
557 int* sandbox_profile_resource_id) const {
558 DCHECK(sandbox_profile_resource_id);
559 if (sandbox_type == NACL_SANDBOX_TYPE_NACL_LOADER) {
560 *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE;
561 return true;
563 return false;
565 #endif