OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "config.h" | 5 #include "config.h" |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 | 10 |
(...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1449 d->CreatePluginDelegate(webframe_->GetWebViewImpl(), gurl, my_mime_type, | 1449 d->CreatePluginDelegate(webframe_->GetWebViewImpl(), gurl, my_mime_type, |
1450 combined_clsid, &actual_mime_type); | 1450 combined_clsid, &actual_mime_type); |
1451 if (!plugin_delegate) | 1451 if (!plugin_delegate) |
1452 return NULL; | 1452 return NULL; |
1453 | 1453 |
1454 if (!actual_mime_type.empty()) | 1454 if (!actual_mime_type.empty()) |
1455 my_mime_type = actual_mime_type; | 1455 my_mime_type = actual_mime_type; |
1456 | 1456 |
1457 DCHECK(param_names.size() == param_values.size()); | 1457 DCHECK(param_names.size() == param_values.size()); |
1458 | 1458 |
1459 char **argn = NULL; | 1459 char **argn = ToArray(param_names); |
1460 char **argv = NULL; | 1460 char **argv = ToArray(param_values); |
1461 int argc = 0; | 1461 int argc = static_cast<int>(param_names.size()); |
1462 // There is a bug in Webkit which occurs when a plugin instance is defined | |
1463 // with an OBJECT tag containing the "DATA" attribute". Please refer to the | |
1464 // webkit issue http://bugs.webkit.org/show_bug.cgi?id=15457 for more info. | |
1465 // The code below is a patch which should be taken out when a fix is | |
1466 // available in webkit. The logic is to add the "src" attribute to the list | |
1467 // of params if the "data" attribute exists. | |
1468 // TODO(iyengar) : remove this when a fix is available in webkit. | |
1469 int data_attr_index = -1; | |
1470 int src_attr_index = -1; | |
1471 for (unsigned int i = 0; i < param_names.size(); i++) { | |
1472 String param_name = param_names[i].lower(); | |
1473 if (param_name == "data") | |
1474 data_attr_index = i; | |
1475 else if (param_name == "src") | |
1476 src_attr_index = i; | |
1477 } | |
1478 if ((data_attr_index != -1) && (src_attr_index == -1)) { | |
1479 Vector<String> updated_param_names = param_names; | |
1480 Vector<String> updated_param_values = param_values; | |
1481 updated_param_names.append("src"); | |
1482 updated_param_values.append(param_values[data_attr_index]); | |
1483 | |
1484 argn = ToArray(updated_param_names); | |
1485 argv = ToArray(updated_param_values); | |
1486 argc = static_cast<int>(updated_param_names.size()); | |
1487 } else { | |
1488 argn = ToArray(param_names); | |
1489 argv = ToArray(param_values); | |
1490 argc = static_cast<int>(param_names.size()); | |
1491 } | |
1492 | |
1493 Widget* result = WebPluginImpl::Create(gurl, argn, argv, argc, element, | 1462 Widget* result = WebPluginImpl::Create(gurl, argn, argv, argc, element, |
1494 webframe_, plugin_delegate, | 1463 webframe_, plugin_delegate, |
1495 load_manually, my_mime_type); | 1464 load_manually, my_mime_type); |
1496 | 1465 |
1497 DeleteToArray(argn); | 1466 DeleteToArray(argn); |
1498 DeleteToArray(argv); | 1467 DeleteToArray(argv); |
1499 | 1468 |
1500 return result; | 1469 return result; |
1501 } | 1470 } |
1502 | 1471 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1596 | 1565 |
1597 std::string offset_str = url.ExtractFileName(); | 1566 std::string offset_str = url.ExtractFileName(); |
1598 int offset; | 1567 int offset; |
1599 if (!StringToInt(offset_str, &offset)) | 1568 if (!StringToInt(offset_str, &offset)) |
1600 return; | 1569 return; |
1601 | 1570 |
1602 WebViewDelegate* d = webframe_->GetWebViewImpl()->delegate(); | 1571 WebViewDelegate* d = webframe_->GetWebViewImpl()->delegate(); |
1603 if (d) | 1572 if (d) |
1604 d->NavigateBackForwardSoon(offset); | 1573 d->NavigateBackForwardSoon(offset); |
1605 } | 1574 } |
OLD | NEW |