Index: extensions/shell/common/shell_content_client.cc |
diff --git a/extensions/shell/common/shell_content_client.cc b/extensions/shell/common/shell_content_client.cc |
index 5f0df03509fb3748a42f785145c9023da21625e5..47f99bc9dc80082ba8ab27d5220de137ab2d9395 100644 |
--- a/extensions/shell/common/shell_content_client.cc |
+++ b/extensions/shell/common/shell_content_client.cc |
@@ -11,7 +11,31 @@ |
#include "ui/base/l10n/l10n_util.h" |
#include "ui/base/resource/resource_bundle.h" |
+#if !defined(DISABLE_NACL) |
+#include "base/base_paths.h" |
+#include "base/files/file_path.h" |
+#include "base/path_service.h" |
+#include "components/nacl/common/nacl_constants.h" |
+#include "content/public/common/pepper_plugin_info.h" |
+#include "ppapi/native_client/src/trusted/plugin/ppapi_entrypoints.h" |
+#include "ppapi/shared_impl/ppapi_permissions.h" |
+#endif |
+ |
namespace extensions { |
+namespace { |
+ |
+#if !defined(DISABLE_NACL) |
+bool GetNaClPluginPath(base::FilePath* path) { |
+ // On Posix, plugins live in the module directory. |
+ base::FilePath module; |
+ if (!PathService::Get(base::DIR_MODULE, &module)) |
+ return false; |
+ *path = module.Append(nacl::kInternalNaClPluginFileName); |
+ return true; |
+} |
+#endif // !defined(DISABLE_NACL) |
+ |
+} // namespace |
ShellContentClient::ShellContentClient() { |
} |
@@ -19,6 +43,36 @@ ShellContentClient::ShellContentClient() { |
ShellContentClient::~ShellContentClient() { |
} |
+void ShellContentClient::AddPepperPlugins( |
+ std::vector<content::PepperPluginInfo>* plugins) { |
+#if !defined(DISABLE_NACL) |
+ base::FilePath path; |
+ if (!GetNaClPluginPath(&path)) |
+ return; |
+ |
+ content::PepperPluginInfo nacl; |
+ // The nacl plugin is now built into the binary. |
+ nacl.is_internal = true; |
+ nacl.path = path; |
+ nacl.name = nacl::kNaClPluginName; |
+ content::WebPluginMimeType nacl_mime_type(nacl::kNaClPluginMimeType, |
+ nacl::kNaClPluginExtension, |
+ nacl::kNaClPluginDescription); |
+ nacl.mime_types.push_back(nacl_mime_type); |
+ content::WebPluginMimeType pnacl_mime_type(nacl::kPnaclPluginMimeType, |
+ nacl::kPnaclPluginExtension, |
+ nacl::kPnaclPluginDescription); |
+ nacl.mime_types.push_back(pnacl_mime_type); |
+ nacl.internal_entry_points.get_interface = nacl_plugin::PPP_GetInterface; |
+ nacl.internal_entry_points.initialize_module = |
+ nacl_plugin::PPP_InitializeModule; |
+ nacl.internal_entry_points.shutdown_module = |
+ nacl_plugin::PPP_ShutdownModule; |
+ nacl.permissions = ppapi::PERMISSION_PRIVATE | ppapi::PERMISSION_DEV; |
+ plugins->push_back(nacl); |
+#endif // !defined(DISABLE_NACL) |
+} |
+ |
void ShellContentClient::AddAdditionalSchemes( |
std::vector<std::string>* standard_schemes, |
std::vector<std::string>* savable_schemes) { |