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 "content/common/plugin_list.h" | 5 #include "content/common/plugin_list.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/file_version_info.h" | 10 #include "base/file_version_info.h" |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 { | 388 { |
389 base::AutoLock lock(lock_); | 389 base::AutoLock lock(lock_); |
390 should_check_version = | 390 should_check_version = |
391 std::find(extra_plugin_paths_.begin(), extra_plugin_paths_.end(), | 391 std::find(extra_plugin_paths_.begin(), extra_plugin_paths_.end(), |
392 info.path) == extra_plugin_paths_.end(); | 392 info.path) == extra_plugin_paths_.end(); |
393 } | 393 } |
394 // Version check for plugins that are not coming from |extra_plugin_paths_|. | 394 // Version check for plugins that are not coming from |extra_plugin_paths_|. |
395 if (should_check_version) { | 395 if (should_check_version) { |
396 for (size_t j = 0; j < plugins->size(); ++j) { | 396 for (size_t j = 0; j < plugins->size(); ++j) { |
397 base::FilePath::StringType plugin1 = | 397 base::FilePath::StringType plugin1 = |
398 base::StringToLowerASCII((*plugins)[j].path.BaseName().value()); | 398 base::ToLowerASCII((*plugins)[j].path.BaseName().value()); |
399 base::FilePath::StringType plugin2 = | 399 base::FilePath::StringType plugin2 = |
400 base::StringToLowerASCII(info.path.BaseName().value()); | 400 base::ToLowerASCII(info.path.BaseName().value()); |
401 if ((plugin1 == plugin2 && HaveSharedMimeType((*plugins)[j], info)) || | 401 if ((plugin1 == plugin2 && HaveSharedMimeType((*plugins)[j], info)) || |
402 (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) || | 402 (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) || |
403 (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) { | 403 (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) { |
404 if (IsNewerVersion(info.version, (*plugins)[j].version)) | 404 if (IsNewerVersion(info.version, (*plugins)[j].version)) |
405 return false; // We have loaded a plugin whose version is newer. | 405 return false; // We have loaded a plugin whose version is newer. |
406 plugins->erase(plugins->begin() + j); | 406 plugins->erase(plugins->begin() + j); |
407 break; | 407 break; |
408 } | 408 } |
409 } | 409 } |
410 } | 410 } |
411 | 411 |
412 // The checks below only apply to NPAPI plugins. | 412 // The checks below only apply to NPAPI plugins. |
413 if (info.type != WebPluginInfo::PLUGIN_TYPE_NPAPI) | 413 if (info.type != WebPluginInfo::PLUGIN_TYPE_NPAPI) |
414 return true; | 414 return true; |
415 | 415 |
416 { | 416 { |
417 base::AutoLock lock(lock_); | 417 base::AutoLock lock(lock_); |
418 // If the plugin is in our internal list we should load it. | 418 // If the plugin is in our internal list we should load it. |
419 for (size_t i = 0; i < internal_plugins_.size(); ++i) { | 419 for (size_t i = 0; i < internal_plugins_.size(); ++i) { |
420 if (info.path == internal_plugins_[i].path) | 420 if (info.path == internal_plugins_[i].path) |
421 return true; | 421 return true; |
422 } | 422 } |
423 } | 423 } |
424 | 424 |
425 // Troublemakers. | 425 // Troublemakers. |
426 base::FilePath::StringType filename = | 426 base::FilePath::StringType filename = |
427 base::StringToLowerASCII(info.path.BaseName().value()); | 427 base::ToLowerASCII(info.path.BaseName().value()); |
428 // Depends on XPCOM. | 428 // Depends on XPCOM. |
429 if (filename == kMozillaActiveXPlugin) | 429 if (filename == kMozillaActiveXPlugin) |
430 return false; | 430 return false; |
431 | 431 |
432 // Disable the Yahoo Application State plugin as it crashes the plugin | 432 // Disable the Yahoo Application State plugin as it crashes the plugin |
433 // process on return from NPObjectStub::OnInvoke. Please refer to | 433 // process on return from NPObjectStub::OnInvoke. Please refer to |
434 // http://b/issue?id=1372124 for more information. | 434 // http://b/issue?id=1372124 for more information. |
435 if (filename == kYahooApplicationStatePlugin) | 435 if (filename == kYahooApplicationStatePlugin) |
436 return false; | 436 return false; |
437 | 437 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 return false; | 482 return false; |
483 #else | 483 #else |
484 // The plugin in question could be a 64 bit plugin which we cannot load. | 484 // The plugin in question could be a 64 bit plugin which we cannot load. |
485 if (!IsValid32BitImage(base::MakeAbsoluteFilePath(plugin_path))) | 485 if (!IsValid32BitImage(base::MakeAbsoluteFilePath(plugin_path))) |
486 return false; | 486 return false; |
487 #endif | 487 #endif |
488 return true; | 488 return true; |
489 } | 489 } |
490 | 490 |
491 } // namespace content | 491 } // namespace content |
OLD | NEW |