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

Unified Diff: webkit/glue/plugins/plugin_list.cc

Issue 207025: NaCl-Chrome integration (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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
« no previous file with comments | « webkit/glue/plugins/plugin_list.h ('k') | webkit/glue/plugins/plugin_list_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/plugins/plugin_list.cc
===================================================================
--- webkit/glue/plugins/plugin_list.cc (revision 26533)
+++ webkit/glue/plugins/plugin_list.cc (working copy)
@@ -15,6 +15,8 @@
#include "webkit/glue/webkit_glue.h"
#include "googleurl/src/gurl.h"
+#define kNpGoogleNaClPlugin (FILE_PATH_LITERAL("npgooglenaclplugin"))
+
namespace NPAPI {
base::LazyInstance<PluginList> g_singleton(base::LINKER_INITIALIZED);
@@ -113,7 +115,8 @@
return true;
}
-PluginList::PluginList() : plugins_loaded_(false) {
+PluginList::PluginList() : plugins_loaded_(false),
+ use_internal_nacl_(false) {
PlatformInit();
#if defined(OS_WIN)
@@ -168,6 +171,10 @@
LoadPluginsFromDir(directories_to_scan[i], &new_plugins);
}
+ if (use_internal_nacl_) {
+ LoadPlugin(FilePath(kNaClPluginLibraryName), &new_plugins);
+ }
+
if (webkit_glue::IsDefaultPluginEnabled())
LoadPlugin(FilePath(kDefaultPluginLibraryName), &new_plugins);
@@ -209,6 +216,20 @@
plugins->push_back(plugin_info);
}
+bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info,
+ std::vector<WebPluginInfo>* plugins) {
+ FilePath::StringType filename =
+ StringToLowerASCII(info.path.BaseName().value());
+
+ // Don't load the external version of NaCl when we need to use
+ // the internal one.
+ if (use_internal_nacl_) {
+ if (std::wstring::npos != filename.find(kNpGoogleNaClPlugin))
+ return false;
+ }
+ return PlatformShouldLoadPlugin(info, plugins);
+}
+
bool PluginList::FindPlugin(const std::string& mime_type,
bool allow_wildcard,
WebPluginInfo* info) {
@@ -327,4 +348,24 @@
// TODO
}
+// static
+void PluginList::UseInternalNaCl(PluginEntryPoints* entry_points) {
+ // We access the singleton directly, and not through Singleton(), since
+ // we don't want LoadPlugins() to be called.
+ g_singleton.Pointer()->use_internal_nacl_ = true;
+
+ const NPAPI::PluginVersionInfo nacl_plugin_info = {
+ FilePath(kNaClPluginLibraryName),
+ L"Native Client",
+ L"Statically linked NaCl",
+ L"1, 0, 0, 1",
+ L"application/x-nacl-srpc",
+ L"",
+ L"",
+ *entry_points
+ };
+
+ Singleton()->RegisterInternalPlugin(nacl_plugin_info);
+}
+
} // namespace NPAPI
« no previous file with comments | « webkit/glue/plugins/plugin_list.h ('k') | webkit/glue/plugins/plugin_list_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698