diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-28 14:55:53 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-28 14:55:53 +0000 |
commit | 4e0616edf0c949858b67859b6f27a0c573425988 (patch) | |
tree | 5ca36e9ca74c06a96d0c37fd0957091b9bf10408 /chrome/browser | |
parent | 0298a21bc8ad80bd7b1cb09ce6d5711e5f698348 (diff) | |
download | chromium_src-4e0616edf0c949858b67859b6f27a0c573425988.zip chromium_src-4e0616edf0c949858b67859b6f27a0c573425988.tar.gz chromium_src-4e0616edf0c949858b67859b6f27a0c573425988.tar.bz2 |
Add ppapi plugins to about:plugins
Querying the plugin path and actual mime type is moved from creation of the
WebPluginDelegate to creation of the WebPlugin. This cleaned up some code.
R=jam
BUG=45289
TEST=none
Review URL: http://codereview.chromium.org/2262002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48484 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/plugin_service.cc | 21 | ||||
-rw-r--r-- | chrome/browser/plugin_service.h | 2 |
2 files changed, 23 insertions, 0 deletions
diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc index 5a77ee2..37e3d2d 100644 --- a/chrome/browser/plugin_service.cc +++ b/chrome/browser/plugin_service.cc @@ -28,6 +28,7 @@ #include "chrome/common/logging_chrome.h" #include "chrome/common/notification_type.h" #include "chrome/common/notification_service.h" +#include "chrome/common/pepper_plugin_registry.h" #include "chrome/common/plugin_messages.h" #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" @@ -148,6 +149,8 @@ PluginService::PluginService() : main_message_loop_(MessageLoop::current()), resource_dispatcher_host_(NULL), ui_locale_(ASCIIToWide(g_browser_process->GetApplicationLocale())) { + RegisterPepperPlugins(); + // Have the NPAPI plugin list search for Chrome plugins as well. ChromePluginLib::RegisterPluginsWithNPAPI(); // Load the one specified on the command line as well. @@ -415,3 +418,21 @@ bool PluginService::PluginAllowedForURL(const FilePath& plugin_path, return (url.scheme() == required_url.scheme() && url.host() == required_url.host()); } + +void PluginService::RegisterPepperPlugins() { + std::vector<PepperPluginInfo> plugins; + PepperPluginRegistry::GetList(&plugins); + for (size_t i = 0; i < plugins.size(); ++i) { + NPAPI::PluginVersionInfo info; + info.path = plugins[i].path; + info.product_name = plugins[i].path.BaseName().ToWStringHack(); + info.mime_types = ASCIIToWide(JoinString(plugins[i].mime_types, '|')); + + // These NPAPI entry points will never be called. TODO(darin): Come up + // with a cleaner way to register pepper plugins with the NPAPI PluginList, + // or perhaps refactor the PluginList to be less specific to NPAPI. + memset(&info.entry_points, 0, sizeof(info.entry_points)); + + NPAPI::PluginList::Singleton()->RegisterInternalPlugin(info); + } +} diff --git a/chrome/browser/plugin_service.h b/chrome/browser/plugin_service.h index 3ed6f31..b20e5ae 100644 --- a/chrome/browser/plugin_service.h +++ b/chrome/browser/plugin_service.h @@ -117,6 +117,8 @@ class PluginService // the given URL. bool PluginAllowedForURL(const FilePath& plugin_path, const GURL& url); + void RegisterPepperPlugins(); + // mapping between plugin path and PluginProcessHost typedef base::hash_map<FilePath, PluginProcessHost*> PluginMap; PluginMap plugin_hosts_; |