summaryrefslogtreecommitdiffstats
path: root/chrome/plugin
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-02 17:10:59 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-02 17:10:59 +0000
commitf103ab7a3af66f93aa6b674598ee8c977917f5f2 (patch)
tree670587d6caf0d0fc0a864f7b8d6e7b8da8f11f6d /chrome/plugin
parentee2bd0350faae7e862af993b8884d6c9c48559a4 (diff)
downloadchromium_src-f103ab7a3af66f93aa6b674598ee8c977917f5f2.zip
chromium_src-f103ab7a3af66f93aa6b674598ee8c977917f5f2.tar.gz
chromium_src-f103ab7a3af66f93aa6b674598ee8c977917f5f2.tar.bz2
Eliminate remaining WebCore dependencies from webplugin_impl.cc
Introduces WebPluginPageDelegate to hold the methods that only existed on WebViewDelegate to allow WebPluginImpl to talk to the RenderView. This enables us to eliminate those methods from WebViewDelegate, which eliminates the last dependency on gfx/ native_widget_types.h in our WebKit interface! WebViewDelegate grows a CreatePlugin method that returns a WebKit::WebPlugin. It loses its CreatePluginDelegate method, which now lives on WebPluginPageDelegate. This change makes RenderView use WeakPtr when it hands itself to each WebPluginDelegateProxy and WebPluginImpl instance. This makes the memory management simpler. This change also moves various WebPlugin* interfaces defined in webkit/glue into the webkit_glue namespace. This was to help reduce confusion with similarly named types in the WebKit namespace. WebKit::WebPluginParams is added to contain the set of parameters used to construct a plugin. WebPluginContainer gets a couple more methods to allow us to avoid WebCore dependencies in WebPluginImpl. R=jam BUG=10036 TEST=none Review URL: http://codereview.chromium.org/181014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25184 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin')
-rw-r--r--chrome/plugin/webplugin_delegate_stub.cc16
-rw-r--r--chrome/plugin/webplugin_delegate_stub.h7
-rw-r--r--chrome/plugin/webplugin_proxy.cc5
-rw-r--r--chrome/plugin/webplugin_proxy.h20
4 files changed, 31 insertions, 17 deletions
diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc
index fda6909..65bdfdc 100644
--- a/chrome/plugin/webplugin_delegate_stub.cc
+++ b/chrome/plugin/webplugin_delegate_stub.cc
@@ -25,6 +25,9 @@
using WebKit::WebBindings;
using WebKit::WebCursorInfo;
+using webkit_glue::WebPlugin;
+using webkit_glue::WebPluginDelegate;
+using webkit_glue::WebPluginResourceClient;
class FinishDestructionTask : public Task {
public:
@@ -152,15 +155,16 @@ void WebPluginDelegateStub::OnInit(const PluginMsg_Init_Params& params,
// PluginThread::current()->Send(new PluginProcessHostMsg_MapNativeViewId(
// params.containing_window, &parent));
#endif
- delegate_ = WebPluginDelegate::Create(path, mime_type_, parent);
- if (delegate_) {
- webplugin_ = new WebPluginProxy(
- channel_, instance_id_, delegate_, page_url_);
+ webplugin_ = new WebPluginProxy(channel_, instance_id_, page_url_);
#if defined(OS_WIN)
- if (!webplugin_->SetModalDialogEvent(params.modal_dialog_event))
- return;
+ if (!webplugin_->SetModalDialogEvent(params.modal_dialog_event))
+ return;
#endif
+
+ delegate_ = WebPluginDelegate::Create(path, mime_type_, parent);
+ if (delegate_) {
+ webplugin_->set_delegate(delegate_);
*result = delegate_->Initialize(
params.url, argn, argv, argc, webplugin_, params.load_manually);
}
diff --git a/chrome/plugin/webplugin_delegate_stub.h b/chrome/plugin/webplugin_delegate_stub.h
index d0c6542..34cde08 100644
--- a/chrome/plugin/webplugin_delegate_stub.h
+++ b/chrome/plugin/webplugin_delegate_stub.h
@@ -18,7 +18,6 @@
class PluginChannel;
class WebPluginProxy;
-class WebPluginDelegate;
struct PluginMsg_Init_Params;
struct PluginMsg_DidReceiveResponseParams;
struct PluginMsg_URLRequestReply_Params;
@@ -28,6 +27,10 @@ namespace WebKit {
class WebInputEvent;
}
+namespace webkit_glue {
+class WebPluginDelegate;
+}
+
// Converts the IPC messages from WebPluginDelegateProxy into calls to the
// actual WebPluginDelegate object.
class WebPluginDelegateStub : public IPC::Channel::Listener,
@@ -99,7 +102,7 @@ class WebPluginDelegateStub : public IPC::Channel::Listener,
scoped_refptr<PluginChannel> channel_;
- WebPluginDelegate* delegate_;
+ webkit_glue::WebPluginDelegate* 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 1684785..739fc74 100644
--- a/chrome/plugin/webplugin_proxy.cc
+++ b/chrome/plugin/webplugin_proxy.cc
@@ -34,6 +34,8 @@
#endif
using WebKit::WebBindings;
+using webkit_glue::WebPluginDelegate;
+using webkit_glue::WebPluginResourceClient;
typedef std::map<CPBrowsingContext, WebPluginProxy*> ContextMap;
static ContextMap& GetContextMap() {
@@ -43,14 +45,13 @@ static ContextMap& GetContextMap() {
WebPluginProxy::WebPluginProxy(
PluginChannel* channel,
int route_id,
- WebPluginDelegate* delegate,
const GURL& page_url)
: channel_(channel),
route_id_(route_id),
cp_browsing_context_(0),
window_npobject_(NULL),
plugin_element_(NULL),
- delegate_(delegate),
+ delegate_(NULL),
waiting_for_paint_(false),
page_url_(page_url),
ALLOW_THIS_IN_INITIALIZER_LIST(runnable_method_factory_(this))
diff --git a/chrome/plugin/webplugin_proxy.h b/chrome/plugin/webplugin_proxy.h
index 8e13638..6297f24 100644
--- a/chrome/plugin/webplugin_proxy.h
+++ b/chrome/plugin/webplugin_proxy.h
@@ -22,25 +22,29 @@
#include "ipc/ipc_message.h"
#include "webkit/glue/webplugin.h"
+class PluginChannel;
+
namespace base {
class WaitableEvent;
}
-class PluginChannel;
+namespace webkit_glue {
class WebPluginDelegate;
+}
// This is an implementation of WebPlugin that proxies all calls to the
// renderer.
-class WebPluginProxy : public WebPlugin {
+class WebPluginProxy : public webkit_glue::WebPlugin {
public:
// Creates a new proxy for WebPlugin, using the given sender to send the
// marshalled WebPlugin calls.
WebPluginProxy(PluginChannel* channel,
int route_id,
- WebPluginDelegate* delegate,
const GURL& page_url);
~WebPluginProxy();
+ void set_delegate(webkit_glue::WebPluginDelegate* d) { delegate_ = d; }
+
// WebPlugin overrides
void SetWindow(gfx::PluginWindowHandle window);
void WillDestroyWindow(gfx::PluginWindowHandle window);
@@ -83,7 +87,7 @@ class WebPluginProxy : public WebPlugin {
// Returns a WebPluginResourceClient object given its id, or NULL if no
// object with that id exists.
- WebPluginResourceClient* GetResourceClient(int id);
+ webkit_glue::WebPluginResourceClient* GetResourceClient(int id);
// Returns the process id of the renderer that contains this plugin.
int GetRendererProcessId();
@@ -122,7 +126,8 @@ class WebPluginProxy : public WebPlugin {
bool IsOffTheRecord();
- void ResourceClientDeleted(WebPluginResourceClient* resource_client);
+ void ResourceClientDeleted(
+ webkit_glue::WebPluginResourceClient* resource_client);
base::WaitableEvent* modal_dialog_event() {
return modal_dialog_event_.get();
@@ -151,7 +156,8 @@ class WebPluginProxy : public WebPlugin {
// transform of the local HDC.
void UpdateTransform();
- typedef base::hash_map<int, WebPluginResourceClient*> ResourceClientMap;
+ typedef base::hash_map<int, webkit_glue::WebPluginResourceClient*>
+ ResourceClientMap;
ResourceClientMap resource_clients_;
scoped_refptr<PluginChannel> channel_;
@@ -159,7 +165,7 @@ class WebPluginProxy : public WebPlugin {
uint32 cp_browsing_context_;
NPObject* window_npobject_;
NPObject* plugin_element_;
- WebPluginDelegate* delegate_;
+ webkit_glue::WebPluginDelegate* delegate_;
gfx::Rect damaged_rect_;
bool waiting_for_paint_;
scoped_ptr<base::WaitableEvent> modal_dialog_event_;