diff options
author | steveblock@chromium.org <steveblock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-22 00:31:08 +0000 |
---|---|---|
committer | steveblock@chromium.org <steveblock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-22 00:31:08 +0000 |
commit | 959a694093db706173cccfec4c1e14717ce370e1 (patch) | |
tree | e891eff65f9bbddbf3fa223d96ed3b6533b15f8c /content/common | |
parent | ec8734c639ff92f98c614e79a9ebfb7ceaa7e113 (diff) | |
download | chromium_src-959a694093db706173cccfec4c1e14717ce370e1.zip chromium_src-959a694093db706173cccfec4c1e14717ce370e1.tar.gz chromium_src-959a694093db706173cccfec4c1e14717ce370e1.tar.bz2 |
Add NPChannelBase::GetModalDialogEvent() to avoid content/plugin/ include from npobject_proxy.cc
This patch adds a new virtual method NPChannelBase::GetModalDialogEvent() to
avoid the need for NPObjectProxy to cast its NPChannelBase to PluginChannel.
Refactoring only, no functional change.
BUG=96703
Review URL: http://codereview.chromium.org/7983032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102212 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common')
-rw-r--r-- | content/common/DEPS | 1 | ||||
-rw-r--r-- | content/common/np_channel_base.cc | 5 | ||||
-rw-r--r-- | content/common/np_channel_base.h | 6 | ||||
-rw-r--r-- | content/common/npobject_proxy.cc | 29 |
4 files changed, 21 insertions, 20 deletions
diff --git a/content/common/DEPS b/content/common/DEPS index f88c66e..4184762 100644 --- a/content/common/DEPS +++ b/content/common/DEPS @@ -1,4 +1,3 @@ include_rules = [ "+media/base/media_log_event.h", - "+content/plugin", # FIXME: For PluginChannel and PluginThread ] diff --git a/content/common/np_channel_base.cc b/content/common/np_channel_base.cc index e5f8f02..4c2b542 100644 --- a/content/common/np_channel_base.cc +++ b/content/common/np_channel_base.cc @@ -110,6 +110,11 @@ NPObjectBase* NPChannelBase::GetNPObjectListenerForRoute(int route_id) { return iter->second; } +base::WaitableEvent* NPChannelBase::GetModalDialogEvent( + gfx::NativeViewId containing_window) { + return NULL; +} + bool NPChannelBase::Init(base::MessageLoopProxy* ipc_message_loop, bool create_pipe_now, base::WaitableEvent* shutdown_event) { diff --git a/content/common/np_channel_base.h b/content/common/np_channel_base.h index 5f0eac5..810cfbe 100644 --- a/content/common/np_channel_base.h +++ b/content/common/np_channel_base.h @@ -100,6 +100,12 @@ class NPChannelBase : public IPC::Channel::Listener, // Returns NULL on failure. NPObjectBase* GetNPObjectListenerForRoute(int route_id); + // Returns the event that's set when a call to the renderer causes a modal + // dialog to come up. The default implementation returns NULL. Derived + // classes should override this method if this functionality is required. + virtual base::WaitableEvent* GetModalDialogEvent( + gfx::NativeViewId containing_window); + protected: typedef NPChannelBase* (*ChannelFactory)(); diff --git a/content/common/npobject_proxy.cc b/content/common/npobject_proxy.cc index 436f61f..4a37611 100644 --- a/content/common/npobject_proxy.cc +++ b/content/common/npobject_proxy.cc @@ -4,9 +4,9 @@ #include "content/common/npobject_proxy.h" +#include "content/common/np_channel_base.h" #include "content/common/npobject_util.h" #include "content/common/plugin_messages.h" -#include "content/plugin/plugin_channel.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" #include "webkit/glue/webkit_glue.h" #include "webkit/plugins/npapi/plugin_instance.h" @@ -207,12 +207,9 @@ bool NPObjectProxy::NPInvokePrivate(NPP npp, // queue while waiting for a reply. We need to do this to simulate what // happens when everything runs in-process (while calling MessageBox window // messages are pumped). - if (IsPluginProcess()) { - PluginChannel* channel = static_cast<PluginChannel*>(proxy->channel_.get()); - if (channel) { - msg->set_pump_messages_event( - channel->GetModalDialogEvent(containing_window)); - } + if (IsPluginProcess() && proxy->channel()) { + msg->set_pump_messages_event( + proxy->channel()->GetModalDialogEvent(containing_window)); } GURL page_url = proxy->page_url_; @@ -430,12 +427,9 @@ bool NPObjectProxy::NPNConstruct(NPObject *obj, proxy->route_id_, args_param, ¶m_result, &result); // See comment in NPObjectProxy::NPInvokePrivate. - if (IsPluginProcess()) { - PluginChannel* channel = static_cast<PluginChannel*>(proxy->channel_.get()); - if (channel) { - msg->set_pump_messages_event( - channel->GetModalDialogEvent(proxy->containing_window_)); - } + if (IsPluginProcess() && proxy->channel()) { + msg->set_pump_messages_event( + proxy->channel()->GetModalDialogEvent(proxy->containing_window_)); } GURL page_url = proxy->page_url_; @@ -483,12 +477,9 @@ bool NPObjectProxy::NPNEvaluate(NPP npp, &result); // See comment in NPObjectProxy::NPInvokePrivate. - if (IsPluginProcess()) { - PluginChannel* channel = static_cast<PluginChannel*>(proxy->channel_.get()); - if (channel) { - msg->set_pump_messages_event( - channel->GetModalDialogEvent(proxy->containing_window_)); - } + if (IsPluginProcess() && proxy->channel()) { + msg->set_pump_messages_event( + proxy->channel()->GetModalDialogEvent(containing_window)); } scoped_refptr<NPChannelBase> channel(proxy->channel_); |