Chromium Code Reviews| Index: content/common/plugin_list_win.cc |
| diff --git a/content/common/plugin_list_win.cc b/content/common/plugin_list_win.cc |
| index f58a167696533fbe12e5b2d87e7bfa77535a464f..c92ad9564f35366aa154482254932dd566d5208f 100644 |
| --- a/content/common/plugin_list_win.cc |
| +++ b/content/common/plugin_list_win.cc |
| @@ -384,27 +384,44 @@ void PluginList::GetPluginPathsFromRegistry( |
| bool PluginList::ShouldLoadPluginUsingPluginList( |
| const WebPluginInfo& info, |
| std::vector<WebPluginInfo>* plugins) { |
| - bool should_check_version = true; |
| - { |
| - base::AutoLock lock(lock_); |
| - should_check_version = |
| - std::find(extra_plugin_paths_.begin(), extra_plugin_paths_.end(), |
| - info.path) == extra_plugin_paths_.end(); |
| + bool wrong_architecture = false; |
| + |
| + if (info.type == WebPluginInfo::PLUGIN_TYPE_NPAPI) { |
| + base::FilePath plugin_path(info.path); |
| +#if defined(ARCH_CPU_X86_64) |
| + // The plugin in question could be a 32 bit plugin which we cannot load. |
| + if (IsValid32BitImage(base::MakeAbsoluteFilePath(plugin_path))) |
| + wrong_architecture = true; |
| +#else |
| + // The plugin in question could be a 64 bit plugin which we cannot load. |
| + if (!IsValid32BitImage(base::MakeAbsoluteFilePath(plugin_path))) |
| + wrong_architecture = true; |
| +#endif |
| } |
| - // Version check for plugins that are not coming from |extra_plugin_paths_|. |
| - if (should_check_version) { |
| - for (size_t j = 0; j < plugins->size(); ++j) { |
| - base::FilePath::StringType plugin1 = |
| - base::StringToLowerASCII((*plugins)[j].path.BaseName().value()); |
| - base::FilePath::StringType plugin2 = |
| - base::StringToLowerASCII(info.path.BaseName().value()); |
| - if ((plugin1 == plugin2 && HaveSharedMimeType((*plugins)[j], info)) || |
| - (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) || |
| - (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) { |
| - if (IsNewerVersion(info.version, (*plugins)[j].version)) |
| - return false; // We have loaded a plugin whose version is newer. |
| - plugins->erase(plugins->begin() + j); |
| - break; |
| + |
|
ananta
2014/11/03 20:28:04
Can we bail if wrong_architecture is true? here?
Bernhard Bauer
2014/11/03 22:24:22
Alternatively:
bool should_check_version;
if
|
| + if (!wrong_architecture) { |
| + bool should_check_version = true; |
| + { |
| + base::AutoLock lock(lock_); |
| + should_check_version = |
| + std::find(extra_plugin_paths_.begin(), extra_plugin_paths_.end(), |
| + info.path) == extra_plugin_paths_.end(); |
| + } |
| + // Version check for plugins that are not coming from |extra_plugin_paths_|. |
| + if (should_check_version) { |
| + for (size_t j = 0; j < plugins->size(); ++j) { |
| + base::FilePath::StringType plugin1 = |
| + base::StringToLowerASCII((*plugins)[j].path.BaseName().value()); |
| + base::FilePath::StringType plugin2 = |
| + base::StringToLowerASCII(info.path.BaseName().value()); |
| + if ((plugin1 == plugin2 && HaveSharedMimeType((*plugins)[j], info)) || |
| + (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) || |
| + (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) { |
| + if (IsNewerVersion(info.version, (*plugins)[j].version)) |
| + return false; // We have loaded a plugin whose version is newer. |
| + plugins->erase(plugins->begin() + j); |
| + break; |
| + } |
| } |
| } |
| } |
| @@ -474,16 +491,9 @@ bool PluginList::ShouldLoadPluginUsingPluginList( |
| } |
| } |
| - base::FilePath plugin_path(info.path); |
| -#if defined(ARCH_CPU_X86_64) |
| - // The plugin in question could be a 32 bit plugin which we cannot load. |
| - if (IsValid32BitImage(base::MakeAbsoluteFilePath(plugin_path))) |
| + if (wrong_architecture) |
| return false; |
| -#else |
| - // The plugin in question could be a 64 bit plugin which we cannot load. |
| - if (!IsValid32BitImage(base::MakeAbsoluteFilePath(plugin_path))) |
| - return false; |
| -#endif |
| + |
| return true; |
| } |