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_util.h" | 10 #include "base/file_util.h" |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 { | 377 { |
378 base::AutoLock lock(lock_); | 378 base::AutoLock lock(lock_); |
379 should_check_version = | 379 should_check_version = |
380 std::find(extra_plugin_paths_.begin(), extra_plugin_paths_.end(), | 380 std::find(extra_plugin_paths_.begin(), extra_plugin_paths_.end(), |
381 info.path) == extra_plugin_paths_.end(); | 381 info.path) == extra_plugin_paths_.end(); |
382 } | 382 } |
383 // Version check for plugins that are not coming from |extra_plugin_paths_|. | 383 // Version check for plugins that are not coming from |extra_plugin_paths_|. |
384 if (should_check_version) { | 384 if (should_check_version) { |
385 for (size_t j = 0; j < plugins->size(); ++j) { | 385 for (size_t j = 0; j < plugins->size(); ++j) { |
386 base::FilePath::StringType plugin1 = | 386 base::FilePath::StringType plugin1 = |
387 StringToLowerASCII((*plugins)[j].path.BaseName().value()); | 387 base::StringToLowerASCII((*plugins)[j].path.BaseName().value()); |
388 base::FilePath::StringType plugin2 = | 388 base::FilePath::StringType plugin2 = |
389 StringToLowerASCII(info.path.BaseName().value()); | 389 base::StringToLowerASCII(info.path.BaseName().value()); |
390 if ((plugin1 == plugin2 && HaveSharedMimeType((*plugins)[j], info)) || | 390 if ((plugin1 == plugin2 && HaveSharedMimeType((*plugins)[j], info)) || |
391 (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) || | 391 (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) || |
392 (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) { | 392 (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) { |
393 if (IsNewerVersion(info.version, (*plugins)[j].version)) | 393 if (IsNewerVersion(info.version, (*plugins)[j].version)) |
394 return false; // We have loaded a plugin whose version is newer. | 394 return false; // We have loaded a plugin whose version is newer. |
395 plugins->erase(plugins->begin() + j); | 395 plugins->erase(plugins->begin() + j); |
396 break; | 396 break; |
397 } | 397 } |
398 } | 398 } |
399 } | 399 } |
400 | 400 |
401 // The checks below only apply to NPAPI plugins. | 401 // The checks below only apply to NPAPI plugins. |
402 if (info.type != WebPluginInfo::PLUGIN_TYPE_NPAPI) | 402 if (info.type != WebPluginInfo::PLUGIN_TYPE_NPAPI) |
403 return true; | 403 return true; |
404 | 404 |
405 { | 405 { |
406 base::AutoLock lock(lock_); | 406 base::AutoLock lock(lock_); |
407 // If the plugin is in our internal list we should load it. | 407 // If the plugin is in our internal list we should load it. |
408 for (size_t i = 0; i < internal_plugins_.size(); ++i) { | 408 for (size_t i = 0; i < internal_plugins_.size(); ++i) { |
409 if (info.path == internal_plugins_[i].path) | 409 if (info.path == internal_plugins_[i].path) |
410 return true; | 410 return true; |
411 } | 411 } |
412 } | 412 } |
413 | 413 |
414 // Troublemakers. | 414 // Troublemakers. |
415 base::FilePath::StringType filename = | 415 base::FilePath::StringType filename = |
416 StringToLowerASCII(info.path.BaseName().value()); | 416 base::StringToLowerASCII(info.path.BaseName().value()); |
417 // Depends on XPCOM. | 417 // Depends on XPCOM. |
418 if (filename == kMozillaActiveXPlugin) | 418 if (filename == kMozillaActiveXPlugin) |
419 return false; | 419 return false; |
420 | 420 |
421 // Disable the Yahoo Application State plugin as it crashes the plugin | 421 // Disable the Yahoo Application State plugin as it crashes the plugin |
422 // process on return from NPObjectStub::OnInvoke. Please refer to | 422 // process on return from NPObjectStub::OnInvoke. Please refer to |
423 // http://b/issue?id=1372124 for more information. | 423 // http://b/issue?id=1372124 for more information. |
424 if (filename == kYahooApplicationStatePlugin) | 424 if (filename == kYahooApplicationStatePlugin) |
425 return false; | 425 return false; |
426 | 426 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 return false; | 470 return false; |
471 #else | 471 #else |
472 // The plugin in question could be a 64 bit plugin which we cannot load. | 472 // The plugin in question could be a 64 bit plugin which we cannot load. |
473 if (!IsValid32BitImage(base::MakeAbsoluteFilePath(plugin_path))) | 473 if (!IsValid32BitImage(base::MakeAbsoluteFilePath(plugin_path))) |
474 return false; | 474 return false; |
475 #endif | 475 #endif |
476 return true; | 476 return true; |
477 } | 477 } |
478 | 478 |
479 } // namespace content | 479 } // namespace content |
OLD | NEW |