summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/plugin_process_host.cc13
-rw-r--r--chrome/browser/plugin_process_host.h2
-rw-r--r--chrome/browser/plugin_service.cc7
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.cc8
-rw-r--r--chrome/common/plugin_messages.h42
-rw-r--r--chrome/common/plugin_messages_internal.h16
-rw-r--r--chrome/common/render_messages_internal.h2
-rw-r--r--chrome/plugin/webplugin_delegate_stub.cc39
-rw-r--r--chrome/plugin/webplugin_delegate_stub.h12
-rw-r--r--chrome/plugin/webplugin_proxy.cc4
-rw-r--r--chrome/plugin/webplugin_proxy.h8
-rw-r--r--chrome/renderer/render_view.cc7
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.cc97
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.h27
-rw-r--r--webkit/default_plugin/plugins2.xml17
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl.cc31
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl.h27
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl_mac.mm23
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl_win.cc3
-rw-r--r--webkit/glue/webplugin_delegate.h36
-rw-r--r--webkit/glue/webplugin_impl.cc46
-rw-r--r--webkit/glue/webplugin_impl.h5
22 files changed, 232 insertions, 240 deletions
diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc
index 4bb2924..49bbba4 100644
--- a/chrome/browser/plugin_process_host.cc
+++ b/chrome/browser/plugin_process_host.cc
@@ -495,7 +495,7 @@ void PluginProcessHost::OnChannelError() {
for (size_t i = 0; i < pending_requests_.size(); ++i) {
ReplyToRenderer(pending_requests_[i].renderer_message_filter_.get(),
IPC::ChannelHandle(),
- FilePath(),
+ WebPluginInfo(),
pending_requests_[i].reply_msg);
}
@@ -573,10 +573,9 @@ void PluginProcessHost::OnResolveProxyCompleted(IPC::Message* reply_msg,
void PluginProcessHost::ReplyToRenderer(
ResourceMessageFilter* renderer_message_filter,
const IPC::ChannelHandle& channel,
- const FilePath& plugin_path,
+ const WebPluginInfo& info,
IPC::Message* reply_msg) {
- ViewHostMsg_OpenChannelToPlugin::WriteReplyParams(reply_msg, channel,
- plugin_path);
+ ViewHostMsg_OpenChannelToPlugin::WriteReplyParams(reply_msg, channel, info);
renderer_message_filter->Send(reply_msg);
}
@@ -602,7 +601,9 @@ void PluginProcessHost::RequestPluginChannel(
sent_requests_.push(ChannelRequest(
renderer_message_filter, mime_type, reply_msg));
} else {
- ReplyToRenderer(renderer_message_filter, IPC::ChannelHandle(), FilePath(),
+ ReplyToRenderer(renderer_message_filter,
+ IPC::ChannelHandle(),
+ WebPluginInfo(),
reply_msg);
}
}
@@ -613,7 +614,7 @@ void PluginProcessHost::OnChannelCreated(
ReplyToRenderer(request.renderer_message_filter_.get(),
channel_handle,
- info_.path,
+ info_,
request.reply_msg);
sent_requests_.pop();
}
diff --git a/chrome/browser/plugin_process_host.h b/chrome/browser/plugin_process_host.h
index cf526b4..7b5c6c1 100644
--- a/chrome/browser/plugin_process_host.h
+++ b/chrome/browser/plugin_process_host.h
@@ -67,7 +67,7 @@ class PluginProcessHost : public ChildProcessHost,
// channel name.
static void ReplyToRenderer(ResourceMessageFilter* renderer_message_filter,
const IPC::ChannelHandle& channel,
- const FilePath& plugin_path,
+ const WebPluginInfo& info,
IPC::Message* reply_msg);
// This function is called on the IO thread once we receive a reply from the
diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc
index a3335f1..ac36b16 100644
--- a/chrome/browser/plugin_service.cc
+++ b/chrome/browser/plugin_service.cc
@@ -141,11 +141,6 @@ PluginProcessHost* PluginService::FindOrStartPluginProcess(
}
return plugin_host;
-
- // TODO(jabdelmalek): adding a new channel means we can have one less
- // renderer process (since each child process uses one handle in the
- // IPC thread and main thread's WaitForMultipleObjects call). Limit the
- // number of plugin processes.
}
void PluginService::OpenChannelToPlugin(
@@ -164,7 +159,7 @@ void PluginService::OpenChannelToPlugin(
} else {
PluginProcessHost::ReplyToRenderer(renderer_msg_filter,
IPC::ChannelHandle(),
- FilePath(),
+ WebPluginInfo(),
reply_msg);
}
}
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
index b211f67..fa3f0a1 100644
--- a/chrome/browser/renderer_host/resource_message_filter.cc
+++ b/chrome/browser/renderer_host/resource_message_filter.cc
@@ -549,8 +549,8 @@ void ResourceMessageFilter::OnGetPluginPath(const GURL& url,
const std::string& clsid,
FilePath* filename,
std::string* url_mime_type) {
- *filename = plugin_service_->GetPluginPath(url, policy_url, mime_type, clsid,
- url_mime_type);
+ *filename = plugin_service_->GetPluginPath(
+ url, policy_url, mime_type, clsid, url_mime_type);
}
void ResourceMessageFilter::OnOpenChannelToPlugin(const GURL& url,
@@ -558,8 +558,8 @@ void ResourceMessageFilter::OnOpenChannelToPlugin(const GURL& url,
const std::string& clsid,
const std::wstring& locale,
IPC::Message* reply_msg) {
- plugin_service_->OpenChannelToPlugin(this, url, mime_type, clsid,
- locale, reply_msg);
+ plugin_service_->OpenChannelToPlugin(
+ this, url, mime_type, clsid, locale, reply_msg);
}
void ResourceMessageFilter::OnCreateDedicatedWorker(const GURL& url,
diff --git a/chrome/common/plugin_messages.h b/chrome/common/plugin_messages.h
index 662f60a..142450c 100644
--- a/chrome/common/plugin_messages.h
+++ b/chrome/common/plugin_messages.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -102,6 +102,13 @@ struct NPVariant_Param {
intptr_t npobject_pointer;
};
+struct PluginMsg_UpdateGeometry_Param {
+ gfx::Rect window_rect;
+ gfx::Rect clip_rect;
+ TransportDIB::Handle windowless_buffer;
+ TransportDIB::Handle background_buffer;
+};
+
namespace IPC {
@@ -407,6 +414,39 @@ struct ParamTraits<NPVariant_Param> {
}
};
+// For windowless plugins, windowless_buffer
+// contains a buffer that the plugin draws into. background_buffer is used
+// for transparent windowless plugins, and holds the background of the plugin
+// rectangle.
+template <>
+struct ParamTraits<PluginMsg_UpdateGeometry_Param> {
+ typedef PluginMsg_UpdateGeometry_Param param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.window_rect);
+ WriteParam(m, p.clip_rect);
+ WriteParam(m, p.windowless_buffer);
+ WriteParam(m, p.background_buffer);
+ }
+ static bool Read(const Message* m, void** iter, param_type* r) {
+ return
+ ReadParam(m, iter, &r->window_rect) &&
+ ReadParam(m, iter, &r->clip_rect) &&
+ ReadParam(m, iter, &r->windowless_buffer) &&
+ ReadParam(m, iter, &r->background_buffer);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.window_rect, l);
+ l->append(L", ");
+ LogParam(p.clip_rect, l);
+ l->append(L", ");
+ LogParam(p.windowless_buffer, l);
+ l->append(L", ");
+ LogParam(p.background_buffer, l);
+ l->append(L")");
+ }
+};
+
} // namespace IPC
diff --git a/chrome/common/plugin_messages_internal.h b/chrome/common/plugin_messages_internal.h
index 7b7ce74..795ee61 100644
--- a/chrome/common/plugin_messages_internal.h
+++ b/chrome/common/plugin_messages_internal.h
@@ -165,15 +165,13 @@ IPC_BEGIN_MESSAGES(Plugin)
int /* reason */,
intptr_t /* notify_data */)
- // Updates the plugin location. For windowless plugins, windowless_buffer
- // contains a buffer that the plugin draws into. background_buffer is used
- // for transparent windowless plugins, and holds the background of the plugin
- // rectangle.
- IPC_MESSAGE_ROUTED4(PluginMsg_UpdateGeometry,
- gfx::Rect /* window_rect */,
- gfx::Rect /* clip_rect */,
- TransportDIB::Handle /* windowless_buffer */,
- TransportDIB::Handle /* background_buffer */)
+ // Updates the plugin location.
+ IPC_MESSAGE_ROUTED1(PluginMsg_UpdateGeometry,
+ PluginMsg_UpdateGeometry_Param)
+
+ // A synchronous version of above.
+ IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_UpdateGeometrySync,
+ PluginMsg_UpdateGeometry_Param)
IPC_SYNC_MESSAGE_ROUTED0_0(PluginMsg_SetFocus)
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 4b74407..a624b47 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -1024,7 +1024,7 @@ IPC_BEGIN_MESSAGES(ViewHost)
std::string /* clsid */,
std::wstring /* locale */,
IPC::ChannelHandle /* handle to channel */,
- FilePath /* plugin_path */)
+ WebPluginInfo /* info */)
#if defined(OS_LINUX)
// A renderer sends this when it needs a browser-side widget for
diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc
index 65bdfdc..cf2c689 100644
--- a/chrome/plugin/webplugin_delegate_stub.cc
+++ b/chrome/plugin/webplugin_delegate_stub.cc
@@ -20,18 +20,17 @@
#include "skia/ext/platform_device.h"
#include "webkit/api/public/WebBindings.h"
#include "webkit/api/public/WebCursorInfo.h"
+#include "webkit/glue/plugins/webplugin_delegate_impl.h"
#include "webkit/glue/webcursor.h"
-#include "webkit/glue/webplugin_delegate.h"
using WebKit::WebBindings;
using WebKit::WebCursorInfo;
using webkit_glue::WebPlugin;
-using webkit_glue::WebPluginDelegate;
using webkit_glue::WebPluginResourceClient;
class FinishDestructionTask : public Task {
public:
- FinishDestructionTask(WebPluginDelegate* delegate, WebPlugin* webplugin)
+ FinishDestructionTask(WebPluginDelegateImpl* delegate, WebPlugin* webplugin)
: delegate_(delegate), webplugin_(webplugin) { }
void Run() {
@@ -43,7 +42,7 @@ class FinishDestructionTask : public Task {
}
private:
- WebPluginDelegate* delegate_;
+ WebPluginDelegateImpl* delegate_;
WebPlugin* webplugin_;
};
@@ -99,6 +98,7 @@ void WebPluginDelegateStub::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(PluginMsg_GetPluginScriptableObject,
OnGetPluginScriptableObject)
IPC_MESSAGE_HANDLER(PluginMsg_UpdateGeometry, OnUpdateGeometry)
+ IPC_MESSAGE_HANDLER(PluginMsg_UpdateGeometrySync, OnUpdateGeometry)
IPC_MESSAGE_HANDLER(PluginMsg_SendJavaScriptStream,
OnSendJavaScriptStream)
IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualResponse,
@@ -126,19 +126,11 @@ void WebPluginDelegateStub::OnInit(const PluginMsg_Init_Params& params,
child_process_logging::ScopedActiveURLSetter url_setter(page_url_);
*result = false;
- int argc = static_cast<int>(params.arg_names.size());
- if (argc != static_cast<int>(params.arg_values.size())) {
+ if (params.arg_names.size() != params.arg_values.size()) {
NOTREACHED();
return;
}
- char **argn = new char*[argc];
- char **argv = new char*[argc];
- for (int i = 0; i < argc; ++i) {
- argn[i] = const_cast<char*>(params.arg_names[i].c_str());
- argv[i] = const_cast<char*>(params.arg_values[i].c_str());
- }
-
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
FilePath path = FilePath::FromWStringHack(
command_line.GetSwitchValue(switches::kPluginPath));
@@ -162,15 +154,15 @@ void WebPluginDelegateStub::OnInit(const PluginMsg_Init_Params& params,
return;
#endif
- delegate_ = WebPluginDelegate::Create(path, mime_type_, parent);
+ delegate_ = WebPluginDelegateImpl::Create(path, mime_type_, parent);
if (delegate_) {
webplugin_->set_delegate(delegate_);
- *result = delegate_->Initialize(
- params.url, argn, argv, argc, webplugin_, params.load_manually);
+ *result = delegate_->Initialize(params.url,
+ params.arg_names,
+ params.arg_values,
+ webplugin_,
+ params.load_manually);
}
-
- delete[] argn;
- delete[] argv;
}
void WebPluginDelegateStub::OnWillSendRequest(int id, const GURL& url) {
@@ -278,13 +270,10 @@ void WebPluginDelegateStub::OnPrint(base::SharedMemoryHandle* shared_memory,
}
void WebPluginDelegateStub::OnUpdateGeometry(
- const gfx::Rect& window_rect,
- const gfx::Rect& clip_rect,
- const TransportDIB::Handle& windowless_buffer,
- const TransportDIB::Handle& background_buffer) {
+ const PluginMsg_UpdateGeometry_Param& param) {
webplugin_->UpdateGeometry(
- window_rect, clip_rect,
- windowless_buffer, background_buffer);
+ param.window_rect, param.clip_rect,
+ param.windowless_buffer, param.background_buffer);
}
void WebPluginDelegateStub::OnGetPluginScriptableObject(int* route_id,
diff --git a/chrome/plugin/webplugin_delegate_stub.h b/chrome/plugin/webplugin_delegate_stub.h
index 34cde08..9ad63d20 100644
--- a/chrome/plugin/webplugin_delegate_stub.h
+++ b/chrome/plugin/webplugin_delegate_stub.h
@@ -20,6 +20,7 @@ class PluginChannel;
class WebPluginProxy;
struct PluginMsg_Init_Params;
struct PluginMsg_DidReceiveResponseParams;
+struct PluginMsg_UpdateGeometry_Param;
struct PluginMsg_URLRequestReply_Params;
class WebCursor;
@@ -27,9 +28,7 @@ namespace WebKit {
class WebInputEvent;
}
-namespace webkit_glue {
-class WebPluginDelegate;
-}
+class WebPluginDelegateImpl;
// Converts the IPC messages from WebPluginDelegateProxy into calls to the
// actual WebPluginDelegate object.
@@ -72,10 +71,7 @@ class WebPluginDelegateStub : public IPC::Channel::Listener,
void OnPrint(base::SharedMemoryHandle* shared_memory, size_t* size);
- void OnUpdateGeometry(const gfx::Rect& window_rect,
- const gfx::Rect& clip_rect,
- const TransportDIB::Handle& windowless_buffer,
- const TransportDIB::Handle& background_buffer);
+ void OnUpdateGeometry(const PluginMsg_UpdateGeometry_Param& param);
void OnGetPluginScriptableObject(int* route_id, intptr_t* npobject_ptr);
void OnSendJavaScriptStream(const GURL& url,
const std::string& result,
@@ -102,7 +98,7 @@ class WebPluginDelegateStub : public IPC::Channel::Listener,
scoped_refptr<PluginChannel> channel_;
- webkit_glue::WebPluginDelegate* delegate_;
+ WebPluginDelegateImpl* delegate_;
WebPluginProxy* webplugin_;
// The url of the main frame hosting the plugin.
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc
index f2f5090..721a39e 100644
--- a/chrome/plugin/webplugin_proxy.cc
+++ b/chrome/plugin/webplugin_proxy.cc
@@ -30,14 +30,12 @@
#include "skia/ext/platform_device.h"
#include "webkit/api/public/WebBindings.h"
#include "webkit/glue/plugins/webplugin_delegate_impl.h"
-#include "webkit/glue/webplugin_delegate.h"
#if defined(OS_WIN)
#include "base/gfx/gdi_util.h"
#endif
using WebKit::WebBindings;
-using webkit_glue::WebPluginDelegate;
using webkit_glue::WebPluginResourceClient;
typedef std::map<CPBrowsingContext, WebPluginProxy*> ContextMap;
@@ -310,7 +308,7 @@ void WebPluginProxy::HandleURLRequest(const char *method,
// Please refer to https://bugzilla.mozilla.org/show_bug.cgi?id=366082
// for more details on this.
if (delegate_->GetQuirks() &
- WebPluginDelegate::PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS) {
+ WebPluginDelegateImpl::PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS) {
GURL request_url(url);
if (!request_url.SchemeIs(chrome::kHttpScheme) &&
!request_url.SchemeIs(chrome::kHttpsScheme) &&
diff --git a/chrome/plugin/webplugin_proxy.h b/chrome/plugin/webplugin_proxy.h
index 6297f24..62b01ef 100644
--- a/chrome/plugin/webplugin_proxy.h
+++ b/chrome/plugin/webplugin_proxy.h
@@ -28,9 +28,7 @@ namespace base {
class WaitableEvent;
}
-namespace webkit_glue {
-class WebPluginDelegate;
-}
+class WebPluginDelegateImpl;
// This is an implementation of WebPlugin that proxies all calls to the
// renderer.
@@ -43,7 +41,7 @@ class WebPluginProxy : public webkit_glue::WebPlugin {
const GURL& page_url);
~WebPluginProxy();
- void set_delegate(webkit_glue::WebPluginDelegate* d) { delegate_ = d; }
+ void set_delegate(WebPluginDelegateImpl* d) { delegate_ = d; }
// WebPlugin overrides
void SetWindow(gfx::PluginWindowHandle window);
@@ -165,7 +163,7 @@ class WebPluginProxy : public webkit_glue::WebPlugin {
uint32 cp_browsing_context_;
NPObject* window_npobject_;
NPObject* plugin_element_;
- webkit_glue::WebPluginDelegate* delegate_;
+ WebPluginDelegateImpl* delegate_;
gfx::Rect damaged_rect_;
bool waiting_for_paint_;
scoped_ptr<base::WaitableEvent> modal_dialog_event_;
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index d857123..d67e818 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -81,13 +81,13 @@
#include "webkit/glue/media/simple_data_source.h"
#include "webkit/glue/password_form.h"
#include "webkit/glue/plugins/plugin_list.h"
+#include "webkit/glue/plugins/webplugin_delegate_impl.h"
#include "webkit/glue/searchable_form_data.h"
#include "webkit/glue/webaccessibilitymanager_impl.h"
#include "webkit/glue/webdevtoolsagent_delegate.h"
#include "webkit/glue/webdropdata.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/webmediaplayer_impl.h"
-#include "webkit/glue/webplugin_delegate.h"
#include "webkit/glue/webplugin_impl.h"
#include "webkit/glue/webview.h"
@@ -2135,7 +2135,7 @@ webkit_glue::WebPluginDelegate* RenderView::CreatePluginDelegate(
if (RenderProcess::current()->in_process_plugins()) {
#if defined(OS_WIN) // In-proc plugins aren't supported on Linux or Mac.
- return webkit_glue::WebPluginDelegate::Create(
+ return WebPluginDelegateImpl::Create(
path, *mime_type_to_use, gfx::NativeViewFromId(host_window_));
#else
NOTIMPLEMENTED();
@@ -2143,8 +2143,7 @@ webkit_glue::WebPluginDelegate* RenderView::CreatePluginDelegate(
#endif
}
- return WebPluginDelegateProxy::Create(
- url, *mime_type_to_use, clsid, AsWeakPtr());
+ return new WebPluginDelegateProxy(*mime_type_to_use, clsid, AsWeakPtr());
}
void RenderView::CreatedPluginWindow(gfx::PluginWindowHandle window) {
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();
}
diff --git a/chrome/renderer/webplugin_delegate_proxy.h b/chrome/renderer/webplugin_delegate_proxy.h
index 45ffb8d..a9cfab8 100644
--- a/chrome/renderer/webplugin_delegate_proxy.h
+++ b/chrome/renderer/webplugin_delegate_proxy.h
@@ -19,6 +19,7 @@
#include "ipc/ipc_message.h"
#include "skia/ext/platform_canvas.h"
#include "webkit/glue/webplugin.h"
+#include "webkit/glue/webplugininfo.h"
#include "webkit/glue/webplugin_delegate.h"
struct NPObject;
@@ -41,19 +42,20 @@ class WebPluginDelegateProxy :
public IPC::Message::Sender,
public base::SupportsWeakPtr<WebPluginDelegateProxy> {
public:
- static WebPluginDelegateProxy* Create(
- const GURL& url,
- const std::string& mime_type,
- const std::string& clsid,
- const base::WeakPtr<RenderView>& render_view);
+ WebPluginDelegateProxy(const std::string& mime_type,
+ const std::string& clsid,
+ const base::WeakPtr<RenderView>& render_view);
// Called to drop our pointer to the window script object.
void DropWindowScriptObject() { window_script_object_ = NULL; }
// WebPluginDelegate implementation:
virtual void PluginDestroyed();
- virtual bool Initialize(const GURL& url, char** argn, char** argv, int argc,
- webkit_glue::WebPlugin* plugin, bool load_manually);
+ virtual bool 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);
virtual void UpdateGeometry(const gfx::Rect& window_rect,
const gfx::Rect& clip_rect);
virtual void Paint(gfx::NativeDrawingContext context, const gfx::Rect& rect);
@@ -86,7 +88,6 @@ class WebPluginDelegateProxy :
virtual void DidReceiveManualData(const char* buffer, int length);
virtual void DidFinishManualLoading();
virtual void DidManualLoadFail();
- virtual FilePath GetPluginPath();
virtual void InstallMissingPlugin();
virtual webkit_glue::WebPluginResourceClient* CreateResourceClient(
int resource_id,
@@ -94,20 +95,12 @@ class WebPluginDelegateProxy :
bool notify_needed,
intptr_t notify_data,
intptr_t existing_stream);
- virtual bool IsWindowless() const;
- virtual gfx::Rect GetRect() const;
- virtual gfx::Rect GetClipRect() const;
- virtual int GetQuirks() const;
protected:
template<class WebPluginDelegateProxy> friend class DeleteTask;
~WebPluginDelegateProxy();
private:
- WebPluginDelegateProxy(const std::string& mime_type,
- const std::string& clsid,
- const base::WeakPtr<RenderView>& render_view);
-
// Message handlers for messages that proxy WebPlugin methods, which
// we translate into calls to the real WebPlugin.
void OnSetWindow(gfx::PluginWindowHandle window);
@@ -175,7 +168,7 @@ class WebPluginDelegateProxy :
std::string mime_type_;
std::string clsid_;
int instance_id_;
- FilePath plugin_path_;
+ WebPluginInfo info_;
gfx::Rect plugin_rect_;
diff --git a/webkit/default_plugin/plugins2.xml b/webkit/default_plugin/plugins2.xml
index 7188119..472a04b 100644
--- a/webkit/default_plugin/plugins2.xml
+++ b/webkit/default_plugin/plugins2.xml
@@ -10,36 +10,43 @@
<plugin>
<mime_types>audio/x-pn-realaudio-plugin;audio/x-pn-realaudio;audio/vnd.rn-realaudio;video/vnd.rn-realvideo</mime_types>
<lang>en-us</lang>
- <name>Real player</name>
+ <name>RealPlayer</name>
<url>http://software-dl.real.com/free/windows/installer/R41R02F/RealPlayer11GOLD.exe</url>
</plugin>
<plugin>
<mime_types>application/x-shockwave-flash;application/futuresplash</mime_types>
<lang>en-us</lang>
- <name>Adobe Flash Movie</name>
+ <name>Adobe Flash Player</name>
<url>http://fpdownload.adobe.com/get/flashplayer/current/install_flash_player.exe</url>
</plugin>
<plugin>
<mime_types>application/x-director</mime_types>
<lang>en-us</lang>
- <name>Adobe Shockwave Movie</name>
+ <name>Adobe Shockwave Player</name>
<url>http://fpdownload.macromedia.com/get/shockwave/default/english/win95nt/latest/Shockwave_Installer_Slim.exe</url>
</plugin>
<plugin>
<mime_types>application/pdf;application/vnd.adobe.x-mars;application/vnd.fdf;application/vnd.adobe.xfdf;application/vnd.adobe.xdp+xml;application/vnd.adobe.xfd+xml;</mime_types>
<lang>en-us</lang>
- <name>Adobe Acrobat</name>
+ <name>Adobe Reader</name>
<url>http://ardownload.adobe.com/pub/adobe/reader/win/9.x/9.1/enu/AdbeRdr910_en_US.exe</url>
</plugin>
<plugin>
<mime_types>video/quicktime;application/sdp;application/x-sdp;application/x-rtsp;video/flc;audio/x-wav;audio/wav;audio/aiff;audio/x-aiff;audio/basic;audio/mid;audio/x-midi;audio/midi;audio/vnd.qcelp;audio/x-gsm;audio/amr;audio/aac;audio/x-aac;audio/x-caf;audio/ac3;audio/x-ac3;video/x-mpeg;video/mpeg;audio/mpeg;audio/x-mpeg;video/3ggp;audio/3ggp;video/3ggp2;audio/3ggp2;video/sd-video;application/x-mpeg;video/mp4;audio/mp4;audio/x-m4a;audio/x-m4p;audio/x-m4b;video/x-m4v;image/x-macpaint;image/pict;image/x-pict;image/png;image/x-png;image/x-quicktime;image/x-sgi;image/x-targa;image/jp2;image/jpeg2000;image/jpeg2000-image;image/x-jpeg2000-image</mime_types>
<lang>en-us</lang>
- <name>Quicktime player</name>
+ <name>QuickTime Player</name>
<url>http://appldnld.apple.com.edgesuite.net/content.info.apple.com/QuickTime/061-6118.20090601.Pq3V9/QuickTimeInstaller.exe</url>
</plugin>
+ <plugin>
+ <mime_types>application/x-ms-wmp;application/asx;video/x-ms-asf-plugin;application/x-mplayer2;video/x-ms-asf;video/x-ms-wm;audio/x-ms-wma;audio/x-ms-wax;video/x-ms-wmv;video/x-ms-wvx</mime_types>
+ <lang>en-us</lang>
+ <name>Windows Media Player Plugin</name>
+ <url>http://port25.technet.com/videos/downloads/wmpfirefoxplugin.exe</url>
+ </plugin>
+
</plugins> \ No newline at end of file
diff --git a/webkit/glue/plugins/webplugin_delegate_impl.cc b/webkit/glue/plugins/webplugin_delegate_impl.cc
index 078b6cf..4cb45ec 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl.cc
+++ b/webkit/glue/plugins/webplugin_delegate_impl.cc
@@ -10,6 +10,7 @@
#include "base/file_util.h"
#include "base/message_loop.h"
#include "base/process_util.h"
+#include "base/scoped_ptr.h"
#include "base/stats_counters.h"
#include "base/string_util.h"
#include "webkit/api/public/WebInputEvent.h"
@@ -29,7 +30,7 @@ using WebKit::WebKeyboardEvent;
using WebKit::WebInputEvent;
using WebKit::WebMouseEvent;
-WebPluginDelegate* WebPluginDelegate::Create(
+WebPluginDelegateImpl* WebPluginDelegateImpl::Create(
const FilePath& filename,
const std::string& mime_type,
gfx::PluginWindowHandle containing_view) {
@@ -47,12 +48,12 @@ WebPluginDelegate* WebPluginDelegate::Create(
return new WebPluginDelegateImpl(containing_view, instance.get());
}
-bool WebPluginDelegateImpl::Initialize(const GURL& url,
- char** argn,
- char** argv,
- int argc,
- WebPlugin* plugin,
- bool load_manually) {
+bool WebPluginDelegateImpl::Initialize(
+ const GURL& url,
+ const std::vector<std::string>& arg_names,
+ const std::vector<std::string>& arg_values,
+ WebPlugin* plugin,
+ bool load_manually) {
plugin_ = plugin;
instance_->set_web_plugin(plugin_);
@@ -69,7 +70,21 @@ bool WebPluginDelegateImpl::Initialize(const GURL& url,
if (quirks_ & PLUGIN_QUIRK_DIE_AFTER_UNLOAD)
webkit_glue::SetForcefullyTerminatePluginProcess(true);
- bool start_result = instance_->Start(url, argn, argv, argc, load_manually);
+ int argc = 0;
+ scoped_array<char*> argn(new char*[arg_names.size()]);
+ scoped_array<char*> argv(new char*[arg_names.size()]);
+ for (size_t i = 0; i < arg_names.size(); ++i) {
+ if (quirks_ & PLUGIN_QUIRK_NO_WINDOWLESS &&
+ LowerCaseEqualsASCII(arg_names[i], "windowlessvideo")) {
+ continue;
+ }
+ argn[argc] = const_cast<char*>(arg_names[i].c_str());
+ argv[argc] = const_cast<char*>(arg_values[i].c_str());
+ argc++;
+ }
+
+ bool start_result = instance_->Start(
+ url, argn.get(), argv.get(), argc, load_manually);
NPAPI::PluginInstance::SetInitializingInstance(old_instance);
diff --git a/webkit/glue/plugins/webplugin_delegate_impl.h b/webkit/glue/plugins/webplugin_delegate_impl.h
index 51f3839..1ceb8f5 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl.h
+++ b/webkit/glue/plugins/webplugin_delegate_impl.h
@@ -31,6 +31,24 @@ class PluginInstance;
// the plugin process.
class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate {
public:
+ enum PluginQuirks {
+ PLUGIN_QUIRK_SETWINDOW_TWICE = 1, // Win32
+ PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE = 2, // Win32
+ PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY = 4, // Win32
+ PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY = 8, // Win32
+ PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES = 16, // Win32
+ PLUGIN_QUIRK_DIE_AFTER_UNLOAD = 32, // Win32
+ PLUGIN_QUIRK_PATCH_SETCURSOR = 64, // Win32
+ PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS = 128, // Win32
+ PLUGIN_QUIRK_WINDOWLESS_OFFSET_WINDOW_TO_DRAW = 256, // Linux
+ PLUGIN_QUIRK_WINDOWLESS_INVALIDATE_AFTER_SET_WINDOW = 512, // Linux
+ PLUGIN_QUIRK_NO_WINDOWLESS = 1024, // Windows
+ };
+
+ static WebPluginDelegateImpl* Create(const FilePath& filename,
+ const std::string& mime_type,
+ gfx::PluginWindowHandle containing_view);
+
static bool IsPluginDelegateWindow(gfx::NativeWindow window);
static bool GetPluginNameFromWindow(gfx::NativeWindow window,
std::wstring *plugin_name);
@@ -42,9 +60,8 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate {
// WebPluginDelegate implementation
virtual void PluginDestroyed();
virtual bool Initialize(const GURL& url,
- char** argn,
- char** argv,
- int argc,
+ const std::vector<std::string>& arg_names,
+ const std::vector<std::string>& arg_values,
webkit_glue::WebPlugin* plugin,
bool load_manually);
virtual void UpdateGeometry(const gfx::Rect& window_rect,
@@ -86,7 +103,9 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate {
virtual bool IsWindowless() const { return windowless_ ; }
virtual gfx::Rect GetRect() const { return window_rect_; }
virtual gfx::Rect GetClipRect() const { return clip_rect_; }
- virtual int GetQuirks() const { return quirks_; }
+
+ // Returns a combination of PluginQuirks.
+ int GetQuirks() const { return quirks_; }
#if defined(OS_MACOSX)
// Informs the delegate that the context used for painting windowless plugins
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
index 08e91bc..826f60c 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
+++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
@@ -12,6 +12,7 @@
#include "base/file_util.h"
#include "base/lazy_instance.h"
#include "base/message_loop.h"
+#include "base/scoped_ptr.h"
#include "base/stats_counters.h"
#include "base/string_util.h"
#include "webkit/api/public/WebInputEvent.h"
@@ -64,7 +65,7 @@ int g_current_y_offset = 0;
} // namespace
-WebPluginDelegate* WebPluginDelegate::Create(
+WebPluginDelegateImpl* WebPluginDelegateImpl::Create(
const FilePath& filename,
const std::string& mime_type,
gfx::PluginWindowHandle containing_view) {
@@ -112,9 +113,8 @@ void WebPluginDelegateImpl::PluginDestroyed() {
}
bool WebPluginDelegateImpl::Initialize(const GURL& url,
- char** argn,
- char** argv,
- int argc,
+ const std::vector<std::string>& arg_names,
+ const std::vector<std::string>& arg_values,
WebPlugin* plugin,
bool load_manually) {
plugin_ = plugin;
@@ -123,8 +123,21 @@ bool WebPluginDelegateImpl::Initialize(const GURL& url,
NPAPI::PluginInstance* old_instance =
NPAPI::PluginInstance::SetInitializingInstance(instance_);
+ int argc = 0;
+ scoped_array<char*> argn(new char*[arg_names.size()]);
+ scoped_array<char*> argv(new char*[arg_names.size()]);
+ for (size_t i = 0; i < arg_names.size(); ++i) {
+ if (quirks_ & PLUGIN_QUIRK_NO_WINDOWLESS &&
+ LowerCaseEqualsASCII(arg_names[i], "windowlessvideo")) {
+ continue;
+ }
+ argn[argc] = const_cast<char*>(arg_names[i].c_str());
+ argv[argc] = const_cast<char*>(arg_values[i].c_str());
+ argc++;
+ }
- bool start_result = instance_->Start(url, argn, argv, argc, load_manually);
+ bool start_result = instance_->Start(
+ url, argn.get(), argv.get(), argc, load_manually);
NPAPI::PluginInstance::SetInitializingInstance(old_instance);
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_win.cc b/webkit/glue/plugins/webplugin_delegate_impl_win.cc
index a36d5fc..a1e1b18 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl_win.cc
+++ b/webkit/glue/plugins/webplugin_delegate_impl_win.cc
@@ -203,6 +203,9 @@ WebPluginDelegateImpl::WebPluginDelegateImpl(
std::wstring::npos) {
// Windows Media Player needs two NPP_SetWindow calls.
quirks_ |= PLUGIN_QUIRK_SETWINDOW_TWICE;
+
+ // Windowless mode doesn't work in the WMP NPAPI plugin.
+ quirks_ |= PLUGIN_QUIRK_NO_WINDOWLESS;
} else if (instance_->mime_type() == "audio/x-pn-realaudio-plugin" ||
filename == "nppl3260.dll") {
quirks_ |= PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY;
diff --git a/webkit/glue/webplugin_delegate.h b/webkit/glue/webplugin_delegate.h
index de83954..e56157b 100644
--- a/webkit/glue/webplugin_delegate.h
+++ b/webkit/glue/webplugin_delegate.h
@@ -32,25 +32,8 @@ class WebPluginResourceClient;
// This is the interface that a plugin implementation needs to provide.
class WebPluginDelegate {
public:
- enum PluginQuirks {
- PLUGIN_QUIRK_SETWINDOW_TWICE = 1, // Win32
- PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE = 2, // Win32
- PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY = 4, // Win32
- PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY = 8, // Win32
- PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES = 16, // Win32
- PLUGIN_QUIRK_DIE_AFTER_UNLOAD = 32, // Win32
- PLUGIN_QUIRK_PATCH_SETCURSOR = 64, // Win32
- PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS = 128, // Win32
- PLUGIN_QUIRK_WINDOWLESS_OFFSET_WINDOW_TO_DRAW = 256, // Linux
- PLUGIN_QUIRK_WINDOWLESS_INVALIDATE_AFTER_SET_WINDOW = 512, // Linux
- };
-
virtual ~WebPluginDelegate() {}
- static WebPluginDelegate* Create(const FilePath& filename,
- const std::string& mime_type,
- gfx::PluginWindowHandle containing_view);
-
// Initializes the plugin implementation with the given (UTF8) arguments.
// Note that the lifetime of WebPlugin must be longer than this delegate.
// If this function returns false the plugin isn't started and shouldn't be
@@ -60,8 +43,11 @@ class WebPluginDelegate {
// be passed from webkit. if false indicates that the plugin should download
// the data. This also controls whether the plugin is instantiated as a full
// page plugin (NP_FULL) or embedded (NP_EMBED).
- virtual bool Initialize(const GURL& url, char** argn, char** argv, int argc,
- WebPlugin* plugin, bool load_manually) = 0;
+ virtual bool Initialize(const GURL& url,
+ const std::vector<std::string>& arg_names,
+ const std::vector<std::string>& arg_values,
+ WebPlugin* plugin,
+ bool load_manually) = 0;
// Called when the WebPlugin is being destroyed. This is a signal to the
// delegate that it should tear-down the plugin implementation and not call
@@ -126,9 +112,6 @@ class WebPluginDelegate {
// Indicates a failure in data receipt.
virtual void DidManualLoadFail() = 0;
- // Only available after Initialize is called.
- virtual FilePath GetPluginPath() = 0;
-
// Only supported when the plugin is the default plugin.
virtual void InstallMissingPlugin() = 0;
@@ -138,15 +121,6 @@ class WebPluginDelegate {
bool notify_needed,
intptr_t notify_data,
intptr_t stream) = 0;
-
- virtual bool IsWindowless() const = 0;
-
- virtual gfx::Rect GetRect() const = 0;
-
- virtual gfx::Rect GetClipRect() const = 0;
-
- // Returns a combination of PluginQuirks.
- virtual int GetQuirks() const = 0;
};
} // namespace webkit_glue
diff --git a/webkit/glue/webplugin_impl.cc b/webkit/glue/webplugin_impl.cc
index 54576a6..fec69bd 100644
--- a/webkit/glue/webplugin_impl.cc
+++ b/webkit/glue/webplugin_impl.cc
@@ -197,30 +197,6 @@ void GetResponseInfo(const WebURLResponse& response,
}
}
-// Utility function to convert a vector to an array of char*'s.
-// Caller is responsible to free memory with DeleteArray().
-static char** ToArray(const WebVector<WebString>& input) {
- char** array = new char*[input.size() + 1];
- size_t index;
- for (index = 0; index < input.size(); ++index) {
- const WebCString& src = input[index].utf8();
- array[index] = new char[src.length() + 1];
- base::strlcpy(array[index], src.data(), src.length() + 1);
- array[index][src.length()] = '\0';
- }
- array[index] = 0;
- return array;
-}
-
-static void DeleteArray(char** array) {
- char** ptr = array;
- while (*ptr) {
- delete[] *ptr;
- ++ptr;
- }
- delete[] array;
-}
-
} // namespace
// WebKit::WebPlugin ----------------------------------------------------------
@@ -234,9 +210,9 @@ bool WebPluginImpl::initialize(WebPluginContainer* container) {
#if defined(OS_WIN)
std::string clsid, version;
if (activex_shim::IsMimeTypeActiveX(mime_type_)) {
- for (size_t i = 0; i < arg_count_; i++) {
- const char* param_name = arg_names_[i];
- const char* param_value = arg_values_[i];
+ for (size_t i = 0; i < arg_names_.size(); i++) {
+ const char* param_name = arg_names_[i].c_str();
+ const char* param_value = arg_values_[i].c_str();
if (base::strcasecmp(param_name, "classid") == 0) {
activex_shim::GetClsidFromClassidAttribute(param_value, &clsid);
} else if (base::strcasecmp(param_name, "codebase") == 0) {
@@ -265,7 +241,7 @@ bool WebPluginImpl::initialize(WebPluginContainer* container) {
return NULL;
bool ok = plugin_delegate->Initialize(
- plugin_url_, arg_names_, arg_values_, arg_count_, this, load_manually_);
+ plugin_url_, arg_names_, arg_values_, this, load_manually_);
if (!ok) {
plugin_delegate->PluginDestroyed();
return false;
@@ -437,19 +413,17 @@ WebPluginImpl::WebPluginImpl(
first_geometry_update_(true),
ignore_response_error_(false),
mime_type_(params.mimeType.utf8()),
- arg_names_(ToArray(params.attributeNames)),
- arg_values_(ToArray(params.attributeValues)),
- arg_count_(params.attributeNames.size()),
ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
DCHECK_EQ(params.attributeNames.size(), params.attributeValues.size());
StringToLowerASCII(&mime_type_);
+
+ for (size_t i = 0; i < params.attributeNames.size(); ++i) {
+ arg_names_.push_back(params.attributeNames[i].utf8());
+ arg_values_.push_back(params.attributeValues[i].utf8());
+ }
}
WebPluginImpl::~WebPluginImpl() {
- if (arg_names_)
- DeleteArray(arg_names_);
- if (arg_values_)
- DeleteArray(arg_values_);
}
void WebPluginImpl::SetWindow(gfx::PluginWindowHandle window) {
@@ -1053,7 +1027,7 @@ bool WebPluginImpl::ReinitializePluginForResponse(
plugin_url_, mime_type_, std::string(), &actual_mime_type);
bool ok = plugin_delegate->Initialize(
- plugin_url_, arg_names_, arg_values_, arg_count_, this, load_manually_);
+ plugin_url_, arg_names_, arg_values_, this, load_manually_);
if (!ok) {
container_ = NULL;
diff --git a/webkit/glue/webplugin_impl.h b/webkit/glue/webplugin_impl.h
index 07e043c..44133b2 100644
--- a/webkit/glue/webplugin_impl.h
+++ b/webkit/glue/webplugin_impl.h
@@ -268,9 +268,8 @@ class WebPluginImpl : public WebPlugin,
// Holds the list of argument names and values passed to the plugin. We keep
// these so that we can re-initialize the plugin if we need to.
- char** arg_names_;
- char** arg_values_;
- size_t arg_count_;
+ std::vector<std::string> arg_names_;
+ std::vector<std::string> arg_values_;
ScopedRunnableMethodFactory<WebPluginImpl> method_factory_;