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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 for (size_t j = 0; j < plugins->size(); ++j) { | 341 for (size_t j = 0; j < plugins->size(); ++j) { |
342 FilePath::StringType plugin1 = | 342 FilePath::StringType plugin1 = |
343 StringToLowerASCII((*plugins)[j].path.BaseName().value()); | 343 StringToLowerASCII((*plugins)[j].path.BaseName().value()); |
344 FilePath::StringType plugin2 = | 344 FilePath::StringType plugin2 = |
345 StringToLowerASCII(info.path.BaseName().value()); | 345 StringToLowerASCII(info.path.BaseName().value()); |
346 if ((plugin1 == plugin2 && HaveSharedMimeType((*plugins)[j], info)) || | 346 if ((plugin1 == plugin2 && HaveSharedMimeType((*plugins)[j], info)) || |
347 (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) || | 347 (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) || |
348 (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) { | 348 (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) { |
349 if (!IsNewerVersion((*plugins)[j].version, info.version)) | 349 if (!IsNewerVersion((*plugins)[j].version, info.version)) |
350 return false; // We have loaded a plugin whose version is newer. | 350 return false; // We have loaded a plugin whose version is newer. |
351 PluginList::RemovePlugin((*plugins)[j].path, plugins); | 351 plugins->erase(plugins->begin() + j); |
352 break; | 352 break; |
353 } | 353 } |
354 } | 354 } |
355 | 355 |
356 // Troublemakers | 356 // Troublemakers |
357 | 357 |
358 FilePath::StringType filename = | 358 FilePath::StringType filename = |
359 StringToLowerASCII(info.path.BaseName().value()); | 359 StringToLowerASCII(info.path.BaseName().value()); |
360 // Depends on XPCOM. | 360 // Depends on XPCOM. |
361 if (filename == kMozillaActiveXPlugin) | 361 if (filename == kMozillaActiveXPlugin) |
(...skipping 29 matching lines...) Expand all Loading... |
391 | 391 |
392 // Special WMP handling | 392 // Special WMP handling |
393 | 393 |
394 // If both the new and old WMP plugins exist, only load the new one. | 394 // If both the new and old WMP plugins exist, only load the new one. |
395 if (filename == kNewWMPPlugin) { | 395 if (filename == kNewWMPPlugin) { |
396 if (dont_load_new_wmp_) | 396 if (dont_load_new_wmp_) |
397 return false; | 397 return false; |
398 | 398 |
399 for (size_t j = 0; j < plugins->size(); ++j) { | 399 for (size_t j = 0; j < plugins->size(); ++j) { |
400 if ((*plugins)[j].path.BaseName().value() == kOldWMPPlugin) { | 400 if ((*plugins)[j].path.BaseName().value() == kOldWMPPlugin) { |
401 PluginList::RemovePlugin((*plugins)[j].path, plugins); | 401 plugins->erase(plugins->begin() + j); |
402 break; | 402 break; |
403 } | 403 } |
404 } | 404 } |
405 | 405 |
406 } else if (filename == kOldWMPPlugin) { | 406 } else if (filename == kOldWMPPlugin) { |
407 for (size_t j = 0; j < plugins->size(); ++j) { | 407 for (size_t j = 0; j < plugins->size(); ++j) { |
408 if ((*plugins)[j].path.BaseName().value() == kNewWMPPlugin) | 408 if ((*plugins)[j].path.BaseName().value() == kNewWMPPlugin) |
409 return false; | 409 return false; |
410 } | 410 } |
411 } | 411 } |
412 | 412 |
413 HMODULE plugin_dll = NULL; | 413 HMODULE plugin_dll = NULL; |
414 bool load_plugin = true; | 414 bool load_plugin = true; |
415 | 415 |
416 // The plugin list could contain a 64 bit plugin which we cannot load. | 416 // The plugin list could contain a 64 bit plugin which we cannot load. |
417 for (size_t i = 0; i < internal_plugins_.size(); ++i) { | 417 for (size_t i = 0; i < internal_plugins_.size(); ++i) { |
418 if (info.path == internal_plugins_[i].info.path) | 418 if (info.path == internal_plugins_[i].info.path) |
419 continue; | 419 continue; |
420 | 420 |
421 if (file_util::PathExists(info.path) && (!IsValid32BitImage(info.path))) | 421 if (file_util::PathExists(info.path) && (!IsValid32BitImage(info.path))) |
422 load_plugin = false; | 422 load_plugin = false; |
423 break; | 423 break; |
424 } | 424 } |
425 return load_plugin; | 425 return load_plugin; |
426 } | 426 } |
427 | 427 |
428 | 428 |
429 } // namespace npapi | 429 } // namespace npapi |
430 } // namespace webkit | 430 } // namespace webkit |
OLD | NEW |