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 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
17 #include "base/string_split.h" | 17 #include "base/string_split.h" |
18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
| 19 #include "base/win/metro.h" |
19 #include "base/win/pe_image.h" | 20 #include "base/win/pe_image.h" |
20 #include "base/win/registry.h" | 21 #include "base/win/registry.h" |
21 #include "base/win/scoped_handle.h" | 22 #include "base/win/scoped_handle.h" |
22 #include "webkit/plugins/npapi/plugin_constants_win.h" | 23 #include "webkit/plugins/npapi/plugin_constants_win.h" |
23 #include "webkit/plugins/npapi/plugin_lib.h" | 24 #include "webkit/plugins/npapi/plugin_lib.h" |
24 #include "webkit/plugins/plugin_switches.h" | 25 #include "webkit/plugins/plugin_switches.h" |
25 #include "webkit/glue/webkit_glue.h" | 26 #include "webkit/glue/webkit_glue.h" |
26 | 27 |
27 namespace webkit { | 28 namespace webkit { |
28 namespace npapi { | 29 namespace npapi { |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 for (size_t j = 0; j < plugins.size(); ++j) { | 338 for (size_t j = 0; j < plugins.size(); ++j) { |
338 std::wstring plugin1 = | 339 std::wstring plugin1 = |
339 StringToLowerASCII(plugins[j].path.BaseName().value()); | 340 StringToLowerASCII(plugins[j].path.BaseName().value()); |
340 std::wstring plugin2 = | 341 std::wstring plugin2 = |
341 StringToLowerASCII(info.path.BaseName().value()); | 342 StringToLowerASCII(info.path.BaseName().value()); |
342 if ((plugin1 == plugin2 && HaveSharedMimeType(plugins[j], info)) || | 343 if ((plugin1 == plugin2 && HaveSharedMimeType(plugins[j], info)) || |
343 (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) || | 344 (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) || |
344 (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) { | 345 (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) { |
345 if (!IsNewerVersion(plugins[j].version, info.version)) | 346 if (!IsNewerVersion(plugins[j].version, info.version)) |
346 return false; // We have loaded a plugin whose version is newer. | 347 return false; // We have loaded a plugin whose version is newer. |
347 | |
348 (*plugin_groups)[i]->RemovePlugin(plugins[j].path); | 348 (*plugin_groups)[i]->RemovePlugin(plugins[j].path); |
349 break; | 349 break; |
350 } | 350 } |
351 } | 351 } |
352 } | 352 } |
353 | 353 |
354 // Troublemakers | 354 // Troublemakers |
355 | 355 |
356 std::wstring filename = StringToLowerASCII(info.path.BaseName().value()); | 356 std::wstring filename = StringToLowerASCII(info.path.BaseName().value()); |
357 // Depends on XPCOM. | 357 // Depends on XPCOM. |
(...skipping 21 matching lines...) Expand all Loading... |
379 int major, minor, update; | 379 int major, minor, update; |
380 if (ver.size() == 4 && | 380 if (ver.size() == 4 && |
381 base::StringToInt(ver[0], &major) && | 381 base::StringToInt(ver[0], &major) && |
382 base::StringToInt(ver[1], &minor) && | 382 base::StringToInt(ver[1], &minor) && |
383 base::StringToInt(ver[2], &update)) { | 383 base::StringToInt(ver[2], &update)) { |
384 if (major == 6 && minor == 0 && update < 120) | 384 if (major == 6 && minor == 0 && update < 120) |
385 return false; // Java SE6 Update 11 or older. | 385 return false; // Java SE6 Update 11 or older. |
386 } | 386 } |
387 } | 387 } |
388 | 388 |
| 389 if (base::win::GetMetroModule()) { |
| 390 // In metro mode we only allow internal (pepper) plugins except flash. |
| 391 // TODO(cpu):remove this hack at some point in the future. |
| 392 if (info.type == WebPluginInfo::PLUGIN_TYPE_NPAPI) |
| 393 return false; |
| 394 if (filename == L"pepflashplayer.dll") |
| 395 return false; |
| 396 } |
| 397 |
389 // Special WMP handling | 398 // Special WMP handling |
390 | 399 |
391 // If both the new and old WMP plugins exist, only load the new one. | 400 // If both the new and old WMP plugins exist, only load the new one. |
392 if (filename == kNewWMPPlugin) { | 401 if (filename == kNewWMPPlugin) { |
393 if (dont_load_new_wmp_) | 402 if (dont_load_new_wmp_) |
394 return false; | 403 return false; |
395 | 404 |
396 for (size_t i = 0; i < plugin_groups->size(); ++i) { | 405 for (size_t i = 0; i < plugin_groups->size(); ++i) { |
397 const std::vector<webkit::WebPluginInfo>& plugins = | 406 const std::vector<webkit::WebPluginInfo>& plugins = |
398 (*plugin_groups)[i]->web_plugin_infos(); | 407 (*plugin_groups)[i]->web_plugin_infos(); |
(...skipping 25 matching lines...) Expand all Loading... |
424 | 433 |
425 if (file_util::PathExists(info.path) && (!IsValid32BitImage(info.path))) | 434 if (file_util::PathExists(info.path) && (!IsValid32BitImage(info.path))) |
426 load_plugin = false; | 435 load_plugin = false; |
427 break; | 436 break; |
428 } | 437 } |
429 return load_plugin; | 438 return load_plugin; |
430 } | 439 } |
431 | 440 |
432 } // namespace npapi | 441 } // namespace npapi |
433 } // namespace webkit | 442 } // namespace webkit |
OLD | NEW |