diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-04 05:53:23 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-04 05:53:23 +0000 |
commit | 8a3b796aa8160ddaed478224050a2b7e1b16d9e6 (patch) | |
tree | d23ba1b25c4bcbd425522268951ad8af4a7cc1c7 /chrome/renderer/webplugin_delegate_proxy.cc | |
parent | 79dbc66fba17d6b4967fe86a577b11d15548cdec (diff) | |
download | chromium_src-8a3b796aa8160ddaed478224050a2b7e1b16d9e6.zip chromium_src-8a3b796aa8160ddaed478224050a2b7e1b16d9e6.tar.gz chromium_src-8a3b796aa8160ddaed478224050a2b7e1b16d9e6.tar.bz2 |
This changelist fixes some issues with the NPAPI WMP plugin work in Chrome. The first is that we need to disable windowless mode since it doesn't work in the NPAPI plugin (Safari does this as well, and sites don't use windowless for Firefox). The second is to make UpdateGeometry message synchronous for WMP. The problem I saw was that while handling that message, the plugin might disaptch a NPObject Invoke method to play a video, which WMP doesn't expect and it leads to the video never playing.
While touching these files, I made some small cleanup by reverting the change that made WebPluginProxy not have a WebPluginDelegateImpl pointer, which added a bunch of unnecessary methods to WebPluginDelegate.
BUG=20259
TEST=use --no-activex and try playing the videos on http://www.nana10.co.il/Section/?SectionID=10847&sid=235
Review URL: http://codereview.chromium.org/196012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25433 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/webplugin_delegate_proxy.cc')
-rw-r--r-- | chrome/renderer/webplugin_delegate_proxy.cc | 97 |
1 files changed, 39 insertions, 58 deletions
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index 66cf1c6..3740eb1 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -158,14 +158,6 @@ class ResourceClientProxy : public webkit_glue::WebPluginResourceClient { bool multibyte_response_expected_; }; -WebPluginDelegateProxy* WebPluginDelegateProxy::Create( - const GURL& url, - const std::string& mime_type, - const std::string& clsid, - const base::WeakPtr<RenderView>& render_view) { - return new WebPluginDelegateProxy(mime_type, clsid, render_view); -} - WebPluginDelegateProxy::WebPluginDelegateProxy( const std::string& mime_type, const std::string& clsid, @@ -225,15 +217,16 @@ void WebPluginDelegateProxy::PluginDestroyed() { MessageLoop::current()->DeleteSoon(FROM_HERE, this); } -bool WebPluginDelegateProxy::Initialize(const GURL& url, char** argn, - char** argv, int argc, +bool WebPluginDelegateProxy::Initialize(const GURL& url, + const std::vector<std::string>& arg_names, + const std::vector<std::string>& arg_values, webkit_glue::WebPlugin* plugin, bool load_manually) { IPC::ChannelHandle channel_handle; - FilePath plugin_path; + WebPluginInfo info; if (!RenderThread::current()->Send(new ViewHostMsg_OpenChannelToPlugin( url, mime_type_, clsid_, webkit_glue::GetWebKitLocale(), - &channel_handle, &plugin_path))) { + &channel_handle, &info))) { return false; } @@ -262,7 +255,7 @@ bool WebPluginDelegateProxy::Initialize(const GURL& url, char** argn, if (!result) return false; - plugin_path_ = plugin_path; + info_ = info; channel_host_ = channel_host; instance_id_ = instance_id; @@ -273,12 +266,11 @@ bool WebPluginDelegateProxy::Initialize(const GURL& url, char** argn, params.containing_window = render_view_->host_window(); params.url = url; params.page_url = page_url_; - for (int i = 0; i < argc; ++i) { - params.arg_names.push_back(argn[i]); - params.arg_values.push_back(argv[i]); - - if (LowerCaseEqualsASCII(params.arg_names.back(), "wmode") && - LowerCaseEqualsASCII(params.arg_values.back(), "transparent")) { + params.arg_names = arg_names; + params.arg_values = arg_values; + for (size_t i = 0; i < arg_names.size(); ++i) { + if (LowerCaseEqualsASCII(arg_names[i], "wmode") && + LowerCaseEqualsASCII(arg_values[i], "transparent")) { transparent_ = true; } } @@ -348,10 +340,6 @@ void WebPluginDelegateProxy::DidManualLoadFail() { Send(new PluginMsg_DidManualLoadFail(instance_id_)); } -FilePath WebPluginDelegateProxy::GetPluginPath() { - return plugin_path_; -} - void WebPluginDelegateProxy::InstallMissingPlugin() { Send(new PluginMsg_InstallMissingPlugin(instance_id_)); } @@ -400,7 +388,7 @@ void WebPluginDelegateProxy::OnChannelError() { } plugin_->Invalidate(); } - render_view_->PluginCrashed(GetProcessId(), plugin_path_); + render_view_->PluginCrashed(GetProcessId(), info_.path); } void WebPluginDelegateProxy::UpdateGeometry(const gfx::Rect& window_rect, @@ -430,28 +418,41 @@ void WebPluginDelegateProxy::UpdateGeometry(const gfx::Rect& window_rect, } } - IPC::Message* msg = NULL; + PluginMsg_UpdateGeometry_Param param; + param.window_rect = window_rect; + param.clip_rect = clip_rect; + param.windowless_buffer = TransportDIB::DefaultHandleValue(); + param.background_buffer = TransportDIB::DefaultHandleValue(); + #if defined(OS_POSIX) // If we're using POSIX mmap'd TransportDIBs, sending the handle across // IPC establishes a new mapping rather than just sending a window ID, // so only do so if we've actually recreated the shared memory bitmaps. - if (!bitmaps_changed) { - msg = new PluginMsg_UpdateGeometry(instance_id_, window_rect, clip_rect, - TransportDIB::DefaultHandleValue(), TransportDIB::DefaultHandleValue()); + if (bitmaps_changed) +#endif + { + if (transport_store_.get()) { + param.windowless_buffer = transport_store_->handle(); + } else if (background_store_.get()) { + param.background_buffer = background_store_->handle(); + } + } + + IPC::Message* msg; +#if defined (OS_WIN) + std::wstring filename = StringToLowerASCII(info_.path.BaseName().value()); + if (info_.name.find(L"Windows Media Player") != std::wstring::npos) { + // Need to update geometry synchronously with WMP, otherwise if a site + // scripts the plugin to start playing while it's in the middle of handling + // an update geometry message, videos don't play. See urls in bug 20260. + msg = new PluginMsg_UpdateGeometrySync(instance_id_, param); } else #endif - if (transport_store_.get() && background_store_.get()) { - msg = new PluginMsg_UpdateGeometry(instance_id_, window_rect, clip_rect, - transport_store_->handle(), background_store_->handle()); - } else if (transport_store_.get()) { - msg = new PluginMsg_UpdateGeometry(instance_id_, window_rect, clip_rect, - transport_store_->handle(), TransportDIB::DefaultHandleValue()); - } else { - msg = new PluginMsg_UpdateGeometry(instance_id_, window_rect, clip_rect, - TransportDIB::DefaultHandleValue(), TransportDIB::DefaultHandleValue()); + { + msg = new PluginMsg_UpdateGeometry(instance_id_, param); + msg->set_unblock(true); } - msg->set_unblock(true); Send(msg); } @@ -1059,26 +1060,6 @@ WebPluginDelegateProxy::CreateResourceClient( return proxy; } -bool WebPluginDelegateProxy::IsWindowless() const { - NOTREACHED(); - return false; -} - -gfx::Rect WebPluginDelegateProxy::GetRect() const { - NOTREACHED(); - return gfx::Rect(); -} - -gfx::Rect WebPluginDelegateProxy::GetClipRect() const { - NOTREACHED(); - return gfx::Rect(); -} - -int WebPluginDelegateProxy::GetQuirks() const { - NOTREACHED(); - return 0; -} - void WebPluginDelegateProxy::OnCancelDocumentLoad() { plugin_->CancelDocumentLoad(); } |