Upstream version 11.40.277.0
[platform/framework/web/crosswalk.git] / src / chrome / common / chrome_content_client.cc
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.
4
5 #include "chrome/common/chrome_content_client.h"
6
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 "extensions/common/feature_switch.h"
33 #include "gpu/config/gpu_info.h"
34 #include "net/http/http_util.h"
35 #include "ui/base/l10n/l10n_util.h"
36 #include "ui/base/layout.h"
37 #include "ui/base/resource/resource_bundle.h"
38
39 #include "widevine_cdm_version.h"  // In SHARED_INTERMEDIATE_DIR.
40
41 #if defined(OS_WIN)
42 #include "base/win/registry.h"
43 #include "base/win/windows_version.h"
44 #elif defined(OS_MACOSX)
45 #include "components/nacl/common/nacl_sandbox_type_mac.h"
46 #endif
47
48 #if !defined(DISABLE_NACL)
49 #include "components/nacl/common/nacl_constants.h"
50 #include "components/nacl/common/nacl_process_type.h"
51 #include "ppapi/native_client/src/trusted/plugin/ppapi_entrypoints.h"
52 #endif
53
54 #if defined(ENABLE_PLUGINS)
55 #include "chrome/common/pepper_flash.h"
56 #include "content/public/common/pepper_plugin_info.h"
57 #include "flapper_version.h"  // In SHARED_INTERMEDIATE_DIR.
58 #include "ppapi/shared_impl/ppapi_permissions.h"
59 #endif
60
61 #if defined(ENABLE_REMOTING)
62 #include "remoting/client/plugin/pepper_entrypoints.h"
63 #endif
64
65 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \
66     !defined(WIDEVINE_CDM_IS_COMPONENT)
67 #include "chrome/common/widevine_cdm_constants.h"
68 #endif
69
70 namespace {
71
72 #if defined(ENABLE_PLUGINS)
73 const char kPDFPluginMimeType[] = "application/pdf";
74 const char kPDFPluginExtension[] = "pdf";
75 const char kPDFPluginDescription[] = "Portable Document Format";
76 const char kPDFPluginPrintPreviewMimeType[] =
77     "application/x-google-chrome-print-preview-pdf";
78 const char kPDFPluginOutOfProcessMimeType[] =
79     "application/x-google-chrome-pdf";
80 const uint32 kPDFPluginPermissions = ppapi::PERMISSION_PRIVATE |
81                                      ppapi::PERMISSION_DEV;
82
83 const char kO1DPluginName[] = "Google Talk Plugin Video Renderer";
84 const char kO1DPluginMimeType[] ="application/o1d";
85 const char kO1DPluginExtension[] = "";
86 const char kO1DPluginDescription[] = "Google Talk Plugin Video Renderer";
87 const uint32 kO1DPluginPermissions = ppapi::PERMISSION_PRIVATE |
88                                      ppapi::PERMISSION_DEV;
89
90 const char kEffectsPluginName[] = "Google Talk Effects Plugin";
91 const char kEffectsPluginMimeType[] ="application/x-ppapi-hangouts-effects";
92 const char kEffectsPluginExtension[] = "";
93 const char kEffectsPluginDescription[] = "Google Talk Effects Plugin";
94 const uint32 kEffectsPluginPermissions = ppapi::PERMISSION_PRIVATE |
95                                          ppapi::PERMISSION_DEV;
96
97 const char kGTalkPluginName[] = "Google Talk Plugin";
98 const char kGTalkPluginMimeType[] ="application/googletalk";
99 const char kGTalkPluginExtension[] = ".googletalk";
100 const char kGTalkPluginDescription[] = "Google Talk Plugin";
101 const uint32 kGTalkPluginPermissions = ppapi::PERMISSION_PRIVATE |
102                                        ppapi::PERMISSION_DEV;
103
104 #if defined(ENABLE_REMOTING)
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)
123
124 // Appends the known built-in plugins to the given vector. Some built-in
125 // plugins are "internal" which means they are compiled into the Chrome binary,
126 // and some are extra shared libraries distributed with the browser (these are
127 // not marked internal, aside from being automatically registered, they're just
128 // regular plugins).
129 void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) {
130   // PDF.
131   //
132   // Once we're sandboxed, we can't know if the PDF plugin is available or not;
133   // but (on Linux) this function is always called once before we're sandboxed.
134   // So the first time through test if the file is available and then skip the
135   // check on subsequent calls if yes.
136   static bool skip_pdf_file_check = false;
137   base::FilePath path;
138   if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) {
139     if (skip_pdf_file_check || base::PathExists(path)) {
140       content::PepperPluginInfo pdf;
141       pdf.path = path;
142       pdf.name = ChromeContentClient::kPDFPluginName;
143       if (CommandLine::ForCurrentProcess()->HasSwitch(
144               switches::kOutOfProcessPdf)) {
145         // Always enable the MIME handler view flag for OOP PDF.
146         extensions::FeatureSwitch::mime_handler_view()->SetOverrideValue(
147             extensions::FeatureSwitch::OVERRIDE_ENABLED);
148         pdf.is_out_of_process = true;
149         content::WebPluginMimeType pdf_mime_type(kPDFPluginOutOfProcessMimeType,
150                                                  kPDFPluginExtension,
151                                                  kPDFPluginDescription);
152         pdf.mime_types.push_back(pdf_mime_type);
153         // TODO(raymes): Make print preview work with out of process PDF.
154       } else {
155         content::WebPluginMimeType pdf_mime_type(kPDFPluginMimeType,
156                                                  kPDFPluginExtension,
157                                                  kPDFPluginDescription);
158         content::WebPluginMimeType print_preview_pdf_mime_type(
159             kPDFPluginPrintPreviewMimeType,
160             kPDFPluginExtension,
161             kPDFPluginDescription);
162         pdf.mime_types.push_back(pdf_mime_type);
163         pdf.mime_types.push_back(print_preview_pdf_mime_type);
164       }
165       pdf.permissions = kPDFPluginPermissions;
166       plugins->push_back(pdf);
167
168       skip_pdf_file_check = true;
169     }
170   }
171
172 #if !defined(DISABLE_NACL)
173   // Handle Native Client just like the PDF plugin. This means that it is
174   // enabled by default for the non-portable case.  This allows apps installed
175   // from the Chrome Web Store to use NaCl even if the command line switch
176   // isn't set.  For other uses of NaCl we check for the command line switch.
177   if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) {
178     content::PepperPluginInfo nacl;
179     // The nacl plugin is now built into the Chromium binary.
180     nacl.is_internal = true;
181     nacl.path = path;
182     nacl.name = nacl::kNaClPluginName;
183     content::WebPluginMimeType nacl_mime_type(nacl::kNaClPluginMimeType,
184                                               nacl::kNaClPluginExtension,
185                                               nacl::kNaClPluginDescription);
186     nacl.mime_types.push_back(nacl_mime_type);
187     content::WebPluginMimeType pnacl_mime_type(nacl::kPnaclPluginMimeType,
188                                                nacl::kPnaclPluginExtension,
189                                                nacl::kPnaclPluginDescription);
190     nacl.mime_types.push_back(pnacl_mime_type);
191     nacl.internal_entry_points.get_interface = nacl_plugin::PPP_GetInterface;
192     nacl.internal_entry_points.initialize_module =
193         nacl_plugin::PPP_InitializeModule;
194     nacl.internal_entry_points.shutdown_module =
195         nacl_plugin::PPP_ShutdownModule;
196     nacl.permissions = ppapi::PERMISSION_PRIVATE | ppapi::PERMISSION_DEV;
197     plugins->push_back(nacl);
198   }
199 #endif  // !defined(DISABLE_NACL)
200
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);
215
216       skip_o1d_file_check = true;
217     }
218   }
219
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);
236
237       skip_effects_file_check = true;
238     }
239   }
240
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);
255
256       skip_gtalk_file_check = true;
257     }
258   }
259
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);
277
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 // TODO(ddorwin): Rename these macros to reflect their real meaning: whether the
285 // CDM Chrome was built [and shipped] with support these types.
286 #if defined(WIDEVINE_CDM_AAC_SUPPORT_AVAILABLE)
287       codecs.push_back(kCdmSupportedCodecAac);
288 #endif
289 #if defined(WIDEVINE_CDM_AVC1_SUPPORT_AVAILABLE)
290       codecs.push_back(kCdmSupportedCodecAvc1);
291 #endif
292 #endif  // defined(USE_PROPRIETARY_CODECS)
293       std::string codec_string =
294           JoinString(codecs, kCdmSupportedCodecsValueDelimiter);
295       widevine_cdm_mime_type.additional_param_names.push_back(
296           base::ASCIIToUTF16(kCdmSupportedCodecsParamName));
297       widevine_cdm_mime_type.additional_param_values.push_back(
298           base::ASCIIToUTF16(codec_string));
299
300       widevine_cdm.mime_types.push_back(widevine_cdm_mime_type);
301       widevine_cdm.permissions = kWidevineCdmPluginPermissions;
302       plugins->push_back(widevine_cdm);
303
304       skip_widevine_cdm_file_check = true;
305     }
306   }
307 #endif  // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) &&
308         // !defined(WIDEVINE_CDM_IS_COMPONENT)
309
310   // The Remoting Viewer plugin is built-in.
311 #if defined(ENABLE_REMOTING)
312   content::PepperPluginInfo info;
313   info.is_internal = true;
314   info.is_out_of_process = true;
315   info.name = kRemotingViewerPluginName;
316   info.description = kRemotingViewerPluginDescription;
317   info.path = base::FilePath::FromUTF8Unsafe(
318       ChromeContentClient::kRemotingViewerPluginPath);
319   content::WebPluginMimeType remoting_mime_type(
320       kRemotingViewerPluginMimeType,
321       kRemotingViewerPluginMimeExtension,
322       kRemotingViewerPluginMimeDescription);
323   info.mime_types.push_back(remoting_mime_type);
324   info.internal_entry_points.get_interface = remoting::PPP_GetInterface;
325   info.internal_entry_points.initialize_module =
326       remoting::PPP_InitializeModule;
327   info.internal_entry_points.shutdown_module = remoting::PPP_ShutdownModule;
328   info.permissions = kRemotingViewerPluginPermissions;
329
330   plugins->push_back(info);
331 #endif
332 }
333
334 content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path,
335                                                 const std::string& version) {
336   content::PepperPluginInfo plugin;
337
338   plugin.is_out_of_process = true;
339   plugin.name = content::kFlashPluginName;
340   plugin.path = path;
341   plugin.permissions = kPepperFlashPermissions;
342
343   std::vector<std::string> flash_version_numbers;
344   base::SplitString(version, '.', &flash_version_numbers);
345   if (flash_version_numbers.size() < 1)
346     flash_version_numbers.push_back("11");
347   // |SplitString()| puts in an empty string given an empty string. :(
348   else if (flash_version_numbers[0].empty())
349     flash_version_numbers[0] = "11";
350   if (flash_version_numbers.size() < 2)
351     flash_version_numbers.push_back("2");
352   if (flash_version_numbers.size() < 3)
353     flash_version_numbers.push_back("999");
354   if (flash_version_numbers.size() < 4)
355     flash_version_numbers.push_back("999");
356   // E.g., "Shockwave Flash 10.2 r154":
357   plugin.description = plugin.name + " " + flash_version_numbers[0] + "." +
358       flash_version_numbers[1] + " r" + flash_version_numbers[2];
359   plugin.version = JoinString(flash_version_numbers, '.');
360   content::WebPluginMimeType swf_mime_type(content::kFlashPluginSwfMimeType,
361                                            content::kFlashPluginSwfExtension,
362                                            content::kFlashPluginSwfDescription);
363   plugin.mime_types.push_back(swf_mime_type);
364   content::WebPluginMimeType spl_mime_type(content::kFlashPluginSplMimeType,
365                                            content::kFlashPluginSplExtension,
366                                            content::kFlashPluginSplDescription);
367   plugin.mime_types.push_back(spl_mime_type);
368
369   return plugin;
370 }
371
372 void AddPepperFlashFromCommandLine(
373     std::vector<content::PepperPluginInfo>* plugins) {
374   const CommandLine::StringType flash_path =
375       CommandLine::ForCurrentProcess()->GetSwitchValueNative(
376           switches::kPpapiFlashPath);
377   if (flash_path.empty())
378     return;
379
380   // Also get the version from the command-line. Should be something like 11.2
381   // or 11.2.123.45.
382   std::string flash_version =
383       CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
384           switches::kPpapiFlashVersion);
385
386   plugins->push_back(
387       CreatePepperFlashInfo(base::FilePath(flash_path), flash_version));
388 }
389
390 bool GetBundledPepperFlash(content::PepperPluginInfo* plugin) {
391 #if defined(FLAPPER_AVAILABLE)
392   CommandLine* command_line = CommandLine::ForCurrentProcess();
393
394   // Ignore bundled Pepper Flash if there is Pepper Flash specified from the
395   // command-line.
396   if (command_line->HasSwitch(switches::kPpapiFlashPath))
397     return false;
398
399   bool force_disable =
400       command_line->HasSwitch(switches::kDisableBundledPpapiFlash);
401   if (force_disable)
402     return false;
403
404   base::FilePath flash_path;
405   if (!PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, &flash_path))
406     return false;
407
408   *plugin = CreatePepperFlashInfo(flash_path, FLAPPER_VERSION_STRING);
409   return true;
410 #else
411   return false;
412 #endif  // FLAPPER_AVAILABLE
413 }
414 #endif  // defined(ENABLE_PLUGINS)
415
416 std::string GetProduct() {
417   chrome::VersionInfo version_info;
418   return version_info.ProductNameAndVersionForUserAgent();
419 }
420
421 }  // namespace
422
423 std::string GetUserAgent() {
424   CommandLine* command_line = CommandLine::ForCurrentProcess();
425   if (command_line->HasSwitch(switches::kUserAgent)) {
426     std::string ua = command_line->GetSwitchValueASCII(switches::kUserAgent);
427     if (net::HttpUtil::IsValidHeaderValue(ua))
428       return ua;
429     LOG(WARNING) << "Ignored invalid value for flag --" << switches::kUserAgent;
430   }
431
432   std::string product = GetProduct();
433 #if defined(OS_ANDROID)
434   if (command_line->HasSwitch(switches::kUseMobileUserAgent))
435     product += " Mobile";
436 #endif
437   return content::BuildUserAgentFromProduct(product);
438 }
439
440 void ChromeContentClient::SetActiveURL(const GURL& url) {
441   base::debug::SetCrashKeyValue(crash_keys::kActiveURL,
442                                 url.possibly_invalid_spec());
443 }
444
445 void ChromeContentClient::SetGpuInfo(const gpu::GPUInfo& gpu_info) {
446 #if !defined(OS_ANDROID)
447   base::debug::SetCrashKeyValue(crash_keys::kGPUVendorID,
448       base::StringPrintf("0x%04x", gpu_info.gpu.vendor_id));
449   base::debug::SetCrashKeyValue(crash_keys::kGPUDeviceID,
450       base::StringPrintf("0x%04x", gpu_info.gpu.device_id));
451 #endif
452   base::debug::SetCrashKeyValue(crash_keys::kGPUDriverVersion,
453       gpu_info.driver_version);
454   base::debug::SetCrashKeyValue(crash_keys::kGPUPixelShaderVersion,
455       gpu_info.pixel_shader_version);
456   base::debug::SetCrashKeyValue(crash_keys::kGPUVertexShaderVersion,
457       gpu_info.vertex_shader_version);
458 #if defined(OS_MACOSX)
459   base::debug::SetCrashKeyValue(crash_keys::kGPUGLVersion, gpu_info.gl_version);
460 #elif defined(OS_POSIX)
461   base::debug::SetCrashKeyValue(crash_keys::kGPUVendor, gpu_info.gl_vendor);
462   base::debug::SetCrashKeyValue(crash_keys::kGPURenderer, gpu_info.gl_renderer);
463 #endif
464 }
465
466 void ChromeContentClient::AddPepperPlugins(
467     std::vector<content::PepperPluginInfo>* plugins) {
468 #if defined(ENABLE_PLUGINS)
469   ComputeBuiltInPlugins(plugins);
470   AddPepperFlashFromCommandLine(plugins);
471
472   content::PepperPluginInfo plugin;
473   if (GetBundledPepperFlash(&plugin))
474     plugins->push_back(plugin);
475 #endif
476 }
477
478 void ChromeContentClient::AddAdditionalSchemes(
479     std::vector<std::string>* standard_schemes,
480     std::vector<std::string>* savable_schemes) {
481   standard_schemes->push_back(extensions::kExtensionScheme);
482   savable_schemes->push_back(extensions::kExtensionScheme);
483   standard_schemes->push_back(chrome::kChromeNativeScheme);
484   standard_schemes->push_back(extensions::kExtensionResourceScheme);
485   savable_schemes->push_back(extensions::kExtensionResourceScheme);
486   standard_schemes->push_back(chrome::kChromeSearchScheme);
487   savable_schemes->push_back(chrome::kChromeSearchScheme);
488   standard_schemes->push_back(dom_distiller::kDomDistillerScheme);
489   savable_schemes->push_back(dom_distiller::kDomDistillerScheme);
490 #if defined(OS_CHROMEOS)
491   standard_schemes->push_back(chrome::kCrosScheme);
492 #endif
493 }
494
495 std::string ChromeContentClient::GetProduct() const {
496   return ::GetProduct();
497 }
498
499 std::string ChromeContentClient::GetUserAgent() const {
500   return ::GetUserAgent();
501 }
502
503 base::string16 ChromeContentClient::GetLocalizedString(int message_id) const {
504   return l10n_util::GetStringUTF16(message_id);
505 }
506
507 base::StringPiece ChromeContentClient::GetDataResource(
508     int resource_id,
509     ui::ScaleFactor scale_factor) const {
510   return ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(
511       resource_id, scale_factor);
512 }
513
514 base::RefCountedStaticMemory* ChromeContentClient::GetDataResourceBytes(
515     int resource_id) const {
516   return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id);
517 }
518
519 gfx::Image& ChromeContentClient::GetNativeImageNamed(int resource_id) const {
520   return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id);
521 }
522
523 std::string ChromeContentClient::GetProcessTypeNameInEnglish(int type) {
524 #if !defined(DISABLE_NACL)
525   switch (type) {
526     case PROCESS_TYPE_NACL_LOADER:
527       return "Native Client module";
528     case PROCESS_TYPE_NACL_BROKER:
529       return "Native Client broker";
530   }
531 #endif
532
533   NOTREACHED() << "Unknown child process type!";
534   return "Unknown";
535 }
536
537 #if defined(OS_MACOSX) && !defined(OS_IOS)
538 bool ChromeContentClient::GetSandboxProfileForSandboxType(
539     int sandbox_type,
540     int* sandbox_profile_resource_id) const {
541   DCHECK(sandbox_profile_resource_id);
542   if (sandbox_type == NACL_SANDBOX_TYPE_NACL_LOADER) {
543     *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE;
544     return true;
545   }
546   return false;
547 }
548 #endif