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/secure_origin_whitelist.h"
28 #include "chrome/common/url_constants.h"
29 #include "chrome/grit/common_resources.h"
30 #include "components/dom_distiller/core/url_constants.h"
31 #include "content/public/common/content_constants.h"
32 #include "content/public/common/content_switches.h"
33 #include "content/public/common/url_constants.h"
34 #include "content/public/common/user_agent.h"
35 #include "extensions/common/constants.h"
36 #include "gpu/config/gpu_info.h"
37 #include "net/http/http_util.h"
38 #include "ui/base/l10n/l10n_util.h"
39 #include "ui/base/layout.h"
40 #include "ui/base/resource/resource_bundle.h"
42 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
45 #include "base/win/registry.h"
46 #include "base/win/windows_version.h"
49 #if !defined(DISABLE_NACL)
50 #include "components/nacl/common/nacl_constants.h"
51 #include "components/nacl/common/nacl_process_type.h"
52 #include "components/nacl/common/nacl_sandbox_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 content::PepperPluginInfo::GetInterfaceFunc g_pdf_get_interface
;
78 content::PepperPluginInfo::PPP_InitializeModuleFunc g_pdf_initialize_module
;
79 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_pdf_shutdown_module
;
81 #if defined(ENABLE_REMOTING)
83 content::PepperPluginInfo::GetInterfaceFunc g_remoting_get_interface
;
84 content::PepperPluginInfo::PPP_InitializeModuleFunc
85 g_remoting_initialize_module
;
86 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_remoting_shutdown_module
;
88 #if defined(GOOGLE_CHROME_BUILD)
89 const char kRemotingViewerPluginName
[] = "Chrome Remote Desktop Viewer";
91 const char kRemotingViewerPluginName
[] = "Chromoting Viewer";
92 #endif // defined(GOOGLE_CHROME_BUILD)
93 const char kRemotingViewerPluginDescription
[] =
94 "This plugin allows you to securely access other computers that have been "
95 "shared with you. To use this plugin you must first install the "
96 "<a href=\"https://chrome.google.com/remotedesktop\">"
97 "Chrome Remote Desktop</a> webapp.";
98 // Use a consistent MIME-type regardless of branding.
99 const char kRemotingViewerPluginMimeType
[] =
100 "application/vnd.chromium.remoting-viewer";
101 const char kRemotingViewerPluginMimeExtension
[] = "";
102 const char kRemotingViewerPluginMimeDescription
[] = "";
103 const uint32 kRemotingViewerPluginPermissions
= ppapi::PERMISSION_PRIVATE
|
104 ppapi::PERMISSION_DEV
;
105 #endif // defined(ENABLE_REMOTING)
107 #if !defined(DISABLE_NACL)
108 content::PepperPluginInfo::GetInterfaceFunc g_nacl_get_interface
;
109 content::PepperPluginInfo::PPP_InitializeModuleFunc g_nacl_initialize_module
;
110 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_nacl_shutdown_module
;
113 // Appends the known built-in plugins to the given vector. Some built-in
114 // plugins are "internal" which means they are compiled into the Chrome binary,
115 // and some are extra shared libraries distributed with the browser (these are
116 // not marked internal, aside from being automatically registered, they're just
118 void ComputeBuiltInPlugins(std::vector
<content::PepperPluginInfo
>* plugins
) {
119 content::PepperPluginInfo pdf_info
;
120 pdf_info
.is_internal
= true;
121 pdf_info
.is_out_of_process
= true;
122 pdf_info
.name
= ChromeContentClient::kPDFPluginName
;
123 pdf_info
.description
= kPDFPluginDescription
;
124 pdf_info
.path
= base::FilePath::FromUTF8Unsafe(
125 ChromeContentClient::kPDFPluginPath
);
126 content::WebPluginMimeType
pdf_mime_type(
127 kPDFPluginOutOfProcessMimeType
,
129 kPDFPluginDescription
);
130 pdf_info
.mime_types
.push_back(pdf_mime_type
);
131 pdf_info
.internal_entry_points
.get_interface
= g_pdf_get_interface
;
132 pdf_info
.internal_entry_points
.initialize_module
= g_pdf_initialize_module
;
133 pdf_info
.internal_entry_points
.shutdown_module
= g_pdf_shutdown_module
;
134 pdf_info
.permissions
= kPDFPluginPermissions
;
135 plugins
->push_back(pdf_info
);
139 #if !defined(DISABLE_NACL)
140 // Handle Native Client just like the PDF plugin. This means that it is
141 // enabled by default for the non-portable case. This allows apps installed
142 // from the Chrome Web Store to use NaCl even if the command line switch
143 // isn't set. For other uses of NaCl we check for the command line switch.
144 if (PathService::Get(chrome::FILE_NACL_PLUGIN
, &path
)) {
145 content::PepperPluginInfo nacl
;
146 // The nacl plugin is now built into the Chromium binary.
147 nacl
.is_internal
= true;
149 nacl
.name
= nacl::kNaClPluginName
;
150 content::WebPluginMimeType
nacl_mime_type(nacl::kNaClPluginMimeType
,
151 nacl::kNaClPluginExtension
,
152 nacl::kNaClPluginDescription
);
153 nacl
.mime_types
.push_back(nacl_mime_type
);
154 content::WebPluginMimeType
pnacl_mime_type(nacl::kPnaclPluginMimeType
,
155 nacl::kPnaclPluginExtension
,
156 nacl::kPnaclPluginDescription
);
157 nacl
.mime_types
.push_back(pnacl_mime_type
);
158 nacl
.internal_entry_points
.get_interface
= g_nacl_get_interface
;
159 nacl
.internal_entry_points
.initialize_module
= g_nacl_initialize_module
;
160 nacl
.internal_entry_points
.shutdown_module
= g_nacl_shutdown_module
;
161 nacl
.permissions
= ppapi::PERMISSION_PRIVATE
| ppapi::PERMISSION_DEV
;
162 plugins
->push_back(nacl
);
164 #endif // !defined(DISABLE_NACL)
166 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \
167 !defined(WIDEVINE_CDM_IS_COMPONENT)
168 static bool skip_widevine_cdm_file_check
= false;
169 if (PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER
, &path
)) {
170 if (skip_widevine_cdm_file_check
|| base::PathExists(path
)) {
171 content::PepperPluginInfo widevine_cdm
;
172 widevine_cdm
.is_out_of_process
= true;
173 widevine_cdm
.path
= path
;
174 widevine_cdm
.name
= kWidevineCdmDisplayName
;
175 widevine_cdm
.description
= kWidevineCdmDescription
+
176 std::string(" (version: ") +
177 WIDEVINE_CDM_VERSION_STRING
+ ")";
178 widevine_cdm
.version
= WIDEVINE_CDM_VERSION_STRING
;
179 content::WebPluginMimeType
widevine_cdm_mime_type(
180 kWidevineCdmPluginMimeType
,
181 kWidevineCdmPluginExtension
,
182 kWidevineCdmPluginMimeTypeDescription
);
184 // Add the supported codecs as if they came from the component manifest.
185 std::vector
<std::string
> codecs
;
186 codecs
.push_back(kCdmSupportedCodecVorbis
);
187 codecs
.push_back(kCdmSupportedCodecVp8
);
188 codecs
.push_back(kCdmSupportedCodecVp9
);
189 #if defined(USE_PROPRIETARY_CODECS)
190 codecs
.push_back(kCdmSupportedCodecAac
);
191 codecs
.push_back(kCdmSupportedCodecAvc1
);
192 #endif // defined(USE_PROPRIETARY_CODECS)
193 std::string codec_string
= base::JoinString(
194 codecs
, std::string(1, kCdmSupportedCodecsValueDelimiter
));
195 widevine_cdm_mime_type
.additional_param_names
.push_back(
196 base::ASCIIToUTF16(kCdmSupportedCodecsParamName
));
197 widevine_cdm_mime_type
.additional_param_values
.push_back(
198 base::ASCIIToUTF16(codec_string
));
200 widevine_cdm
.mime_types
.push_back(widevine_cdm_mime_type
);
201 widevine_cdm
.permissions
= kWidevineCdmPluginPermissions
;
202 plugins
->push_back(widevine_cdm
);
204 skip_widevine_cdm_file_check
= true;
207 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) &&
208 // !defined(WIDEVINE_CDM_IS_COMPONENT)
210 // The Remoting Viewer plugin is built-in.
211 #if defined(ENABLE_REMOTING)
212 content::PepperPluginInfo info
;
213 info
.is_internal
= true;
214 info
.is_out_of_process
= true;
215 info
.name
= kRemotingViewerPluginName
;
216 info
.description
= kRemotingViewerPluginDescription
;
217 info
.path
= base::FilePath::FromUTF8Unsafe(
218 ChromeContentClient::kRemotingViewerPluginPath
);
219 content::WebPluginMimeType
remoting_mime_type(
220 kRemotingViewerPluginMimeType
,
221 kRemotingViewerPluginMimeExtension
,
222 kRemotingViewerPluginMimeDescription
);
223 info
.mime_types
.push_back(remoting_mime_type
);
224 info
.internal_entry_points
.get_interface
= g_remoting_get_interface
;
225 info
.internal_entry_points
.initialize_module
= g_remoting_initialize_module
;
226 info
.internal_entry_points
.shutdown_module
= g_remoting_shutdown_module
;
227 info
.permissions
= kRemotingViewerPluginPermissions
;
229 plugins
->push_back(info
);
233 content::PepperPluginInfo
CreatePepperFlashInfo(const base::FilePath
& path
,
234 const std::string
& version
) {
235 content::PepperPluginInfo plugin
;
237 plugin
.is_out_of_process
= true;
238 plugin
.name
= content::kFlashPluginName
;
240 plugin
.permissions
= chrome::kPepperFlashPermissions
;
242 std::vector
<std::string
> flash_version_numbers
= base::SplitString(
243 version
, ".", base::TRIM_WHITESPACE
, base::SPLIT_WANT_NONEMPTY
);
244 if (flash_version_numbers
.size() < 1)
245 flash_version_numbers
.push_back("11");
246 if (flash_version_numbers
.size() < 2)
247 flash_version_numbers
.push_back("2");
248 if (flash_version_numbers
.size() < 3)
249 flash_version_numbers
.push_back("999");
250 if (flash_version_numbers
.size() < 4)
251 flash_version_numbers
.push_back("999");
252 // E.g., "Shockwave Flash 10.2 r154":
253 plugin
.description
= plugin
.name
+ " " + flash_version_numbers
[0] + "." +
254 flash_version_numbers
[1] + " r" + flash_version_numbers
[2];
255 plugin
.version
= base::JoinString(flash_version_numbers
, ".");
256 content::WebPluginMimeType
swf_mime_type(content::kFlashPluginSwfMimeType
,
257 content::kFlashPluginSwfExtension
,
258 content::kFlashPluginSwfDescription
);
259 plugin
.mime_types
.push_back(swf_mime_type
);
260 content::WebPluginMimeType
spl_mime_type(content::kFlashPluginSplMimeType
,
261 content::kFlashPluginSplExtension
,
262 content::kFlashPluginSplDescription
);
263 plugin
.mime_types
.push_back(spl_mime_type
);
268 void AddPepperFlashFromCommandLine(
269 std::vector
<content::PepperPluginInfo
>* plugins
) {
270 const base::CommandLine::StringType flash_path
=
271 base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(
272 switches::kPpapiFlashPath
);
273 if (flash_path
.empty())
276 // Also get the version from the command-line. Should be something like 11.2
278 std::string flash_version
=
279 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
280 switches::kPpapiFlashVersion
);
283 CreatePepperFlashInfo(base::FilePath(flash_path
), flash_version
));
286 bool GetBundledPepperFlash(content::PepperPluginInfo
* plugin
) {
287 #if defined(FLAPPER_AVAILABLE)
288 base::CommandLine
* command_line
= base::CommandLine::ForCurrentProcess();
290 // Ignore bundled Pepper Flash if there is Pepper Flash specified from the
292 if (command_line
->HasSwitch(switches::kPpapiFlashPath
))
296 command_line
->HasSwitch(switches::kDisableBundledPpapiFlash
);
300 base::FilePath flash_path
;
301 if (!PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN
, &flash_path
))
304 *plugin
= CreatePepperFlashInfo(flash_path
, FLAPPER_VERSION_STRING
);
308 #endif // FLAPPER_AVAILABLE
312 const char kPepperFlashDLLBaseName
[] =
313 #if defined(ARCH_CPU_X86)
315 #elif defined(ARCH_CPU_X86_64)
318 #error Unsupported Windows CPU architecture.
319 #endif // defined(ARCH_CPU_X86)
320 #endif // defined(OS_WIN)
322 #if defined(FLAPPER_AVAILABLE)
323 bool IsSystemFlashScriptDebuggerPresent() {
325 const wchar_t kFlashRegistryRoot
[] =
326 L
"SOFTWARE\\Macromedia\\FlashPlayerPepper";
327 const wchar_t kIsDebuggerValueName
[] = L
"isScriptDebugger";
329 base::win::RegKey
path_key(HKEY_LOCAL_MACHINE
, kFlashRegistryRoot
, KEY_READ
);
331 if (FAILED(path_key
.ReadValueDW(kIsDebuggerValueName
, &debug_value
)))
334 return (debug_value
== 1);
336 // TODO(wfh): implement this on OS X and Linux. crbug.com/497996.
342 bool GetSystemPepperFlash(content::PepperPluginInfo
* plugin
) {
343 base::CommandLine
* command_line
= base::CommandLine::ForCurrentProcess();
345 #if defined(FLAPPER_AVAILABLE)
346 // If flapper is available, only try the system plugin if either:
347 // --disable-bundled-ppapi-flash is specified, or the system debugger is the
348 // Flash Script Debugger.
349 if (!command_line
->HasSwitch(switches::kDisableBundledPpapiFlash
) &&
350 !IsSystemFlashScriptDebuggerPresent())
352 #endif // defined(FLAPPER_AVAILABLE)
354 // Do not try and find System Pepper Flash if there is a specific path on
355 // the commmand-line.
356 if (command_line
->HasSwitch(switches::kPpapiFlashPath
))
359 base::FilePath flash_path
;
360 if (!PathService::Get(chrome::DIR_PEPPER_FLASH_SYSTEM_PLUGIN
, &flash_path
))
363 if (!base::PathExists(flash_path
))
366 base::FilePath
manifest_path(flash_path
.AppendASCII("manifest.json"));
368 std::string manifest_data
;
369 if (!base::ReadFileToString(manifest_path
, &manifest_data
))
371 scoped_ptr
<base::Value
> manifest_value(
372 base::JSONReader::Read(manifest_data
, base::JSON_ALLOW_TRAILING_COMMAS
));
373 if (!manifest_value
.get())
375 base::DictionaryValue
* manifest
= NULL
;
376 if (!manifest_value
->GetAsDictionary(&manifest
))
380 if (!chrome::CheckPepperFlashManifest(*manifest
, &version
))
384 // PepperFlash DLLs on Windows look like basename_v_x_y_z.dll.
385 std::string
filename(kPepperFlashDLLBaseName
);
386 filename
.append(version
.GetString());
387 base::ReplaceChars(filename
, ".", "_", &filename
);
388 filename
.append(".dll");
390 base::FilePath
path(flash_path
.Append(base::ASCIIToUTF16(filename
)));
392 // PepperFlash on OS X is called PepperFlashPlayer.plugin
393 base::FilePath
path(flash_path
.Append(chrome::kPepperFlashPluginFilename
));
396 if (!base::PathExists(path
))
399 *plugin
= CreatePepperFlashInfo(path
, version
.GetString());
402 #endif // defined(ENABLE_PLUGINS)
404 std::string
GetProduct() {
405 chrome::VersionInfo version_info
;
406 return version_info
.ProductNameAndVersionForUserAgent();
411 std::string
GetUserAgent() {
412 base::CommandLine
* command_line
= base::CommandLine::ForCurrentProcess();
413 if (command_line
->HasSwitch(switches::kUserAgent
)) {
414 std::string ua
= command_line
->GetSwitchValueASCII(switches::kUserAgent
);
415 if (net::HttpUtil::IsValidHeaderValue(ua
))
417 LOG(WARNING
) << "Ignored invalid value for flag --" << switches::kUserAgent
;
420 std::string product
= GetProduct();
421 #if defined(OS_ANDROID)
422 if (command_line
->HasSwitch(switches::kUseMobileUserAgent
))
423 product
+= " Mobile";
425 return content::BuildUserAgentFromProduct(product
);
429 #if defined(ENABLE_REMOTING)
431 void ChromeContentClient::SetRemotingEntryFunctions(
432 content::PepperPluginInfo::GetInterfaceFunc get_interface
,
433 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module
,
434 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module
) {
435 g_remoting_get_interface
= get_interface
;
436 g_remoting_initialize_module
= initialize_module
;
437 g_remoting_shutdown_module
= shutdown_module
;
441 #if !defined(DISABLE_NACL)
442 void ChromeContentClient::SetNaClEntryFunctions(
443 content::PepperPluginInfo::GetInterfaceFunc get_interface
,
444 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module
,
445 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module
) {
446 g_nacl_get_interface
= get_interface
;
447 g_nacl_initialize_module
= initialize_module
;
448 g_nacl_shutdown_module
= shutdown_module
;
452 #if defined(ENABLE_PLUGINS)
453 void ChromeContentClient::SetPDFEntryFunctions(
454 content::PepperPluginInfo::GetInterfaceFunc get_interface
,
455 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module
,
456 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module
) {
457 g_pdf_get_interface
= get_interface
;
458 g_pdf_initialize_module
= initialize_module
;
459 g_pdf_shutdown_module
= shutdown_module
;
463 void ChromeContentClient::SetActiveURL(const GURL
& url
) {
464 base::debug::SetCrashKeyValue(crash_keys::kActiveURL
,
465 url
.possibly_invalid_spec());
468 void ChromeContentClient::SetGpuInfo(const gpu::GPUInfo
& gpu_info
) {
469 #if !defined(OS_ANDROID)
470 base::debug::SetCrashKeyValue(crash_keys::kGPUVendorID
,
471 base::StringPrintf("0x%04x", gpu_info
.gpu
.vendor_id
));
472 base::debug::SetCrashKeyValue(crash_keys::kGPUDeviceID
,
473 base::StringPrintf("0x%04x", gpu_info
.gpu
.device_id
));
475 base::debug::SetCrashKeyValue(crash_keys::kGPUDriverVersion
,
476 gpu_info
.driver_version
);
477 base::debug::SetCrashKeyValue(crash_keys::kGPUPixelShaderVersion
,
478 gpu_info
.pixel_shader_version
);
479 base::debug::SetCrashKeyValue(crash_keys::kGPUVertexShaderVersion
,
480 gpu_info
.vertex_shader_version
);
481 #if defined(OS_MACOSX)
482 base::debug::SetCrashKeyValue(crash_keys::kGPUGLVersion
, gpu_info
.gl_version
);
483 #elif defined(OS_POSIX)
484 base::debug::SetCrashKeyValue(crash_keys::kGPUVendor
, gpu_info
.gl_vendor
);
485 base::debug::SetCrashKeyValue(crash_keys::kGPURenderer
, gpu_info
.gl_renderer
);
489 void ChromeContentClient::AddPepperPlugins(
490 std::vector
<content::PepperPluginInfo
>* plugins
) {
491 #if defined(ENABLE_PLUGINS)
492 ComputeBuiltInPlugins(plugins
);
493 AddPepperFlashFromCommandLine(plugins
);
495 content::PepperPluginInfo plugin
;
496 if (GetBundledPepperFlash(&plugin
))
497 plugins
->push_back(plugin
);
498 if (GetSystemPepperFlash(&plugin
))
499 plugins
->push_back(plugin
);
503 void ChromeContentClient::AddAdditionalSchemes(
504 std::vector
<std::string
>* standard_schemes
,
505 std::vector
<std::string
>* savable_schemes
) {
506 standard_schemes
->push_back(extensions::kExtensionScheme
);
507 savable_schemes
->push_back(extensions::kExtensionScheme
);
508 standard_schemes
->push_back(chrome::kChromeNativeScheme
);
509 standard_schemes
->push_back(extensions::kExtensionResourceScheme
);
510 savable_schemes
->push_back(extensions::kExtensionResourceScheme
);
511 standard_schemes
->push_back(chrome::kChromeSearchScheme
);
512 savable_schemes
->push_back(chrome::kChromeSearchScheme
);
513 standard_schemes
->push_back(dom_distiller::kDomDistillerScheme
);
514 savable_schemes
->push_back(dom_distiller::kDomDistillerScheme
);
515 #if defined(OS_CHROMEOS)
516 standard_schemes
->push_back(chrome::kCrosScheme
);
520 std::string
ChromeContentClient::GetProduct() const {
521 return ::GetProduct();
524 std::string
ChromeContentClient::GetUserAgent() const {
525 return ::GetUserAgent();
528 base::string16
ChromeContentClient::GetLocalizedString(int message_id
) const {
529 return l10n_util::GetStringUTF16(message_id
);
532 base::StringPiece
ChromeContentClient::GetDataResource(
534 ui::ScaleFactor scale_factor
) const {
535 return ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(
536 resource_id
, scale_factor
);
539 base::RefCountedStaticMemory
* ChromeContentClient::GetDataResourceBytes(
540 int resource_id
) const {
541 return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id
);
544 gfx::Image
& ChromeContentClient::GetNativeImageNamed(int resource_id
) const {
545 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id
);
548 std::string
ChromeContentClient::GetProcessTypeNameInEnglish(int type
) {
549 #if !defined(DISABLE_NACL)
551 case PROCESS_TYPE_NACL_LOADER
:
552 return "Native Client module";
553 case PROCESS_TYPE_NACL_BROKER
:
554 return "Native Client broker";
558 NOTREACHED() << "Unknown child process type!";
562 #if defined(OS_MACOSX) && !defined(OS_IOS)
563 bool ChromeContentClient::GetSandboxProfileForSandboxType(
565 int* sandbox_profile_resource_id
) const {
566 DCHECK(sandbox_profile_resource_id
);
567 #if !defined(DISABLE_NACL)
568 if (sandbox_type
== NACL_SANDBOX_TYPE_NACL_LOADER
) {
569 *sandbox_profile_resource_id
= IDR_NACL_SANDBOX_PROFILE
;
577 void ChromeContentClient::AddSecureSchemesAndOrigins(
578 std::set
<std::string
>* schemes
,
579 std::set
<GURL
>* origins
) {
580 schemes
->insert(content::kChromeUIScheme
);
581 schemes
->insert(extensions::kExtensionScheme
);
582 schemes
->insert(extensions::kExtensionResourceScheme
);
583 GetSecureOriginWhitelist(origins
);