Index: webkit/plugins/npapi/plugin_list_win.cc |
diff --git a/webkit/plugins/npapi/plugin_list_win.cc b/webkit/plugins/npapi/plugin_list_win.cc |
index a9b71933e6ddf691957adfffdd353f6a743c569b..a7e3d022ce4bd26c5813de46c5b8bc0c1b9c47a6 100644 |
--- a/webkit/plugins/npapi/plugin_list_win.cc |
+++ b/webkit/plugins/npapi/plugin_list_win.cc |
@@ -335,8 +335,10 @@ bool IsNewerVersion(const std::wstring& a, const std::wstring& b) { |
return false; |
} |
-bool PluginList::ShouldLoadPlugin(const webkit::WebPluginInfo& info, |
- ScopedVector<PluginGroup>* plugin_groups) { |
+// TODO(ibraaaa): DELETE. http://crbug.com/124396 |
+bool PluginList::ShouldLoadPlugin( |
+ const webkit::WebPluginInfo& info, |
+ ScopedVector<PluginGroup>* plugin_groups) { |
// Version check |
for (size_t i = 0; i < plugin_groups->size(); ++i) { |
@@ -442,5 +444,103 @@ bool PluginList::ShouldLoadPlugin(const webkit::WebPluginInfo& info, |
return load_plugin; |
} |
+bool PluginList::ShouldLoadPluginUsingPluginList( |
+ const webkit::WebPluginInfo& info, |
+ std::vector<webkit::WebPluginInfo>* plugins) { |
+ // Version check |
+ for (size_t j = 0; j < plugins->size(); ++j) { |
+ FilePath::StringType plugin1 = |
+ StringToLowerASCII((*plugins)[j].path.BaseName().value()); |
+ FilePath::StringType plugin2 = |
+ StringToLowerASCII(info.path.BaseName().value()); |
+ if ((plugin1 == plugin2 && HaveSharedMimeType((*plugins)[j], info)) || |
+ (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) || |
+ (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) { |
+ if (!IsNewerVersion((*plugins)[j].version, info.version)) |
+ return false; // We have loaded a plugin whose version is newer. |
+ PluginList::RemovePlugin((*plugins)[j].path, plugins); |
+ break; |
+ } |
+ } |
+ |
+ // Troublemakers |
+ |
+ FilePath::StringType filename = |
+ StringToLowerASCII(info.path.BaseName().value()); |
+ // Depends on XPCOM. |
+ if (filename == kMozillaActiveXPlugin) |
+ return false; |
+ |
+ // Disable the Yahoo Application State plugin as it crashes the plugin |
+ // process on return from NPObjectStub::OnInvoke. Please refer to |
+ // http://b/issue?id=1372124 for more information. |
+ if (filename == kYahooApplicationStatePlugin) |
+ return false; |
+ |
+ // Disable the WangWang protocol handler plugin (npww.dll) as it crashes |
+ // chrome during shutdown. Firefox also disables this plugin. |
+ // Please refer to http://code.google.com/p/chromium/issues/detail?id=3953 |
+ // for more information. |
+ if (filename == kWanWangProtocolHandlerPlugin) |
+ return false; |
+ |
+ // We only work with newer versions of the Java plugin which use NPAPI only |
+ // and don't depend on XPCOM. |
+ if (filename == kJavaPlugin1 || filename == kJavaPlugin2) { |
+ std::vector<FilePath::StringType> ver; |
+ base::SplitString(info.version, '.', &ver); |
+ int major, minor, update; |
+ if (ver.size() == 4 && |
+ base::StringToInt(ver[0], &major) && |
+ base::StringToInt(ver[1], &minor) && |
+ base::StringToInt(ver[2], &update)) { |
+ if (major == 6 && minor == 0 && update < 120) |
+ return false; // Java SE6 Update 11 or older. |
+ } |
+ } |
+ |
+ if (base::win::IsMetroProcess()) { |
+ // In metro mode we only allow pepper plugins. |
+ if (info.type == WebPluginInfo::PLUGIN_TYPE_NPAPI) |
+ return false; |
+ } |
+ |
+ // Special WMP handling |
+ |
+ // If both the new and old WMP plugins exist, only load the new one. |
+ if (filename == kNewWMPPlugin) { |
+ if (dont_load_new_wmp_) |
+ return false; |
+ |
+ for (size_t j = 0; j < plugins->size(); ++j) { |
+ if ((*plugins)[j].path.BaseName().value() == kOldWMPPlugin) { |
+ PluginList::RemovePlugin((*plugins)[j].path, plugins); |
+ break; |
+ } |
+ } |
+ |
+ } else if (filename == kOldWMPPlugin) { |
+ for (size_t j = 0; j < plugins->size(); ++j) { |
+ if ((*plugins)[j].path.BaseName().value() == kNewWMPPlugin) |
+ return false; |
+ } |
+ } |
+ |
+ HMODULE plugin_dll = NULL; |
+ bool load_plugin = true; |
+ |
+ // The plugin list could contain a 64 bit plugin which we cannot load. |
+ for (size_t i = 0; i < internal_plugins_.size(); ++i) { |
+ if (info.path == internal_plugins_[i].info.path) |
+ continue; |
+ |
+ if (file_util::PathExists(info.path) && (!IsValid32BitImage(info.path))) |
+ load_plugin = false; |
+ break; |
+ } |
+ return load_plugin; |
+} |
+ |
+ |
} // namespace npapi |
} // namespace webkit |