| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 for (size_t j = 0; j < plugins->size(); ++j) { | 451 for (size_t j = 0; j < plugins->size(); ++j) { |
| 452 FilePath::StringType plugin1 = | 452 FilePath::StringType plugin1 = |
| 453 StringToLowerASCII((*plugins)[j].path.BaseName().value()); | 453 StringToLowerASCII((*plugins)[j].path.BaseName().value()); |
| 454 FilePath::StringType plugin2 = | 454 FilePath::StringType plugin2 = |
| 455 StringToLowerASCII(info.path.BaseName().value()); | 455 StringToLowerASCII(info.path.BaseName().value()); |
| 456 if ((plugin1 == plugin2 && HaveSharedMimeType((*plugins)[j], info)) || | 456 if ((plugin1 == plugin2 && HaveSharedMimeType((*plugins)[j], info)) || |
| 457 (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) || | 457 (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) || |
| 458 (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) { | 458 (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) { |
| 459 if (!IsNewerVersion((*plugins)[j].version, info.version)) | 459 if (!IsNewerVersion((*plugins)[j].version, info.version)) |
| 460 return false; // We have loaded a plugin whose version is newer. | 460 return false; // We have loaded a plugin whose version is newer. |
| 461 PluginList::RemovePlugin((*plugins)[j].path, plugins); | 461 plugins->erase(plugins->begin() + j); |
| 462 break; | 462 break; |
| 463 } | 463 } |
| 464 } | 464 } |
| 465 | 465 |
| 466 // Troublemakers | 466 // Troublemakers |
| 467 | 467 |
| 468 FilePath::StringType filename = | 468 FilePath::StringType filename = |
| 469 StringToLowerASCII(info.path.BaseName().value()); | 469 StringToLowerASCII(info.path.BaseName().value()); |
| 470 // Depends on XPCOM. | 470 // Depends on XPCOM. |
| 471 if (filename == kMozillaActiveXPlugin) | 471 if (filename == kMozillaActiveXPlugin) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 | 507 |
| 508 // Special WMP handling | 508 // Special WMP handling |
| 509 | 509 |
| 510 // If both the new and old WMP plugins exist, only load the new one. | 510 // If both the new and old WMP plugins exist, only load the new one. |
| 511 if (filename == kNewWMPPlugin) { | 511 if (filename == kNewWMPPlugin) { |
| 512 if (dont_load_new_wmp_) | 512 if (dont_load_new_wmp_) |
| 513 return false; | 513 return false; |
| 514 | 514 |
| 515 for (size_t j = 0; j < plugins->size(); ++j) { | 515 for (size_t j = 0; j < plugins->size(); ++j) { |
| 516 if ((*plugins)[j].path.BaseName().value() == kOldWMPPlugin) { | 516 if ((*plugins)[j].path.BaseName().value() == kOldWMPPlugin) { |
| 517 PluginList::RemovePlugin((*plugins)[j].path, plugins); | 517 plugins->erase(plugins->begin() + j); |
| 518 break; | 518 break; |
| 519 } | 519 } |
| 520 } | 520 } |
| 521 | 521 |
| 522 } else if (filename == kOldWMPPlugin) { | 522 } else if (filename == kOldWMPPlugin) { |
| 523 for (size_t j = 0; j < plugins->size(); ++j) { | 523 for (size_t j = 0; j < plugins->size(); ++j) { |
| 524 if ((*plugins)[j].path.BaseName().value() == kNewWMPPlugin) | 524 if ((*plugins)[j].path.BaseName().value() == kNewWMPPlugin) |
| 525 return false; | 525 return false; |
| 526 } | 526 } |
| 527 } | 527 } |
| 528 | 528 |
| 529 HMODULE plugin_dll = NULL; | 529 HMODULE plugin_dll = NULL; |
| 530 bool load_plugin = true; | 530 bool load_plugin = true; |
| 531 | 531 |
| 532 // The plugin list could contain a 64 bit plugin which we cannot load. | 532 // The plugin list could contain a 64 bit plugin which we cannot load. |
| 533 for (size_t i = 0; i < internal_plugins_.size(); ++i) { | 533 for (size_t i = 0; i < internal_plugins_.size(); ++i) { |
| 534 if (info.path == internal_plugins_[i].info.path) | 534 if (info.path == internal_plugins_[i].info.path) |
| 535 continue; | 535 continue; |
| 536 | 536 |
| 537 if (file_util::PathExists(info.path) && (!IsValid32BitImage(info.path))) | 537 if (file_util::PathExists(info.path) && (!IsValid32BitImage(info.path))) |
| 538 load_plugin = false; | 538 load_plugin = false; |
| 539 break; | 539 break; |
| 540 } | 540 } |
| 541 return load_plugin; | 541 return load_plugin; |
| 542 } | 542 } |
| 543 | 543 |
| 544 | 544 |
| 545 } // namespace npapi | 545 } // namespace npapi |
| 546 } // namespace webkit | 546 } // namespace webkit |
| OLD | NEW |