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

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

Issue 10918174: Remove PluginGroup (Closed) Base URL: http://git.chromium.org/chromium/src.git@remove_async_plugin_finder
Patch Set: fix conflicts Created 8 years, 2 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_unittest.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 // TODO(ibraaaa): DELETE. http://crbug.com/124396
339 bool PluginList::ShouldLoadPlugin(
340 const webkit::WebPluginInfo& info,
341 ScopedVector<PluginGroup>* plugin_groups) {
342 // Version check
343
344 for (size_t i = 0; i < plugin_groups->size(); ++i) {
345 const std::vector<webkit::WebPluginInfo>& plugins =
346 (*plugin_groups)[i]->web_plugin_infos();
347 for (size_t j = 0; j < plugins.size(); ++j) {
348 std::wstring plugin1 =
349 StringToLowerASCII(plugins[j].path.BaseName().value());
350 std::wstring plugin2 =
351 StringToLowerASCII(info.path.BaseName().value());
352 if ((plugin1 == plugin2 && HaveSharedMimeType(plugins[j], info)) ||
353 (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) ||
354 (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) {
355 if (!IsNewerVersion(plugins[j].version, info.version))
356 return false; // We have loaded a plugin whose version is newer.
357 (*plugin_groups)[i]->RemovePlugin(plugins[j].path);
358 break;
359 }
360 }
361 }
362
363 // Troublemakers
364
365 std::wstring filename = StringToLowerASCII(info.path.BaseName().value());
366 // Depends on XPCOM.
367 if (filename == kMozillaActiveXPlugin)
368 return false;
369
370 // Disable the Yahoo Application State plugin as it crashes the plugin
371 // process on return from NPObjectStub::OnInvoke. Please refer to
372 // http://b/issue?id=1372124 for more information.
373 if (filename == kYahooApplicationStatePlugin)
374 return false;
375
376 // Disable the WangWang protocol handler plugin (npww.dll) as it crashes
377 // chrome during shutdown. Firefox also disables this plugin.
378 // Please refer to http://code.google.com/p/chromium/issues/detail?id=3953
379 // for more information.
380 if (filename == kWanWangProtocolHandlerPlugin)
381 return false;
382
383 // We only work with newer versions of the Java plugin which use NPAPI only
384 // and don't depend on XPCOM.
385 if (filename == kJavaPlugin1 || filename == kJavaPlugin2) {
386 std::vector<std::wstring> ver;
387 base::SplitString(info.version, '.', &ver);
388 int major, minor, update;
389 if (ver.size() == 4 &&
390 base::StringToInt(ver[0], &major) &&
391 base::StringToInt(ver[1], &minor) &&
392 base::StringToInt(ver[2], &update)) {
393 if (major == 6 && minor == 0 && update < 120)
394 return false; // Java SE6 Update 11 or older.
395 }
396 }
397
398 if (base::win::IsMetroProcess()) {
399 // In metro mode we only allow pepper plugins.
400 if (info.type == WebPluginInfo::PLUGIN_TYPE_NPAPI)
401 return false;
402 }
403
404 // Special WMP handling
405
406 // If both the new and old WMP plugins exist, only load the new one.
407 if (filename == kNewWMPPlugin) {
408 if (dont_load_new_wmp_)
409 return false;
410
411 for (size_t i = 0; i < plugin_groups->size(); ++i) {
412 const std::vector<webkit::WebPluginInfo>& plugins =
413 (*plugin_groups)[i]->web_plugin_infos();
414 for (size_t j = 0; j < plugins.size(); ++j) {
415 if (plugins[j].path.BaseName().value() == kOldWMPPlugin) {
416 (*plugin_groups)[i]->RemovePlugin(plugins[j].path);
417 break;
418 }
419 }
420 }
421 } else if (filename == kOldWMPPlugin) {
422 for (size_t i = 0; i < plugin_groups->size(); ++i) {
423 const std::vector<webkit::WebPluginInfo>& plugins =
424 (*plugin_groups)[i]->web_plugin_infos();
425 for (size_t j = 0; j < plugins.size(); ++j) {
426 if (plugins[j].path.BaseName().value() == kNewWMPPlugin)
427 return false;
428 }
429 }
430 }
431
432 HMODULE plugin_dll = NULL;
433 bool load_plugin = true;
434
435 // The plugin list could contain a 64 bit plugin which we cannot load.
436 for (size_t i = 0; i < internal_plugins_.size(); ++i) {
437 if (info.path == internal_plugins_[i].info.path)
438 continue;
439
440 if (file_util::PathExists(info.path) && (!IsValid32BitImage(info.path)))
441 load_plugin = false;
442 break;
443 }
444 return load_plugin;
445 }
446
447 bool PluginList::ShouldLoadPluginUsingPluginList( 338 bool PluginList::ShouldLoadPluginUsingPluginList(
448 const webkit::WebPluginInfo& info, 339 const webkit::WebPluginInfo& info,
449 std::vector<webkit::WebPluginInfo>* plugins) { 340 std::vector<webkit::WebPluginInfo>* plugins) {
450 // Version check 341 // Version check
451 for (size_t j = 0; j < plugins->size(); ++j) { 342 for (size_t j = 0; j < plugins->size(); ++j) {
452 FilePath::StringType plugin1 = 343 FilePath::StringType plugin1 =
453 StringToLowerASCII((*plugins)[j].path.BaseName().value()); 344 StringToLowerASCII((*plugins)[j].path.BaseName().value());
454 FilePath::StringType plugin2 = 345 FilePath::StringType plugin2 =
455 StringToLowerASCII(info.path.BaseName().value()); 346 StringToLowerASCII(info.path.BaseName().value());
456 if ((plugin1 == plugin2 && HaveSharedMimeType((*plugins)[j], info)) || 347 if ((plugin1 == plugin2 && HaveSharedMimeType((*plugins)[j], info)) ||
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 if (file_util::PathExists(info.path) && (!IsValid32BitImage(info.path))) 428 if (file_util::PathExists(info.path) && (!IsValid32BitImage(info.path)))
538 load_plugin = false; 429 load_plugin = false;
539 break; 430 break;
540 } 431 }
541 return load_plugin; 432 return load_plugin;
542 } 433 }
543 434
544 435
545 } // namespace npapi 436 } // namespace npapi
546 } // namespace webkit 437 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/npapi/plugin_list_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698