Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Unified Diff: extensions/shell/common/shell_content_client.cc

Issue 437503004: Add NaCl support to app_shell (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (nacl-init) rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..f875755fc128e58ec7fd9e644daa54e6c946d721 100644
--- a/extensions/shell/common/shell_content_client.cc
+++ b/extensions/shell/common/shell_content_client.cc
@@ -11,7 +11,48 @@
#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 "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 {
+
+// TODO(jamescook): Should these be shared with ChromeContentClient? They are
+// too specific for the ppapi module and not really part of the extensions
+// module. Perhaps they should live in components/nacl.
teravest 2014/08/12 15:48:32 components/nacl is probably a better place for thi
James Cook 2014/08/12 18:17:06 Moved into components/nacl/common and updated all
+#if !defined(DISABLE_NACL)
+const char kNaClPluginName[] = "Native Client";
+
+const char kNaClPluginMimeType[] = "application/x-nacl";
+const char kNaClPluginExtension[] = "";
+const char kNaClPluginDescription[] = "Native Client Executable";
+const uint32 kNaClPluginPermissions = ppapi::PERMISSION_PRIVATE |
+ ppapi::PERMISSION_DEV;
+
+const char kPnaclPluginMimeType[] = "application/x-pnacl";
+const char kPnaclPluginExtension[] = "";
+const char kPnaclPluginDescription[] = "Portable Native Client Executable";
+
+const base::FilePath::CharType kInternalNaClPluginFileName[] =
+ FILE_PATH_LITERAL("internal-nacl-plugin");
+
+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(kInternalNaClPluginFileName);
+ return true;
+}
+#endif // !defined(DISABLE_NACL)
+
+} // namespace
ShellContentClient::ShellContentClient() {
}
@@ -19,6 +60,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 = kNaClPluginName;
+ content::WebPluginMimeType nacl_mime_type(kNaClPluginMimeType,
+ kNaClPluginExtension,
+ kNaClPluginDescription);
+ nacl.mime_types.push_back(nacl_mime_type);
+ content::WebPluginMimeType pnacl_mime_type(kPnaclPluginMimeType,
+ kPnaclPluginExtension,
+ 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 = kNaClPluginPermissions;
+ plugins->push_back(nacl);
+#endif // !defined(DISABLE_NACL)
+}
+
void ShellContentClient::AddAdditionalSchemes(
std::vector<std::string>* standard_schemes,
std::vector<std::string>* savable_schemes) {

Powered by Google App Engine
This is Rietveld 408576698