| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "webkit/plugins/npapi/plugin_list.h" | 5 #include "webkit/plugins/npapi/plugin_list.h" |
| 6 | 6 |
| 7 #include <tchar.h> | 7 #include <tchar.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 } | 351 } |
| 352 return false; | 352 return false; |
| 353 } | 353 } |
| 354 | 354 |
| 355 bool PluginList::ShouldLoadPlugin(const webkit::WebPluginInfo& info, | 355 bool PluginList::ShouldLoadPlugin(const webkit::WebPluginInfo& info, |
| 356 ScopedVector<PluginGroup>* plugin_groups) { | 356 ScopedVector<PluginGroup>* plugin_groups) { |
| 357 // Version check | 357 // Version check |
| 358 | 358 |
| 359 for (size_t i = 0; i < plugin_groups->size(); ++i) { | 359 for (size_t i = 0; i < plugin_groups->size(); ++i) { |
| 360 const std::vector<webkit::WebPluginInfo>& plugins = | 360 const std::vector<webkit::WebPluginInfo>& plugins = |
| 361 (*plugin_groups)[i]->web_plugin_infos(); | 361 (*plugin_groups)[i]->web_plugins_info(); |
| 362 for (size_t j = 0; j < plugins.size(); ++j) { | 362 for (size_t j = 0; j < plugins.size(); ++j) { |
| 363 std::wstring plugin1 = | 363 std::wstring plugin1 = |
| 364 StringToLowerASCII(plugins[j].path.BaseName().value()); | 364 StringToLowerASCII(plugins[j].path.BaseName().value()); |
| 365 std::wstring plugin2 = | 365 std::wstring plugin2 = |
| 366 StringToLowerASCII(info.path.BaseName().value()); | 366 StringToLowerASCII(info.path.BaseName().value()); |
| 367 if ((plugin1 == plugin2 && HaveSharedMimeType(plugins[j], info)) || | 367 if ((plugin1 == plugin2 && HaveSharedMimeType(plugins[j], info)) || |
| 368 (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) || | 368 (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) || |
| 369 (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) { | 369 (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) { |
| 370 if (!IsNewerVersion(plugins[j].version, info.version)) | 370 if (!IsNewerVersion(plugins[j].version, info.version)) |
| 371 return false; // We have loaded a plugin whose version is newer. | 371 return false; // We have loaded a plugin whose version is newer. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 | 413 |
| 414 // Special WMP handling | 414 // Special WMP handling |
| 415 | 415 |
| 416 // If both the new and old WMP plugins exist, only load the new one. | 416 // If both the new and old WMP plugins exist, only load the new one. |
| 417 if (filename == kNewWMPPlugin) { | 417 if (filename == kNewWMPPlugin) { |
| 418 if (dont_load_new_wmp_) | 418 if (dont_load_new_wmp_) |
| 419 return false; | 419 return false; |
| 420 | 420 |
| 421 for (size_t i = 0; i < plugin_groups->size(); ++i) { | 421 for (size_t i = 0; i < plugin_groups->size(); ++i) { |
| 422 const std::vector<webkit::WebPluginInfo>& plugins = | 422 const std::vector<webkit::WebPluginInfo>& plugins = |
| 423 (*plugin_groups)[i]->web_plugin_infos(); | 423 (*plugin_groups)[i]->web_plugins_info(); |
| 424 for (size_t j = 0; j < plugins.size(); ++j) { | 424 for (size_t j = 0; j < plugins.size(); ++j) { |
| 425 if (plugins[j].path.BaseName().value() == kOldWMPPlugin) { | 425 if (plugins[j].path.BaseName().value() == kOldWMPPlugin) { |
| 426 (*plugin_groups)[i]->RemovePlugin(plugins[j].path); | 426 (*plugin_groups)[i]->RemovePlugin(plugins[j].path); |
| 427 break; | 427 break; |
| 428 } | 428 } |
| 429 } | 429 } |
| 430 } | 430 } |
| 431 } else if (filename == kOldWMPPlugin) { | 431 } else if (filename == kOldWMPPlugin) { |
| 432 for (size_t i = 0; i < plugin_groups->size(); ++i) { | 432 for (size_t i = 0; i < plugin_groups->size(); ++i) { |
| 433 const std::vector<webkit::WebPluginInfo>& plugins = | 433 const std::vector<webkit::WebPluginInfo>& plugins = |
| 434 (*plugin_groups)[i]->web_plugin_infos(); | 434 (*plugin_groups)[i]->web_plugins_info(); |
| 435 for (size_t j = 0; j < plugins.size(); ++j) { | 435 for (size_t j = 0; j < plugins.size(); ++j) { |
| 436 if (plugins[j].path.BaseName().value() == kNewWMPPlugin) | 436 if (plugins[j].path.BaseName().value() == kNewWMPPlugin) |
| 437 return false; | 437 return false; |
| 438 } | 438 } |
| 439 } | 439 } |
| 440 } | 440 } |
| 441 | 441 |
| 442 HMODULE plugin_dll = NULL; | 442 HMODULE plugin_dll = NULL; |
| 443 bool load_plugin = true; | 443 bool load_plugin = true; |
| 444 | 444 |
| 445 // The plugin list could contain a 64 bit plugin which we cannot load. | 445 // The plugin list could contain a 64 bit plugin which we cannot load. |
| 446 for (size_t i = 0; i < internal_plugins_.size(); ++i) { | 446 for (size_t i = 0; i < internal_plugins_.size(); ++i) { |
| 447 if (info.path == internal_plugins_[i].info.path) | 447 if (info.path == internal_plugins_[i].info.path) |
| 448 continue; | 448 continue; |
| 449 | 449 |
| 450 if (file_util::PathExists(info.path) && (!IsValid32BitImage(info.path))) | 450 if (file_util::PathExists(info.path) && (!IsValid32BitImage(info.path))) |
| 451 load_plugin = false; | 451 load_plugin = false; |
| 452 break; | 452 break; |
| 453 } | 453 } |
| 454 return load_plugin; | 454 return load_plugin; |
| 455 } | 455 } |
| 456 | 456 |
| 457 } // namespace npapi | 457 } // namespace npapi |
| 458 } // namespace webkit | 458 } // namespace webkit |
| OLD | NEW |