diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-31 18:30:49 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-31 18:30:49 +0000 |
commit | 2951965787cea2ad2f1c966791a68e2f10874071 (patch) | |
tree | 1faca6802b2ade4153a2723fe080fc4d8b8beeae | |
parent | 9a6c99d2b0b1737e7d732c892640af670161e5b6 (diff) | |
download | chromium_src-2951965787cea2ad2f1c966791a68e2f10874071.zip chromium_src-2951965787cea2ad2f1c966791a68e2f10874071.tar.gz chromium_src-2951965787cea2ad2f1c966791a68e2f10874071.tar.bz2 |
linux: prefer non-nspluginwrapper/crossover plugins
BUG=18947, various nspluginwrapper-related bugs perhaps
Review URL: http://codereview.chromium.org/173617
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24910 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | webkit/glue/plugins/plugin_list_linux.cc | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/webkit/glue/plugins/plugin_list_linux.cc b/webkit/glue/plugins/plugin_list_linux.cc index 661c142..634b87f 100644 --- a/webkit/glue/plugins/plugin_list_linux.cc +++ b/webkit/glue/plugins/plugin_list_linux.cc @@ -24,8 +24,18 @@ bool CompareTime(const FileAndTime& a, const FileAndTime& b) { return a.second > b.second; } +// Some plugins are shells around other plugins; we prefer to use the +// real plugin directly, if it's available. This function returns +// true if we should prefer other plugins over this one. We'll still +// use a "undesirable" plugin if no other option is available. +bool IsUndesirablePlugin(const WebPluginInfo& info) { + std::string filename = info.path.BaseName().value(); + return (filename.find("npcxoffice") != std::string::npos || // Crossover + filename.find("npwrapper") != std::string::npos); // nspluginwrapper } +} // anonymous namespace + namespace NPAPI { void PluginList::PlatformInit() { @@ -114,10 +124,22 @@ void PluginList::LoadPluginsFromDir(const FilePath& path, } } + bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info, std::vector<WebPluginInfo>* plugins) { - // TODO(evanm): blacklist nspluginwrapper here? - // TODO(evanm): prefer the newest version of flash here? + if (IsUndesirablePlugin(info)) { + // See if we have a better version of this plugin. + for (size_t i = 0; i < plugins->size(); ++i) { + if (plugins->at(i).name == info.name && + !IsUndesirablePlugin(plugins->at(i))) { + // Skip the current undesirable one so we can use the better one + // we just found. + return false; + } + } + } + + // TODO(evanm): prefer the newest version of flash, etc. here? return true; } |