Home | History | Annotate | Download | only in common
      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/cpu.h"
      9 #include "base/debug/crash_logging.h"
     10 #include "base/file_util.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_paths.h"
     21 #include "chrome/common/chrome_switches.h"
     22 #include "chrome/common/chrome_version_info.h"
     23 #include "chrome/common/crash_keys.h"
     24 #include "chrome/common/pepper_flash.h"
     25 #include "chrome/common/render_messages.h"
     26 #include "chrome/common/url_constants.h"
     27 #include "components/nacl/common/nacl_process_type.h"
     28 #include "content/public/common/content_constants.h"
     29 #include "content/public/common/content_switches.h"
     30 #include "content/public/common/pepper_plugin_info.h"
     31 #include "content/public/common/url_constants.h"
     32 #include "content/public/common/user_agent.h"
     33 #include "extensions/common/constants.h"
     34 #include "gpu/config/gpu_info.h"
     35 #include "grit/common_resources.h"
     36 #include "ppapi/shared_impl/ppapi_permissions.h"
     37 #include "ui/base/l10n/l10n_util.h"
     38 #include "ui/base/layout.h"
     39 #include "ui/base/resource/resource_bundle.h"
     40 
     41 #include "flapper_version.h"  // In SHARED_INTERMEDIATE_DIR.
     42 #include "widevine_cdm_version.h"  // In SHARED_INTERMEDIATE_DIR.
     43 
     44 #if defined(OS_WIN)
     45 #include "base/win/registry.h"
     46 #include "base/win/windows_version.h"
     47 #elif defined(OS_MACOSX)
     48 #include "components/nacl/common/nacl_sandbox_type_mac.h"
     49 #endif
     50 
     51 #if defined(ENABLE_REMOTING)
     52 #include "remoting/client/plugin/pepper_entrypoints.h"
     53 #endif
     54 
     55 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \
     56     !defined(WIDEVINE_CDM_IS_COMPONENT)
     57 #include "chrome/common/widevine_cdm_constants.h"
     58 #endif
     59 
     60 namespace {
     61 
     62 const char kPDFPluginMimeType[] = "application/pdf";
     63 const char kPDFPluginExtension[] = "pdf";
     64 const char kPDFPluginDescription[] = "Portable Document Format";
     65 const char kPDFPluginPrintPreviewMimeType[] =
     66    "application/x-google-chrome-print-preview-pdf";
     67 const char kPDFPluginOutOfProcessMimeType[] =
     68    "application/x-google-chrome-pdf";
     69 const uint32 kPDFPluginPermissions = ppapi::PERMISSION_PRIVATE |
     70                                      ppapi::PERMISSION_DEV;
     71 
     72 const char kNaClPluginMimeType[] = "application/x-nacl";
     73 const char kNaClPluginExtension[] = "";
     74 const char kNaClPluginDescription[] = "Native Client Executable";
     75 const uint32 kNaClPluginPermissions = ppapi::PERMISSION_PRIVATE |
     76                                       ppapi::PERMISSION_DEV;
     77 
     78 const char kPnaclPluginMimeType[] = "application/x-pnacl";
     79 const char kPnaclPluginExtension[] = "";
     80 const char kPnaclPluginDescription[] = "Portable Native Client Executable";
     81 
     82 const char kO1DPluginName[] = "Google Talk Plugin Video Renderer";
     83 const char kO1DPluginMimeType[] ="application/o1d";
     84 const char kO1DPluginExtension[] = "";
     85 const char kO1DPluginDescription[] = "Google Talk Plugin Video Renderer";
     86 const uint32 kO1DPluginPermissions = ppapi::PERMISSION_PRIVATE |
     87                                      ppapi::PERMISSION_DEV;
     88 
     89 const char kEffectsPluginName[] = "Google Talk Effects Plugin";
     90 const char kEffectsPluginMimeType[] ="application/x-ppapi-hangouts-effects";
     91 const char kEffectsPluginExtension[] = "";
     92 const char kEffectsPluginDescription[] = "Google Talk Effects Plugin";
     93 const uint32 kEffectsPluginPermissions = ppapi::PERMISSION_PRIVATE |
     94                                          ppapi::PERMISSION_DEV;
     95 
     96 const char kGTalkPluginName[] = "Google Talk Plugin";
     97 const char kGTalkPluginMimeType[] ="application/googletalk";
     98 const char kGTalkPluginExtension[] = ".googletalk";
     99 const char kGTalkPluginDescription[] = "Google Talk Plugin";
    100 const uint32 kGTalkPluginPermissions = ppapi::PERMISSION_PRIVATE |
    101                                        ppapi::PERMISSION_DEV;
    102 
    103 #if defined(ENABLE_REMOTING)
    104 #if defined(GOOGLE_CHROME_BUILD)
    105 const char kRemotingViewerPluginName[] = "Chrome Remote Desktop Viewer";
    106 #else
    107 const char kRemotingViewerPluginName[] = "Chromoting Viewer";
    108 #endif  // defined(GOOGLE_CHROME_BUILD)
    109 const char kRemotingViewerPluginDescription[] =
    110     "This plugin allows you to securely access other computers that have been "
    111     "shared with you. To use this plugin you must first install the "
    112     "<a href=\"https://chrome.google.com/remotedesktop\">"
    113     "Chrome Remote Desktop</a> webapp.";
    114 // Use a consistent MIME-type regardless of branding.
    115 const char kRemotingViewerPluginMimeType[] =
    116     "application/vnd.chromium.remoting-viewer";
    117 const char kRemotingViewerPluginMimeExtension[] = "";
    118 const char kRemotingViewerPluginMimeDescription[] = "";
    119 const uint32 kRemotingViewerPluginPermissions = ppapi::PERMISSION_PRIVATE |
    120                                                 ppapi::PERMISSION_DEV;
    121 #endif  // defined(ENABLE_REMOTING)
    122 
    123 #if defined(OS_MACOSX) && !defined(OS_IOS)
    124 const char kInterposeLibraryPath[] =
    125     "@executable_path/../../../libplugin_carbon_interpose.dylib";
    126 #endif  // defined(OS_MACOSX) && !defined(OS_IOS)
    127 
    128 // Appends the known built-in plugins to the given vector. Some built-in
    129 // plugins are "internal" which means they are compiled into the Chrome binary,
    130 // and some are extra shared libraries distributed with the browser (these are
    131 // not marked internal, aside from being automatically registered, they're just
    132 // regular plugins).
    133 void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) {
    134   // PDF.
    135   //
    136   // Once we're sandboxed, we can't know if the PDF plugin is available or not;
    137   // but (on Linux) this function is always called once before we're sandboxed.
    138   // So the first time through test if the file is available and then skip the
    139   // check on subsequent calls if yes.
    140   static bool skip_pdf_file_check = false;
    141   base::FilePath path;
    142   if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) {
    143     if (skip_pdf_file_check || base::PathExists(path)) {
    144       content::PepperPluginInfo pdf;
    145       pdf.path = path;
    146       pdf.name = ChromeContentClient::kPDFPluginName;
    147       if (CommandLine::ForCurrentProcess()->HasSwitch(
    148               switches::kOutOfProcessPdf)) {
    149         pdf.is_out_of_process = true;
    150         content::WebPluginMimeType pdf_mime_type(kPDFPluginOutOfProcessMimeType,
    151                                                  kPDFPluginExtension,
    152                                                  kPDFPluginDescription);
    153         pdf.mime_types.push_back(pdf_mime_type);
    154         // TODO(raymes): Make print preview work with out of process PDF.
    155       } else {
    156         content::WebPluginMimeType pdf_mime_type(kPDFPluginMimeType,
    157                                                  kPDFPluginExtension,
    158                                                  kPDFPluginDescription);
    159         content::WebPluginMimeType print_preview_pdf_mime_type(
    160             kPDFPluginPrintPreviewMimeType,
    161             kPDFPluginExtension,
    162             kPDFPluginDescription);
    163         pdf.mime_types.push_back(pdf_mime_type);
    164         pdf.mime_types.push_back(print_preview_pdf_mime_type);
    165       }
    166       pdf.permissions = kPDFPluginPermissions;
    167       plugins->push_back(pdf);
    168 
    169       skip_pdf_file_check = true;
    170     }
    171   }
    172 
    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   // Specifically, Portable Native Client is only enabled by the command line
    178   // switch.
    179   static bool skip_nacl_file_check = false;
    180   if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) {
    181     if (skip_nacl_file_check || base::PathExists(path)) {
    182       content::PepperPluginInfo nacl;
    183       nacl.path = path;
    184       nacl.name = ChromeContentClient::kNaClPluginName;
    185       content::WebPluginMimeType nacl_mime_type(kNaClPluginMimeType,
    186                                                 kNaClPluginExtension,
    187                                                 kNaClPluginDescription);
    188       nacl.mime_types.push_back(nacl_mime_type);
    189       if (!CommandLine::ForCurrentProcess()->HasSwitch(
    190               switches::kDisablePnacl)) {
    191         content::WebPluginMimeType pnacl_mime_type(kPnaclPluginMimeType,
    192                                                    kPnaclPluginExtension,
    193                                                    kPnaclPluginDescription);
    194         nacl.mime_types.push_back(pnacl_mime_type);
    195       }
    196       nacl.permissions = kNaClPluginPermissions;
    197       plugins->push_back(nacl);
    198 
    199       skip_nacl_file_check = true;
    200     }
    201   }
    202 
    203   static bool skip_o1d_file_check = false;
    204   if (PathService::Get(chrome::FILE_O1D_PLUGIN, &path)) {
    205     if (skip_o1d_file_check || base::PathExists(path)) {
    206       content::PepperPluginInfo o1d;
    207       o1d.path = path;
    208       o1d.name = kO1DPluginName;
    209       o1d.is_out_of_process = true;
    210       o1d.is_sandboxed = false;
    211       o1d.permissions = kO1DPluginPermissions;
    212       content::WebPluginMimeType o1d_mime_type(kO1DPluginMimeType,
    213                                                kO1DPluginExtension,
    214                                                kO1DPluginDescription);
    215       o1d.mime_types.push_back(o1d_mime_type);
    216       plugins->push_back(o1d);
    217 
    218       skip_o1d_file_check = true;
    219     }
    220   }
    221 
    222   // TODO(vrk): Remove this when NaCl effects plugin replaces the ppapi effects
    223   // plugin.
    224   static bool skip_effects_file_check = false;
    225   if (PathService::Get(chrome::FILE_EFFECTS_PLUGIN, &path)) {
    226     if (skip_effects_file_check || base::PathExists(path)) {
    227       content::PepperPluginInfo effects;
    228       effects.path = path;
    229       effects.name = kEffectsPluginName;
    230       effects.is_out_of_process = true;
    231       effects.is_sandboxed = true;
    232       effects.permissions = kEffectsPluginPermissions;
    233       content::WebPluginMimeType effects_mime_type(kEffectsPluginMimeType,
    234                                                    kEffectsPluginExtension,
    235                                                    kEffectsPluginDescription);
    236       effects.mime_types.push_back(effects_mime_type);
    237       plugins->push_back(effects);
    238 
    239       skip_effects_file_check = true;
    240     }
    241   }
    242 
    243   static bool skip_gtalk_file_check = false;
    244   if (PathService::Get(chrome::FILE_GTALK_PLUGIN, &path)) {
    245     if (skip_gtalk_file_check || base::PathExists(path)) {
    246       content::PepperPluginInfo gtalk;
    247       gtalk.path = path;
    248       gtalk.name = kGTalkPluginName;
    249       gtalk.is_out_of_process = true;
    250       gtalk.is_sandboxed = false;
    251       gtalk.permissions = kGTalkPluginPermissions;
    252       content::WebPluginMimeType gtalk_mime_type(kGTalkPluginMimeType,
    253                                                  kGTalkPluginExtension,
    254                                                  kGTalkPluginDescription);
    255       gtalk.mime_types.push_back(gtalk_mime_type);
    256       plugins->push_back(gtalk);
    257 
    258       skip_gtalk_file_check = true;
    259     }
    260   }
    261 
    262 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \
    263     !defined(WIDEVINE_CDM_IS_COMPONENT)
    264   static bool skip_widevine_cdm_file_check = false;
    265   if (PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER, &path)) {
    266     if (skip_widevine_cdm_file_check || base::PathExists(path)) {
    267       content::PepperPluginInfo widevine_cdm;
    268       widevine_cdm.is_out_of_process = true;
    269       widevine_cdm.path = path;
    270       widevine_cdm.name = kWidevineCdmDisplayName;
    271       widevine_cdm.description = kWidevineCdmDescription;
    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       // TODO(xhwang): Add VP9 when it's supported by Widevine CDM.
    283       // See http://crbug.com/361318
    284 #if defined(USE_PROPRIETARY_CODECS)
    285 // TODO(ddorwin): Rename these macros to reflect their real meaning: whether the
    286 // CDM Chrome was built [and shipped] with support these types.
    287 #if defined(WIDEVINE_CDM_AAC_SUPPORT_AVAILABLE)
    288       codecs.push_back(kCdmSupportedCodecAac);
    289 #endif
    290 #if defined(WIDEVINE_CDM_AVC1_SUPPORT_AVAILABLE)
    291       codecs.push_back(kCdmSupportedCodecAvc1);
    292 #endif
    293 #endif  // defined(USE_PROPRIETARY_CODECS)
    294       std::string codec_string =
    295           JoinString(codecs, kCdmSupportedCodecsValueDelimiter);
    296       widevine_cdm_mime_type.additional_param_names.push_back(
    297           base::ASCIIToUTF16(kCdmSupportedCodecsParamName));
    298       widevine_cdm_mime_type.additional_param_values.push_back(
    299           base::ASCIIToUTF16(codec_string));
    300 
    301       widevine_cdm.mime_types.push_back(widevine_cdm_mime_type);
    302       widevine_cdm.permissions = kWidevineCdmPluginPermissions;
    303       plugins->push_back(widevine_cdm);
    304 
    305       skip_widevine_cdm_file_check = true;
    306     }
    307   }
    308 #endif  // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) &&
    309         // !defined(WIDEVINE_CDM_IS_COMPONENT)
    310 
    311   // The Remoting Viewer plugin is built-in.
    312 #if defined(ENABLE_REMOTING)
    313   content::PepperPluginInfo info;
    314   info.is_internal = true;
    315   info.is_out_of_process = true;
    316   info.name = kRemotingViewerPluginName;
    317   info.description = kRemotingViewerPluginDescription;
    318   info.path = base::FilePath::FromUTF8Unsafe(
    319       ChromeContentClient::kRemotingViewerPluginPath);
    320   content::WebPluginMimeType remoting_mime_type(
    321       kRemotingViewerPluginMimeType,
    322       kRemotingViewerPluginMimeExtension,
    323       kRemotingViewerPluginMimeDescription);
    324   info.mime_types.push_back(remoting_mime_type);
    325   info.internal_entry_points.get_interface = remoting::PPP_GetInterface;
    326   info.internal_entry_points.initialize_module =
    327       remoting::PPP_InitializeModule;
    328   info.internal_entry_points.shutdown_module = remoting::PPP_ShutdownModule;
    329   info.permissions = kRemotingViewerPluginPermissions;
    330 
    331   plugins->push_back(info);
    332 #endif
    333 }
    334 
    335 content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path,
    336                                                 const std::string& version) {
    337   content::PepperPluginInfo plugin;
    338 
    339   plugin.is_out_of_process = true;
    340   plugin.name = content::kFlashPluginName;
    341   plugin.path = path;
    342   plugin.permissions = kPepperFlashPermissions;
    343 
    344   std::vector<std::string> flash_version_numbers;
    345   base::SplitString(version, '.', &flash_version_numbers);
    346   if (flash_version_numbers.size() < 1)
    347     flash_version_numbers.push_back("11");
    348   // |SplitString()| puts in an empty string given an empty string. :(
    349   else if (flash_version_numbers[0].empty())
    350     flash_version_numbers[0] = "11";
    351   if (flash_version_numbers.size() < 2)
    352     flash_version_numbers.push_back("2");
    353   if (flash_version_numbers.size() < 3)
    354     flash_version_numbers.push_back("999");
    355   if (flash_version_numbers.size() < 4)
    356     flash_version_numbers.push_back("999");
    357   // E.g., "Shockwave Flash 10.2 r154":
    358   plugin.description = plugin.name + " " + flash_version_numbers[0] + "." +
    359       flash_version_numbers[1] + " r" + flash_version_numbers[2];
    360   plugin.version = JoinString(flash_version_numbers, '.');
    361   content::WebPluginMimeType swf_mime_type(content::kFlashPluginSwfMimeType,
    362                                            content::kFlashPluginSwfExtension,
    363                                            content::kFlashPluginSwfDescription);
    364   plugin.mime_types.push_back(swf_mime_type);
    365   content::WebPluginMimeType spl_mime_type(content::kFlashPluginSplMimeType,
    366                                            content::kFlashPluginSplExtension,
    367                                            content::kFlashPluginSplDescription);
    368   plugin.mime_types.push_back(spl_mime_type);
    369 
    370   return plugin;
    371 }
    372 
    373 void AddPepperFlashFromCommandLine(
    374     std::vector<content::PepperPluginInfo>* plugins) {
    375   const CommandLine::StringType flash_path =
    376       CommandLine::ForCurrentProcess()->GetSwitchValueNative(
    377           switches::kPpapiFlashPath);
    378   if (flash_path.empty())
    379     return;
    380 
    381   // Also get the version from the command-line. Should be something like 11.2
    382   // or 11.2.123.45.
    383   std::string flash_version =
    384       CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
    385           switches::kPpapiFlashVersion);
    386 
    387   plugins->push_back(
    388       CreatePepperFlashInfo(base::FilePath(flash_path), flash_version));
    389 }
    390 
    391 bool GetBundledPepperFlash(content::PepperPluginInfo* plugin) {
    392 #if defined(FLAPPER_AVAILABLE)
    393   CommandLine* command_line = CommandLine::ForCurrentProcess();
    394 
    395   // Ignore bundled Pepper Flash if there is Pepper Flash specified from the
    396   // command-line.
    397   if (command_line->HasSwitch(switches::kPpapiFlashPath))
    398     return false;
    399 
    400   bool force_disable =
    401       command_line->HasSwitch(switches::kDisableBundledPpapiFlash);
    402   if (force_disable)
    403     return false;
    404 
    405 // For Linux ia32, Flapper requires SSE2.
    406 #if defined(OS_LINUX) && defined(ARCH_CPU_X86)
    407   if (!base::CPU().has_sse2())
    408     return false;
    409 #endif  // ARCH_CPU_X86
    410 
    411   base::FilePath flash_path;
    412   if (!PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, &flash_path))
    413     return false;
    414 
    415   *plugin = CreatePepperFlashInfo(flash_path, FLAPPER_VERSION_STRING);
    416   return true;
    417 #else
    418   return false;
    419 #endif  // FLAPPER_AVAILABLE
    420 }
    421 
    422 std::string GetProduct() {
    423   chrome::VersionInfo version_info;
    424   return version_info.is_valid() ?
    425       version_info.ProductNameAndVersionForUserAgent() : std::string();
    426 }
    427 
    428 }  // namespace
    429 
    430 std::string GetUserAgent() {
    431   CommandLine* command_line = CommandLine::ForCurrentProcess();
    432   if (command_line->HasSwitch(switches::kUserAgent))
    433     return command_line->GetSwitchValueASCII(switches::kUserAgent);
    434 
    435   std::string product = GetProduct();
    436 #if defined(OS_ANDROID)
    437   if (command_line->HasSwitch(switches::kUseMobileUserAgent))
    438     product += " Mobile";
    439 #endif
    440   return content::BuildUserAgentFromProduct(product);
    441 }
    442 
    443 void ChromeContentClient::SetActiveURL(const GURL& url) {
    444   base::debug::SetCrashKeyValue(crash_keys::kActiveURL,
    445                                 url.possibly_invalid_spec());
    446 }
    447 
    448 void ChromeContentClient::SetGpuInfo(const gpu::GPUInfo& gpu_info) {
    449 #if !defined(OS_ANDROID)
    450   base::debug::SetCrashKeyValue(crash_keys::kGPUVendorID,
    451       base::StringPrintf("0x%04x", gpu_info.gpu.vendor_id));
    452   base::debug::SetCrashKeyValue(crash_keys::kGPUDeviceID,
    453       base::StringPrintf("0x%04x", gpu_info.gpu.device_id));
    454 #endif
    455   base::debug::SetCrashKeyValue(crash_keys::kGPUDriverVersion,
    456       gpu_info.driver_version);
    457   base::debug::SetCrashKeyValue(crash_keys::kGPUPixelShaderVersion,
    458       gpu_info.pixel_shader_version);
    459   base::debug::SetCrashKeyValue(crash_keys::kGPUVertexShaderVersion,
    460       gpu_info.vertex_shader_version);
    461 #if defined(OS_MACOSX)
    462   base::debug::SetCrashKeyValue(crash_keys::kGPUGLVersion, gpu_info.gl_version);
    463 #elif defined(OS_POSIX)
    464   base::debug::SetCrashKeyValue(crash_keys::kGPUVendor, gpu_info.gl_vendor);
    465   base::debug::SetCrashKeyValue(crash_keys::kGPURenderer, gpu_info.gl_renderer);
    466 #endif
    467 }
    468 
    469 void ChromeContentClient::AddPepperPlugins(
    470     std::vector<content::PepperPluginInfo>* plugins) {
    471   ComputeBuiltInPlugins(plugins);
    472   AddPepperFlashFromCommandLine(plugins);
    473 
    474   content::PepperPluginInfo plugin;
    475   if (GetBundledPepperFlash(&plugin))
    476     plugins->push_back(plugin);
    477 }
    478 
    479 void ChromeContentClient::AddAdditionalSchemes(
    480     std::vector<std::string>* standard_schemes,
    481     std::vector<std::string>* savable_schemes) {
    482   standard_schemes->push_back(extensions::kExtensionScheme);
    483   savable_schemes->push_back(extensions::kExtensionScheme);
    484   standard_schemes->push_back(chrome::kChromeNativeScheme);
    485   standard_schemes->push_back(extensions::kExtensionResourceScheme);
    486   savable_schemes->push_back(extensions::kExtensionResourceScheme);
    487   standard_schemes->push_back(chrome::kChromeSearchScheme);
    488   savable_schemes->push_back(chrome::kChromeSearchScheme);
    489   standard_schemes->push_back(chrome::kDomDistillerScheme);
    490   savable_schemes->push_back(chrome::kDomDistillerScheme);
    491 #if defined(OS_CHROMEOS)
    492   standard_schemes->push_back(chrome::kCrosScheme);
    493 #endif
    494 }
    495 
    496 std::string ChromeContentClient::GetProduct() const {
    497   return ::GetProduct();
    498 }
    499 
    500 std::string ChromeContentClient::GetUserAgent() const {
    501   return ::GetUserAgent();
    502 }
    503 
    504 base::string16 ChromeContentClient::GetLocalizedString(int message_id) const {
    505   return l10n_util::GetStringUTF16(message_id);
    506 }
    507 
    508 base::StringPiece ChromeContentClient::GetDataResource(
    509     int resource_id,
    510     ui::ScaleFactor scale_factor) const {
    511   return ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(
    512       resource_id, scale_factor);
    513 }
    514 
    515 base::RefCountedStaticMemory* ChromeContentClient::GetDataResourceBytes(
    516     int resource_id) const {
    517   return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id);
    518 }
    519 
    520 gfx::Image& ChromeContentClient::GetNativeImageNamed(int resource_id) const {
    521   return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id);
    522 }
    523 
    524 std::string ChromeContentClient::GetProcessTypeNameInEnglish(int type) {
    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 
    532   DCHECK(false) << "Unknown child process type!";
    533   return "Unknown";
    534 }
    535 
    536 #if defined(OS_MACOSX) && !defined(OS_IOS)
    537 bool ChromeContentClient::GetSandboxProfileForSandboxType(
    538     int sandbox_type,
    539     int* sandbox_profile_resource_id) const {
    540   DCHECK(sandbox_profile_resource_id);
    541   if (sandbox_type == NACL_SANDBOX_TYPE_NACL_LOADER) {
    542     *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE;
    543     return true;
    544   }
    545   return false;
    546 }
    547 
    548 std::string ChromeContentClient::GetCarbonInterposePath() const {
    549   return std::string(kInterposeLibraryPath);
    550 }
    551 #endif
    552