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 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 content::PepperPluginInfo::GetInterfaceFunc g_pdf_get_interface
;
99 content::PepperPluginInfo::PPP_InitializeModuleFunc g_pdf_initialize_module
;
100 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_pdf_shutdown_module
;
102 #if defined(ENABLE_REMOTING)
104 content::PepperPluginInfo::GetInterfaceFunc g_remoting_get_interface
;
105 content::PepperPluginInfo::PPP_InitializeModuleFunc
106 g_remoting_initialize_module
;
107 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_remoting_shutdown_module
;
109 #if defined(GOOGLE_CHROME_BUILD)
110 const char kRemotingViewerPluginName
[] = "Chrome Remote Desktop Viewer";
112 const char kRemotingViewerPluginName
[] = "Chromoting Viewer";
113 #endif // defined(GOOGLE_CHROME_BUILD)
114 const char kRemotingViewerPluginDescription
[] =
115 "This plugin allows you to securely access other computers that have been "
116 "shared with you. To use this plugin you must first install the "
117 "<a href=\"https://chrome.google.com/remotedesktop\">"
118 "Chrome Remote Desktop</a> webapp.";
119 // Use a consistent MIME-type regardless of branding.
120 const char kRemotingViewerPluginMimeType
[] =
121 "application/vnd.chromium.remoting-viewer";
122 const char kRemotingViewerPluginMimeExtension
[] = "";
123 const char kRemotingViewerPluginMimeDescription
[] = "";
124 const uint32 kRemotingViewerPluginPermissions
= ppapi::PERMISSION_PRIVATE
|
125 ppapi::PERMISSION_DEV
;
126 #endif // defined(ENABLE_REMOTING)
128 #if !defined(DISABLE_NACL)
129 content::PepperPluginInfo::GetInterfaceFunc g_nacl_get_interface
;
130 content::PepperPluginInfo::PPP_InitializeModuleFunc g_nacl_initialize_module
;
131 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_nacl_shutdown_module
;
134 // Appends the known built-in plugins to the given vector. Some built-in
135 // plugins are "internal" which means they are compiled into the Chrome binary,
136 // and some are extra shared libraries distributed with the browser (these are
137 // not marked internal, aside from being automatically registered, they're just
139 void ComputeBuiltInPlugins(std::vector
<content::PepperPluginInfo
>* plugins
) {
140 content::PepperPluginInfo pdf_info
;
141 pdf_info
.is_internal
= true;
142 pdf_info
.is_out_of_process
= true;
143 pdf_info
.name
= ChromeContentClient::kPDFPluginName
;
144 pdf_info
.description
= kPDFPluginDescription
;
145 pdf_info
.path
= base::FilePath::FromUTF8Unsafe(
146 ChromeContentClient::kPDFPluginPath
);
147 content::WebPluginMimeType
pdf_mime_type(
148 kPDFPluginOutOfProcessMimeType
,
150 kPDFPluginDescription
);
151 pdf_info
.mime_types
.push_back(pdf_mime_type
);
152 pdf_info
.internal_entry_points
.get_interface
= g_pdf_get_interface
;
153 pdf_info
.internal_entry_points
.initialize_module
= g_pdf_initialize_module
;
154 pdf_info
.internal_entry_points
.shutdown_module
= g_pdf_shutdown_module
;
155 pdf_info
.permissions
= kPDFPluginPermissions
;
156 plugins
->push_back(pdf_info
);
160 #if !defined(DISABLE_NACL)
161 // Handle Native Client just like the PDF plugin. This means that it is
162 // enabled by default for the non-portable case. This allows apps installed
163 // from the Chrome Web Store to use NaCl even if the command line switch
164 // isn't set. For other uses of NaCl we check for the command line switch.
165 if (PathService::Get(chrome::FILE_NACL_PLUGIN
, &path
)) {
166 content::PepperPluginInfo nacl
;
167 // The nacl plugin is now built into the Chromium binary.
168 nacl
.is_internal
= true;
170 nacl
.name
= nacl::kNaClPluginName
;
171 content::WebPluginMimeType
nacl_mime_type(nacl::kNaClPluginMimeType
,
172 nacl::kNaClPluginExtension
,
173 nacl::kNaClPluginDescription
);
174 nacl
.mime_types
.push_back(nacl_mime_type
);
175 content::WebPluginMimeType
pnacl_mime_type(nacl::kPnaclPluginMimeType
,
176 nacl::kPnaclPluginExtension
,
177 nacl::kPnaclPluginDescription
);
178 nacl
.mime_types
.push_back(pnacl_mime_type
);
179 nacl
.internal_entry_points
.get_interface
= g_nacl_get_interface
;
180 nacl
.internal_entry_points
.initialize_module
= g_nacl_initialize_module
;
181 nacl
.internal_entry_points
.shutdown_module
= g_nacl_shutdown_module
;
182 nacl
.permissions
= ppapi::PERMISSION_PRIVATE
| ppapi::PERMISSION_DEV
;
183 plugins
->push_back(nacl
);
185 #endif // !defined(DISABLE_NACL)
187 static bool skip_o1d_file_check
= false;
188 if (PathService::Get(chrome::FILE_O1D_PLUGIN
, &path
)) {
189 if (skip_o1d_file_check
|| base::PathExists(path
)) {
190 content::PepperPluginInfo o1d
;
192 o1d
.name
= kO1DPluginName
;
193 o1d
.is_out_of_process
= true;
194 o1d
.is_sandboxed
= false;
195 o1d
.permissions
= kO1DPluginPermissions
;
196 content::WebPluginMimeType
o1d_mime_type(kO1DPluginMimeType
,
198 kO1DPluginDescription
);
199 o1d
.mime_types
.push_back(o1d_mime_type
);
200 plugins
->push_back(o1d
);
202 skip_o1d_file_check
= true;
206 // TODO(vrk): Remove this when NaCl effects plugin replaces the ppapi effects
208 static bool skip_effects_file_check
= false;
209 if (PathService::Get(chrome::FILE_EFFECTS_PLUGIN
, &path
)) {
210 if (skip_effects_file_check
|| base::PathExists(path
)) {
211 content::PepperPluginInfo effects
;
213 effects
.name
= kEffectsPluginName
;
214 effects
.is_out_of_process
= true;
215 effects
.is_sandboxed
= true;
216 effects
.permissions
= kEffectsPluginPermissions
;
217 content::WebPluginMimeType
effects_mime_type(kEffectsPluginMimeType
,
218 kEffectsPluginExtension
,
219 kEffectsPluginDescription
);
220 effects
.mime_types
.push_back(effects_mime_type
);
221 plugins
->push_back(effects
);
223 skip_effects_file_check
= true;
227 static bool skip_gtalk_file_check
= false;
228 if (PathService::Get(chrome::FILE_GTALK_PLUGIN
, &path
)) {
229 if (skip_gtalk_file_check
|| base::PathExists(path
)) {
230 content::PepperPluginInfo gtalk
;
232 gtalk
.name
= kGTalkPluginName
;
233 gtalk
.is_out_of_process
= true;
234 gtalk
.is_sandboxed
= false;
235 gtalk
.permissions
= kGTalkPluginPermissions
;
236 content::WebPluginMimeType
gtalk_mime_type(kGTalkPluginMimeType
,
237 kGTalkPluginExtension
,
238 kGTalkPluginDescription
);
239 gtalk
.mime_types
.push_back(gtalk_mime_type
);
240 plugins
->push_back(gtalk
);
242 skip_gtalk_file_check
= true;
246 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \
247 !defined(WIDEVINE_CDM_IS_COMPONENT)
248 static bool skip_widevine_cdm_file_check
= false;
249 if (PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER
, &path
)) {
250 if (skip_widevine_cdm_file_check
|| base::PathExists(path
)) {
251 content::PepperPluginInfo widevine_cdm
;
252 widevine_cdm
.is_out_of_process
= true;
253 widevine_cdm
.path
= path
;
254 widevine_cdm
.name
= kWidevineCdmDisplayName
;
255 widevine_cdm
.description
= kWidevineCdmDescription
+
256 std::string(" (version: ") +
257 WIDEVINE_CDM_VERSION_STRING
+ ")";
258 widevine_cdm
.version
= WIDEVINE_CDM_VERSION_STRING
;
259 content::WebPluginMimeType
widevine_cdm_mime_type(
260 kWidevineCdmPluginMimeType
,
261 kWidevineCdmPluginExtension
,
262 kWidevineCdmPluginMimeTypeDescription
);
264 // Add the supported codecs as if they came from the component manifest.
265 std::vector
<std::string
> codecs
;
266 codecs
.push_back(kCdmSupportedCodecVorbis
);
267 codecs
.push_back(kCdmSupportedCodecVp8
);
268 codecs
.push_back(kCdmSupportedCodecVp9
);
269 #if defined(USE_PROPRIETARY_CODECS)
270 codecs
.push_back(kCdmSupportedCodecAac
);
271 codecs
.push_back(kCdmSupportedCodecAvc1
);
272 #endif // defined(USE_PROPRIETARY_CODECS)
273 std::string codec_string
=
274 JoinString(codecs
, kCdmSupportedCodecsValueDelimiter
);
275 widevine_cdm_mime_type
.additional_param_names
.push_back(
276 base::ASCIIToUTF16(kCdmSupportedCodecsParamName
));
277 widevine_cdm_mime_type
.additional_param_values
.push_back(
278 base::ASCIIToUTF16(codec_string
));
280 widevine_cdm
.mime_types
.push_back(widevine_cdm_mime_type
);
281 widevine_cdm
.permissions
= kWidevineCdmPluginPermissions
;
282 plugins
->push_back(widevine_cdm
);
284 skip_widevine_cdm_file_check
= true;
287 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) &&
288 // !defined(WIDEVINE_CDM_IS_COMPONENT)
290 // The Remoting Viewer plugin is built-in.
291 #if defined(ENABLE_REMOTING)
292 content::PepperPluginInfo info
;
293 info
.is_internal
= true;
294 info
.is_out_of_process
= true;
295 info
.name
= kRemotingViewerPluginName
;
296 info
.description
= kRemotingViewerPluginDescription
;
297 info
.path
= base::FilePath::FromUTF8Unsafe(
298 ChromeContentClient::kRemotingViewerPluginPath
);
299 content::WebPluginMimeType
remoting_mime_type(
300 kRemotingViewerPluginMimeType
,
301 kRemotingViewerPluginMimeExtension
,
302 kRemotingViewerPluginMimeDescription
);
303 info
.mime_types
.push_back(remoting_mime_type
);
304 info
.internal_entry_points
.get_interface
= g_remoting_get_interface
;
305 info
.internal_entry_points
.initialize_module
= g_remoting_initialize_module
;
306 info
.internal_entry_points
.shutdown_module
= g_remoting_shutdown_module
;
307 info
.permissions
= kRemotingViewerPluginPermissions
;
309 plugins
->push_back(info
);
313 content::PepperPluginInfo
CreatePepperFlashInfo(const base::FilePath
& path
,
314 const std::string
& version
) {
315 content::PepperPluginInfo plugin
;
317 plugin
.is_out_of_process
= true;
318 plugin
.name
= content::kFlashPluginName
;
320 plugin
.permissions
= chrome::kPepperFlashPermissions
;
322 std::vector
<std::string
> flash_version_numbers
;
323 base::SplitString(version
, '.', &flash_version_numbers
);
324 if (flash_version_numbers
.size() < 1)
325 flash_version_numbers
.push_back("11");
326 // |SplitString()| puts in an empty string given an empty string. :(
327 else if (flash_version_numbers
[0].empty())
328 flash_version_numbers
[0] = "11";
329 if (flash_version_numbers
.size() < 2)
330 flash_version_numbers
.push_back("2");
331 if (flash_version_numbers
.size() < 3)
332 flash_version_numbers
.push_back("999");
333 if (flash_version_numbers
.size() < 4)
334 flash_version_numbers
.push_back("999");
335 // E.g., "Shockwave Flash 10.2 r154":
336 plugin
.description
= plugin
.name
+ " " + flash_version_numbers
[0] + "." +
337 flash_version_numbers
[1] + " r" + flash_version_numbers
[2];
338 plugin
.version
= JoinString(flash_version_numbers
, '.');
339 content::WebPluginMimeType
swf_mime_type(content::kFlashPluginSwfMimeType
,
340 content::kFlashPluginSwfExtension
,
341 content::kFlashPluginSwfDescription
);
342 plugin
.mime_types
.push_back(swf_mime_type
);
343 content::WebPluginMimeType
spl_mime_type(content::kFlashPluginSplMimeType
,
344 content::kFlashPluginSplExtension
,
345 content::kFlashPluginSplDescription
);
346 plugin
.mime_types
.push_back(spl_mime_type
);
351 void AddPepperFlashFromCommandLine(
352 std::vector
<content::PepperPluginInfo
>* plugins
) {
353 const base::CommandLine::StringType flash_path
=
354 base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(
355 switches::kPpapiFlashPath
);
356 if (flash_path
.empty())
359 // Also get the version from the command-line. Should be something like 11.2
361 std::string flash_version
=
362 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
363 switches::kPpapiFlashVersion
);
366 CreatePepperFlashInfo(base::FilePath(flash_path
), flash_version
));
369 bool GetBundledPepperFlash(content::PepperPluginInfo
* plugin
) {
370 #if defined(FLAPPER_AVAILABLE)
371 base::CommandLine
* command_line
= base::CommandLine::ForCurrentProcess();
373 // Ignore bundled Pepper Flash if there is Pepper Flash specified from the
375 if (command_line
->HasSwitch(switches::kPpapiFlashPath
))
379 command_line
->HasSwitch(switches::kDisableBundledPpapiFlash
);
383 base::FilePath flash_path
;
384 if (!PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN
, &flash_path
))
387 *plugin
= CreatePepperFlashInfo(flash_path
, FLAPPER_VERSION_STRING
);
391 #endif // FLAPPER_AVAILABLE
395 const char kPepperFlashDLLBaseName
[] =
396 #if defined(ARCH_CPU_X86)
398 #elif defined(ARCH_CPU_X86_64)
401 #error Unsupported Windows CPU architecture.
402 #endif // defined(ARCH_CPU_X86)
403 #endif // defined(OS_WIN)
405 bool GetSystemPepperFlash(content::PepperPluginInfo
* plugin
) {
406 base::CommandLine
* command_line
= base::CommandLine::ForCurrentProcess();
407 #if defined(FLAPPER_AVAILABLE)
408 // If flapper is available, only try system plugin if
409 // --disable-bundled-ppapi-flash is specified.
410 if (!command_line
->HasSwitch(switches::kDisableBundledPpapiFlash
))
412 #endif // defined(FLAPPER_AVAILABLE)
414 // Do not try and find System Pepper Flash if there is a specific path on
415 // the commmand-line.
416 if (command_line
->HasSwitch(switches::kPpapiFlashPath
))
419 base::FilePath flash_path
;
420 if (!PathService::Get(chrome::DIR_PEPPER_FLASH_SYSTEM_PLUGIN
, &flash_path
))
423 if (!base::PathExists(flash_path
))
426 base::FilePath
manifest_path(flash_path
.AppendASCII("manifest.json"));
428 std::string manifest_data
;
429 if (!base::ReadFileToString(manifest_path
, &manifest_data
))
431 scoped_ptr
<base::Value
> manifest_value(
432 base::JSONReader::Read(manifest_data
, base::JSON_ALLOW_TRAILING_COMMAS
));
433 if (!manifest_value
.get())
435 base::DictionaryValue
* manifest
= NULL
;
436 if (!manifest_value
->GetAsDictionary(&manifest
))
440 if (!chrome::CheckPepperFlashManifest(*manifest
, &version
))
444 // PepperFlash DLLs on Windows look like basename_v_x_y_z.dll.
445 std::string
filename(kPepperFlashDLLBaseName
);
446 filename
.append(version
.GetString());
447 base::ReplaceChars(filename
, ".", "_", &filename
);
448 filename
.append(".dll");
450 base::FilePath
path(flash_path
.Append(base::ASCIIToUTF16(filename
)));
452 // PepperFlash on OS X is called PepperFlashPlayer.plugin
453 base::FilePath
path(flash_path
.Append(chrome::kPepperFlashPluginFilename
));
456 if (!base::PathExists(path
))
459 *plugin
= CreatePepperFlashInfo(path
, version
.GetString());
462 #endif // defined(ENABLE_PLUGINS)
464 std::string
GetProduct() {
465 chrome::VersionInfo version_info
;
466 return version_info
.ProductNameAndVersionForUserAgent();
471 std::string
GetUserAgent() {
472 base::CommandLine
* command_line
= base::CommandLine::ForCurrentProcess();
473 if (command_line
->HasSwitch(switches::kUserAgent
)) {
474 std::string ua
= command_line
->GetSwitchValueASCII(switches::kUserAgent
);
475 if (net::HttpUtil::IsValidHeaderValue(ua
))
477 LOG(WARNING
) << "Ignored invalid value for flag --" << switches::kUserAgent
;
480 std::string product
= GetProduct();
481 #if defined(OS_ANDROID)
482 if (command_line
->HasSwitch(switches::kUseMobileUserAgent
))
483 product
+= " Mobile";
485 return content::BuildUserAgentFromProduct(product
);
489 #if defined(ENABLE_REMOTING)
491 void ChromeContentClient::SetRemotingEntryFunctions(
492 content::PepperPluginInfo::GetInterfaceFunc get_interface
,
493 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module
,
494 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module
) {
495 g_remoting_get_interface
= get_interface
;
496 g_remoting_initialize_module
= initialize_module
;
497 g_remoting_shutdown_module
= shutdown_module
;
501 #if !defined(DISABLE_NACL)
502 void ChromeContentClient::SetNaClEntryFunctions(
503 content::PepperPluginInfo::GetInterfaceFunc get_interface
,
504 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module
,
505 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module
) {
506 g_nacl_get_interface
= get_interface
;
507 g_nacl_initialize_module
= initialize_module
;
508 g_nacl_shutdown_module
= shutdown_module
;
512 #if defined(ENABLE_PLUGINS)
513 void ChromeContentClient::SetPDFEntryFunctions(
514 content::PepperPluginInfo::GetInterfaceFunc get_interface
,
515 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module
,
516 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module
) {
517 g_pdf_get_interface
= get_interface
;
518 g_pdf_initialize_module
= initialize_module
;
519 g_pdf_shutdown_module
= shutdown_module
;
523 void ChromeContentClient::SetActiveURL(const GURL
& url
) {
524 base::debug::SetCrashKeyValue(crash_keys::kActiveURL
,
525 url
.possibly_invalid_spec());
528 void ChromeContentClient::SetGpuInfo(const gpu::GPUInfo
& gpu_info
) {
529 #if !defined(OS_ANDROID)
530 base::debug::SetCrashKeyValue(crash_keys::kGPUVendorID
,
531 base::StringPrintf("0x%04x", gpu_info
.gpu
.vendor_id
));
532 base::debug::SetCrashKeyValue(crash_keys::kGPUDeviceID
,
533 base::StringPrintf("0x%04x", gpu_info
.gpu
.device_id
));
535 base::debug::SetCrashKeyValue(crash_keys::kGPUDriverVersion
,
536 gpu_info
.driver_version
);
537 base::debug::SetCrashKeyValue(crash_keys::kGPUPixelShaderVersion
,
538 gpu_info
.pixel_shader_version
);
539 base::debug::SetCrashKeyValue(crash_keys::kGPUVertexShaderVersion
,
540 gpu_info
.vertex_shader_version
);
541 #if defined(OS_MACOSX)
542 base::debug::SetCrashKeyValue(crash_keys::kGPUGLVersion
, gpu_info
.gl_version
);
543 #elif defined(OS_POSIX)
544 base::debug::SetCrashKeyValue(crash_keys::kGPUVendor
, gpu_info
.gl_vendor
);
545 base::debug::SetCrashKeyValue(crash_keys::kGPURenderer
, gpu_info
.gl_renderer
);
549 void ChromeContentClient::AddPepperPlugins(
550 std::vector
<content::PepperPluginInfo
>* plugins
) {
551 #if defined(ENABLE_PLUGINS)
552 ComputeBuiltInPlugins(plugins
);
553 AddPepperFlashFromCommandLine(plugins
);
555 content::PepperPluginInfo plugin
;
556 if (GetBundledPepperFlash(&plugin
))
557 plugins
->push_back(plugin
);
558 if (GetSystemPepperFlash(&plugin
))
559 plugins
->push_back(plugin
);
563 void ChromeContentClient::AddAdditionalSchemes(
564 std::vector
<std::string
>* standard_schemes
,
565 std::vector
<std::string
>* savable_schemes
) {
566 standard_schemes
->push_back(extensions::kExtensionScheme
);
567 savable_schemes
->push_back(extensions::kExtensionScheme
);
568 standard_schemes
->push_back(chrome::kChromeNativeScheme
);
569 standard_schemes
->push_back(extensions::kExtensionResourceScheme
);
570 savable_schemes
->push_back(extensions::kExtensionResourceScheme
);
571 standard_schemes
->push_back(chrome::kChromeSearchScheme
);
572 savable_schemes
->push_back(chrome::kChromeSearchScheme
);
573 standard_schemes
->push_back(dom_distiller::kDomDistillerScheme
);
574 savable_schemes
->push_back(dom_distiller::kDomDistillerScheme
);
575 #if defined(OS_CHROMEOS)
576 standard_schemes
->push_back(chrome::kCrosScheme
);
580 std::string
ChromeContentClient::GetProduct() const {
581 return ::GetProduct();
584 std::string
ChromeContentClient::GetUserAgent() const {
585 return ::GetUserAgent();
588 base::string16
ChromeContentClient::GetLocalizedString(int message_id
) const {
589 return l10n_util::GetStringUTF16(message_id
);
592 base::StringPiece
ChromeContentClient::GetDataResource(
594 ui::ScaleFactor scale_factor
) const {
595 return ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(
596 resource_id
, scale_factor
);
599 base::RefCountedStaticMemory
* ChromeContentClient::GetDataResourceBytes(
600 int resource_id
) const {
601 return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id
);
604 gfx::Image
& ChromeContentClient::GetNativeImageNamed(int resource_id
) const {
605 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id
);
608 std::string
ChromeContentClient::GetProcessTypeNameInEnglish(int type
) {
609 #if !defined(DISABLE_NACL)
611 case PROCESS_TYPE_NACL_LOADER
:
612 return "Native Client module";
613 case PROCESS_TYPE_NACL_BROKER
:
614 return "Native Client broker";
618 NOTREACHED() << "Unknown child process type!";
622 #if defined(OS_MACOSX) && !defined(OS_IOS)
623 bool ChromeContentClient::GetSandboxProfileForSandboxType(
625 int* sandbox_profile_resource_id
) const {
626 DCHECK(sandbox_profile_resource_id
);
627 if (sandbox_type
== NACL_SANDBOX_TYPE_NACL_LOADER
) {
628 *sandbox_profile_resource_id
= IDR_NACL_SANDBOX_PROFILE
;