diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-02 17:10:59 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-02 17:10:59 +0000 |
commit | f103ab7a3af66f93aa6b674598ee8c977917f5f2 (patch) | |
tree | 670587d6caf0d0fc0a864f7b8d6e7b8da8f11f6d /webkit/glue/plugins | |
parent | ee2bd0350faae7e862af993b8884d6c9c48559a4 (diff) | |
download | chromium_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 'webkit/glue/plugins')
-rw-r--r-- | webkit/glue/plugins/gtk_plugin_container_manager.cc | 2 | ||||
-rw-r--r-- | webkit/glue/plugins/gtk_plugin_container_manager.h | 5 | ||||
-rw-r--r-- | webkit/glue/plugins/mozilla_extensions.cc | 4 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_instance.h | 13 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_stream.h | 6 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_stream_url.h | 6 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl.cc | 15 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl.h | 28 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl_gtk.cc | 4 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl_mac.mm | 6 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl_win.cc | 6 |
11 files changed, 57 insertions, 38 deletions
diff --git a/webkit/glue/plugins/gtk_plugin_container_manager.cc b/webkit/glue/plugins/gtk_plugin_container_manager.cc index 4683e08..ecde3fb 100644 --- a/webkit/glue/plugins/gtk_plugin_container_manager.cc +++ b/webkit/glue/plugins/gtk_plugin_container_manager.cc @@ -52,7 +52,7 @@ void GtkPluginContainerManager::DestroyPluginContainer( } void GtkPluginContainerManager::MovePluginContainer( - const WebPluginGeometry& move) { + const webkit_glue::WebPluginGeometry& move) { DCHECK(host_widget_); GtkWidget *widget = MapIDToWidget(move.window); if (!widget) diff --git a/webkit/glue/plugins/gtk_plugin_container_manager.h b/webkit/glue/plugins/gtk_plugin_container_manager.h index 30a6b1a..54ce819 100644 --- a/webkit/glue/plugins/gtk_plugin_container_manager.h +++ b/webkit/glue/plugins/gtk_plugin_container_manager.h @@ -11,7 +11,10 @@ #include "base/gfx/native_widget_types.h" typedef struct _GtkWidget GtkWidget; + +namespace webkit_glue { struct WebPluginGeometry; +} // Helper class that creates and manages plugin containers (GtkSocket). class GtkPluginContainerManager { @@ -29,7 +32,7 @@ class GtkPluginContainerManager { // Takes an update from WebKit about a plugin's position and side and moves // the plugin accordingly. - void MovePluginContainer(const WebPluginGeometry& move); + void MovePluginContainer(const webkit_glue::WebPluginGeometry& move); private: // Maps a plugin XID to the corresponding container widget. diff --git a/webkit/glue/plugins/mozilla_extensions.cc b/webkit/glue/plugins/mozilla_extensions.cc index 4b1b46e..2ca0a50 100644 --- a/webkit/glue/plugins/mozilla_extensions.cc +++ b/webkit/glue/plugins/mozilla_extensions.cc @@ -273,7 +273,7 @@ NS_IMETHODIMP MozillaExtensionApi::GetCookie( if (!plugin_instance_) return NS_ERROR_FAILURE; - WebPlugin* webplugin = plugin_instance_->webplugin(); + webkit_glue::WebPlugin* webplugin = plugin_instance_->webplugin(); if (!webplugin) return NS_ERROR_FAILURE; @@ -306,7 +306,7 @@ NS_IMETHODIMP MozillaExtensionApi::SetCookie( if (!plugin_instance_) return NS_ERROR_FAILURE; - WebPlugin* webplugin = plugin_instance_->webplugin(); + webkit_glue::WebPlugin* webplugin = plugin_instance_->webplugin(); if (!webplugin) return NS_ERROR_FAILURE; diff --git a/webkit/glue/plugins/plugin_instance.h b/webkit/glue/plugins/plugin_instance.h index 5639211..352dab5 100644 --- a/webkit/glue/plugins/plugin_instance.h +++ b/webkit/glue/plugins/plugin_instance.h @@ -21,9 +21,12 @@ #include "googleurl/src/gurl.h" #include "third_party/npapi/bindings/npapi.h" -class WebPlugin; class MessageLoop; +namespace webkit_glue { +class WebPlugin; +} + namespace NPAPI { class PluginLib; @@ -88,8 +91,10 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> { void set_transparent(bool value) { transparent_ = value; } // Get/Set the WebPlugin associated with this instance - WebPlugin* webplugin() { return webplugin_; } - void set_web_plugin(WebPlugin* webplugin) { webplugin_ = webplugin; } + webkit_glue::WebPlugin* webplugin() { return webplugin_; } + void set_web_plugin(webkit_glue::WebPlugin* webplugin) { + webplugin_ = webplugin; + } // Get the mimeType for this plugin stream const std::string &mime_type() { return mime_type_; } @@ -225,7 +230,7 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> { gfx::PluginWindowHandle window_handle_; bool windowless_; bool transparent_; - WebPlugin* webplugin_; + webkit_glue::WebPlugin* webplugin_; std::string mime_type_; GURL get_url_; intptr_t get_notify_data_; diff --git a/webkit/glue/plugins/plugin_stream.h b/webkit/glue/plugins/plugin_stream.h index 80b88c56..97bea1c 100644 --- a/webkit/glue/plugins/plugin_stream.h +++ b/webkit/glue/plugins/plugin_stream.h @@ -12,7 +12,9 @@ #include "base/ref_counted.h" #include "third_party/npapi/bindings/npapi.h" +namespace webkit_glue { class WebPluginResourceClient; +} namespace NPAPI { @@ -59,7 +61,9 @@ class PluginStream : public base::RefCounted<PluginStream> { // Close the stream. virtual bool Close(NPReason reason); - virtual WebPluginResourceClient* AsResourceClient() { return NULL; } + virtual webkit_glue::WebPluginResourceClient* AsResourceClient() { + return NULL; + } // Cancels any HTTP requests initiated by the stream. virtual void CancelRequest() {} diff --git a/webkit/glue/plugins/plugin_stream_url.h b/webkit/glue/plugins/plugin_stream_url.h index 1f5fe57..b4a61c3 100644 --- a/webkit/glue/plugins/plugin_stream_url.h +++ b/webkit/glue/plugins/plugin_stream_url.h @@ -16,7 +16,7 @@ class PluginInstance; // A NPAPI Stream based on a URL. class PluginStreamUrl : public PluginStream, - public WebPluginResourceClient { + public webkit_glue::WebPluginResourceClient { public: // Create a new stream for sending to the plugin by fetching // a URL. If notifyNeeded is set, then the plugin will be notified @@ -34,8 +34,8 @@ class PluginStreamUrl : public PluginStream, // it is still loading. virtual bool Close(NPReason reason); - virtual WebPluginResourceClient* AsResourceClient() { - return static_cast<WebPluginResourceClient*>(this); + virtual webkit_glue::WebPluginResourceClient* AsResourceClient() { + return static_cast<webkit_glue::WebPluginResourceClient*>(this); } virtual void CancelRequest(); diff --git a/webkit/glue/plugins/webplugin_delegate_impl.cc b/webkit/glue/plugins/webplugin_delegate_impl.cc index 89285b6..078b6cf 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl.cc @@ -21,6 +21,9 @@ #include "webkit/glue/plugins/plugin_stream_url.h" #include "webkit/glue/webkit_glue.h" +using webkit_glue::WebPlugin; +using webkit_glue::WebPluginDelegate; +using webkit_glue::WebPluginResourceClient; using WebKit::WebCursorInfo; using WebKit::WebKeyboardEvent; using WebKit::WebInputEvent; @@ -30,17 +33,17 @@ WebPluginDelegate* WebPluginDelegate::Create( const FilePath& filename, const std::string& mime_type, gfx::PluginWindowHandle containing_view) { - scoped_refptr<NPAPI::PluginLib> plugin = + scoped_refptr<NPAPI::PluginLib> plugin_lib = NPAPI::PluginLib::CreatePluginLib(filename); - if (plugin.get() == NULL) + if (plugin_lib.get() == NULL) return NULL; - NPError err = plugin->NP_Initialize(); + NPError err = plugin_lib->NP_Initialize(); if (err != NPERR_NO_ERROR) return NULL; scoped_refptr<NPAPI::PluginInstance> instance = - plugin->CreateInstance(mime_type); + plugin_lib->CreateInstance(mime_type); return new WebPluginDelegateImpl(containing_view, instance.get()); } @@ -52,7 +55,7 @@ bool WebPluginDelegateImpl::Initialize(const GURL& url, bool load_manually) { plugin_ = plugin; - instance_->set_web_plugin(plugin); + instance_->set_web_plugin(plugin_); NPAPI::PluginInstance* old_instance = NPAPI::PluginInstance::SetInitializingInstance(instance_); @@ -86,7 +89,7 @@ bool WebPluginDelegateImpl::Initialize(const GURL& url, instance_->set_window_handle(parent_); } - PlatformInitialize(plugin); + PlatformInitialize(); plugin_url_ = url.spec(); diff --git a/webkit/glue/plugins/webplugin_delegate_impl.h b/webkit/glue/plugins/webplugin_delegate_impl.h index 9ecd733..51f3839 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.h +++ b/webkit/glue/plugins/webplugin_delegate_impl.h @@ -29,7 +29,7 @@ class PluginInstance; // An implementation of WebPluginDelegate that proxies all calls to // the plugin process. -class WebPluginDelegateImpl : public WebPluginDelegate { +class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { public: static bool IsPluginDelegateWindow(gfx::NativeWindow window); static bool GetPluginNameFromWindow(gfx::NativeWindow window, @@ -45,7 +45,7 @@ class WebPluginDelegateImpl : public WebPluginDelegate { char** argn, char** argv, int argc, - WebPlugin* plugin, + webkit_glue::WebPlugin* plugin, bool load_manually); virtual void UpdateGeometry(const gfx::Rect& window_rect, const gfx::Rect& clip_rect); @@ -76,15 +76,16 @@ class WebPluginDelegateImpl : public WebPluginDelegate { virtual void DidManualLoadFail(); virtual FilePath GetPluginPath(); virtual void InstallMissingPlugin(); - virtual WebPluginResourceClient* CreateResourceClient(int resource_id, - const GURL& url, - bool notify_needed, - intptr_t notify_data, - intptr_t stream); + virtual webkit_glue::WebPluginResourceClient* CreateResourceClient( + int resource_id, + const GURL& url, + bool notify_needed, + intptr_t notify_data, + intptr_t stream); virtual bool IsWindowless() const { return windowless_ ; } - virtual const gfx::Rect& GetRect() const { return window_rect_; } - virtual const gfx::Rect& GetClipRect() const { return clip_rect_; } + virtual gfx::Rect GetRect() const { return window_rect_; } + virtual gfx::Rect GetClipRect() const { return clip_rect_; } virtual int GetQuirks() const { return quirks_; } #if defined(OS_MACOSX) @@ -100,9 +101,8 @@ class WebPluginDelegateImpl : public WebPluginDelegate { NPAPI::PluginInstance *instance); ~WebPluginDelegateImpl(); - // Called by Initialize(), used for platform-specific initialization - // code. - void PlatformInitialize(WebPlugin* plugin); + // Called by Initialize() for platform-specific initialization. + void PlatformInitialize(); // Called by DestroyInstance(), used for platform-specific destruction. void PlatformDestroyInstance(); @@ -185,7 +185,7 @@ class WebPluginDelegateImpl : public WebPluginDelegate { // used by windowed and windowless plugins bool windowless_; - WebPlugin* plugin_; + webkit_glue::WebPlugin* plugin_; scoped_refptr<NPAPI::PluginInstance> instance_; #if defined(OS_WIN) @@ -308,7 +308,7 @@ class WebPluginDelegateImpl : public WebPluginDelegate { // Holds the current cursor set by the windowless plugin. WebCursor current_windowless_cursor_; - friend class WebPluginDelegate; + friend class webkit_glue::WebPluginDelegate; DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateImpl); }; diff --git a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc index ae169ae..7673699 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc @@ -84,10 +84,10 @@ WebPluginDelegateImpl::~WebPluginDelegateImpl() { } } -void WebPluginDelegateImpl::PlatformInitialize(WebPlugin* plugin) { +void WebPluginDelegateImpl::PlatformInitialize() { gfx::PluginWindowHandle handle = windowless_ ? 0 : gtk_plug_get_id(GTK_PLUG(plug_)); - plugin->SetWindow(handle); + plugin_->SetWindow(handle); } void WebPluginDelegateImpl::PlatformDestroyInstance() { diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm index 485c6af..08e91bc 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm +++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm @@ -26,6 +26,9 @@ #include "webkit/glue/plugins/plugin_stream_url.h" #include "webkit/glue/webkit_glue.h" +using webkit_glue::WebPlugin; +using webkit_glue::WebPluginDelegate; +using webkit_glue::WebPluginResourceClient; using WebKit::WebCursorInfo; using WebKit::WebKeyboardEvent; using WebKit::WebInputEvent; @@ -160,9 +163,10 @@ void WebPluginDelegateImpl::DestroyInstance() { } } -void WebPluginDelegateImpl::PlatformInitialize(WebPlugin* plugin) { +void WebPluginDelegateImpl::PlatformInitialize() { // TODO(port): implement these after unforking. } + void WebPluginDelegateImpl::PlatformDestroyInstance() { // TODO(port): implement these after unforking. } diff --git a/webkit/glue/plugins/webplugin_delegate_impl_win.cc b/webkit/glue/plugins/webplugin_delegate_impl_win.cc index 1a3c091..a36d5fc 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_win.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl_win.cc @@ -245,12 +245,12 @@ void WebPluginDelegateImpl::PluginDestroyed() { } } -void WebPluginDelegateImpl::PlatformInitialize(WebPlugin* plugin) { - plugin->SetWindow(windowed_handle_); +void WebPluginDelegateImpl::PlatformInitialize() { + plugin_->SetWindow(windowed_handle_); if (windowless_) { CreateDummyWindowForActivation(); handle_event_pump_messages_event_ = CreateEvent(NULL, TRUE, FALSE, NULL); - plugin->SetWindowlessPumpEvent(handle_event_pump_messages_event_); + plugin_->SetWindowlessPumpEvent(handle_event_pump_messages_event_); } // The windowless version of the Silverlight plugin calls the |