summaryrefslogtreecommitdiffstats
path: root/webkit/support
diff options
context:
space:
mode:
authortkent@google.com <tkent@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-10 07:19:24 +0000
committertkent@google.com <tkent@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-10 07:19:24 +0000
commit9f7b4d98cb1fb1065cbf8b045e50adcc6d4a2524 (patch)
treed3b599f89835284321e8196a054b13d96c514f56 /webkit/support
parentbee2335c8e86ab394e5380005d9d481b3f2b8ee3 (diff)
downloadchromium_src-9f7b4d98cb1fb1065cbf8b045e50adcc6d4a2524.zip
chromium_src-9f7b4d98cb1fb1065cbf8b045e50adcc6d4a2524.tar.gz
chromium_src-9f7b4d98cb1fb1065cbf8b045e50adcc6d4a2524.tar.bz2
Move npapi_layout_test_plugin target to webkit_support to use it from
WebKit DumpRenderTree. The following code change affects only WebKit DumpRenderTree. * webkit_support.cc - WebPluginImplWithPageDelegate passes a plugin path and MIME type to WebPluginImpl. - CreateWebPlugin checks a MIME type. This is the same logic as test_shell. * test_webplugin_page_delegate.h Creates and returns a WebPluginDelegateImpl instance. BUG=none TEST=none Review URL: http://codereview.chromium.org/2729004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49372 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/support')
-rw-r--r--webkit/support/test_webplugin_page_delegate.h7
-rw-r--r--webkit/support/webkit_support.cc23
-rw-r--r--webkit/support/webkit_support.gyp3
3 files changed, 29 insertions, 4 deletions
diff --git a/webkit/support/test_webplugin_page_delegate.h b/webkit/support/test_webplugin_page_delegate.h
index fe61032..05d4728 100644
--- a/webkit/support/test_webplugin_page_delegate.h
+++ b/webkit/support/test_webplugin_page_delegate.h
@@ -7,6 +7,7 @@
#include <string>
+#include "webkit/glue/plugins/webplugin_delegate_impl.h"
#include "webkit/glue/plugins/webplugin_page_delegate.h"
namespace webkit_support {
@@ -18,7 +19,11 @@ class TestWebPluginPageDelegate : public webkit_glue::WebPluginPageDelegate {
virtual webkit_glue::WebPluginDelegate* CreatePluginDelegate(
const FilePath& file_path,
- const std::string& mime_type) { return NULL; }
+ const std::string& mime_type) {
+ // We don't need a valid native window handle in layout tests.
+ // So just passing 0.
+ return WebPluginDelegateImpl::Create(file_path, mime_type, 0);
+ }
virtual void CreatedPluginWindow(gfx::PluginWindowHandle handle) {}
virtual void WillDestroyPluginWindow(gfx::PluginWindowHandle handle) {}
virtual void DidMovePlugin(const webkit_glue::WebPluginGeometry& move) {}
diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc
index c594fad..523c0469 100644
--- a/webkit/support/webkit_support.cc
+++ b/webkit/support/webkit_support.cc
@@ -24,8 +24,10 @@
#include "webkit/glue/media/media_resource_loader_bridge_factory.h"
#include "webkit/glue/media/simple_data_source.h"
#include "webkit/glue/media/video_renderer_impl.h"
+#include "webkit/glue/plugins/plugin_list.h"
#include "webkit/glue/plugins/webplugin_impl.h"
#include "webkit/glue/plugins/webplugin_page_delegate.h"
+#include "webkit/glue/plugins/webplugininfo.h"
#include "webkit/glue/webkitclient_impl.h"
#include "webkit/glue/webmediaplayer_impl.h"
#include "webkit/support/platform_support.h"
@@ -82,10 +84,12 @@ class WebPluginImplWithPageDelegate
public webkit_glue::WebPluginImpl {
public:
WebPluginImplWithPageDelegate(WebFrame* frame,
- const WebPluginParams& params)
+ const WebPluginParams& params,
+ const FilePath& path,
+ const std::string& mime_type)
: webkit_support::TestWebPluginPageDelegate(),
webkit_glue::WebPluginImpl(
- frame, params, FilePath(), params.mimeType.utf8(), AsWeakPtr()) {}
+ frame, params, path, mime_type, AsWeakPtr()) {}
virtual ~WebPluginImplWithPageDelegate() {}
private:
DISALLOW_COPY_AND_ASSIGN(WebPluginImplWithPageDelegate);
@@ -144,7 +148,20 @@ WebKit::WebKitClient* GetWebKitClient() {
WebPlugin* CreateWebPlugin(WebFrame* frame,
const WebPluginParams& params) {
- return new WebPluginImplWithPageDelegate(frame, params);
+ const bool kAllowWildcard = true;
+ WebPluginInfo info;
+ std::string actual_mime_type;
+ if (!NPAPI::PluginList::Singleton()->GetPluginInfo(
+ params.url, params.mimeType.utf8(), kAllowWildcard, &info,
+ &actual_mime_type)) {
+ return NULL;
+ }
+
+ if (actual_mime_type.empty())
+ actual_mime_type = params.mimeType.utf8();
+
+ return new WebPluginImplWithPageDelegate(
+ frame, params, info.path, actual_mime_type);
}
WebKit::WebMediaPlayer* CreateMediaPlayer(WebFrame* frame,
diff --git a/webkit/support/webkit_support.gyp b/webkit/support/webkit_support.gyp
index fa9256a..fb6052b 100644
--- a/webkit/support/webkit_support.gyp
+++ b/webkit/support/webkit_support.gyp
@@ -7,6 +7,9 @@
'../appcache/webkit_appcache.gypi',
'../database/webkit_database.gypi',
'../glue/webkit_glue.gypi',
+ # TODO(tkent): Merge npapi_layout_test_plugin into TestNetscapePlugIn
+ # of WebKit.
+ '../tools/npapi_layout_test_plugin/npapi_layout_test_plugin.gypi',
'webkit_support.gypi',
],
}