Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: webkit/plugins/npapi/plugin_list_win.cc

Issue 10860044: 1st CL in a series to remove PluginGroup. Updates PluginList. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 1st CL in series to delete PluginGroup. Updates PluginList only. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webkit/plugins/npapi/plugin_list_posix.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 base::StringToInt(b_ver[i], &cur_b); 328 base::StringToInt(b_ver[i], &cur_b);
329 329
330 if (cur_a > cur_b) 330 if (cur_a > cur_b)
331 return false; 331 return false;
332 if (cur_a < cur_b) 332 if (cur_a < cur_b)
333 return true; 333 return true;
334 } 334 }
335 return false; 335 return false;
336 } 336 }
337 337
338 bool PluginList::ShouldLoadPlugin(const webkit::WebPluginInfo& info, 338 // TODO(ibraaaa): DELETE. http://crbug.com/124396
339 ScopedVector<PluginGroup>* plugin_groups) { 339 bool PluginList::ShouldLoadPlugin(
340 const webkit::WebPluginInfo& info,
341 ScopedVector<PluginGroup>* plugin_groups) {
340 // Version check 342 // Version check
341 343
342 for (size_t i = 0; i < plugin_groups->size(); ++i) { 344 for (size_t i = 0; i < plugin_groups->size(); ++i) {
343 const std::vector<webkit::WebPluginInfo>& plugins = 345 const std::vector<webkit::WebPluginInfo>& plugins =
344 (*plugin_groups)[i]->web_plugin_infos(); 346 (*plugin_groups)[i]->web_plugin_infos();
345 for (size_t j = 0; j < plugins.size(); ++j) { 347 for (size_t j = 0; j < plugins.size(); ++j) {
346 std::wstring plugin1 = 348 std::wstring plugin1 =
347 StringToLowerASCII(plugins[j].path.BaseName().value()); 349 StringToLowerASCII(plugins[j].path.BaseName().value());
348 std::wstring plugin2 = 350 std::wstring plugin2 =
349 StringToLowerASCII(info.path.BaseName().value()); 351 StringToLowerASCII(info.path.BaseName().value());
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 if (info.path == internal_plugins_[i].info.path) 437 if (info.path == internal_plugins_[i].info.path)
436 continue; 438 continue;
437 439
438 if (file_util::PathExists(info.path) && (!IsValid32BitImage(info.path))) 440 if (file_util::PathExists(info.path) && (!IsValid32BitImage(info.path)))
439 load_plugin = false; 441 load_plugin = false;
440 break; 442 break;
441 } 443 }
442 return load_plugin; 444 return load_plugin;
443 } 445 }
444 446
447 bool PluginList::ShouldLoadPluginUsingPluginList(
448 const webkit::WebPluginInfo& info,
449 std::vector<webkit::WebPluginInfo>* plugins) {
450 // Version check
451 for (size_t j = 0; j < plugins->size(); ++j) {
452 FilePath::StringType plugin1 =
453 StringToLowerASCII((*plugins)[j].path.BaseName().value());
454 FilePath::StringType plugin2 =
455 StringToLowerASCII(info.path.BaseName().value());
456 if ((plugin1 == plugin2 && HaveSharedMimeType((*plugins)[j], info)) ||
457 (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) ||
458 (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) {
459 if (!IsNewerVersion((*plugins)[j].version, info.version))
460 return false; // We have loaded a plugin whose version is newer.
461 PluginList::RemovePlugin((*plugins)[j].path, plugins);
462 break;
463 }
464 }
465
466 // Troublemakers
467
468 FilePath::StringType filename =
469 StringToLowerASCII(info.path.BaseName().value());
470 // Depends on XPCOM.
471 if (filename == kMozillaActiveXPlugin)
472 return false;
473
474 // Disable the Yahoo Application State plugin as it crashes the plugin
475 // process on return from NPObjectStub::OnInvoke. Please refer to
476 // http://b/issue?id=1372124 for more information.
477 if (filename == kYahooApplicationStatePlugin)
478 return false;
479
480 // Disable the WangWang protocol handler plugin (npww.dll) as it crashes
481 // chrome during shutdown. Firefox also disables this plugin.
482 // Please refer to http://code.google.com/p/chromium/issues/detail?id=3953
483 // for more information.
484 if (filename == kWanWangProtocolHandlerPlugin)
485 return false;
486
487 // We only work with newer versions of the Java plugin which use NPAPI only
488 // and don't depend on XPCOM.
489 if (filename == kJavaPlugin1 || filename == kJavaPlugin2) {
490 std::vector<FilePath::StringType> ver;
491 base::SplitString(info.version, '.', &ver);
492 int major, minor, update;
493 if (ver.size() == 4 &&
494 base::StringToInt(ver[0], &major) &&
495 base::StringToInt(ver[1], &minor) &&
496 base::StringToInt(ver[2], &update)) {
497 if (major == 6 && minor == 0 && update < 120)
498 return false; // Java SE6 Update 11 or older.
499 }
500 }
501
502 if (base::win::IsMetroProcess()) {
503 // In metro mode we only allow pepper plugins.
504 if (info.type == WebPluginInfo::PLUGIN_TYPE_NPAPI)
505 return false;
506 }
507
508 // Special WMP handling
509
510 // If both the new and old WMP plugins exist, only load the new one.
511 if (filename == kNewWMPPlugin) {
512 if (dont_load_new_wmp_)
513 return false;
514
515 for (size_t j = 0; j < plugins->size(); ++j) {
516 if ((*plugins)[j].path.BaseName().value() == kOldWMPPlugin) {
517 PluginList::RemovePlugin((*plugins)[j].path, plugins);
518 break;
519 }
520 }
521
522 } else if (filename == kOldWMPPlugin) {
523 for (size_t j = 0; j < plugins->size(); ++j) {
524 if ((*plugins)[j].path.BaseName().value() == kNewWMPPlugin)
525 return false;
526 }
527 }
528
529 HMODULE plugin_dll = NULL;
530 bool load_plugin = true;
531
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) {
534 if (info.path == internal_plugins_[i].info.path)
535 continue;
536
537 if (file_util::PathExists(info.path) && (!IsValid32BitImage(info.path)))
538 load_plugin = false;
539 break;
540 }
541 return load_plugin;
542 }
543
544
445 } // namespace npapi 545 } // namespace npapi
446 } // namespace webkit 546 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/npapi/plugin_list_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698