Index: content/browser/plugin_process_host.cc |
=================================================================== |
--- content/browser/plugin_process_host.cc (revision 118420) |
+++ content/browser/plugin_process_host.cc (working copy) |
@@ -21,6 +21,7 @@ |
#include "base/path_service.h" |
#include "base/string_util.h" |
#include "base/utf_string_conversions.h" |
+#include "content/browser/browser_child_process_host.h" |
#include "content/browser/plugin_service_impl.h" |
#include "content/common/child_process_host_impl.h" |
#include "content/common/plugin_messages.h" |
@@ -36,6 +37,7 @@ |
#include "ui/gfx/native_widget_types.h" |
using content::BrowserThread; |
+using content::ChildProcessData; |
using content::ChildProcessHost; |
#if defined(USE_X11) |
@@ -91,7 +93,7 @@ |
// Reparent only from the plugin process to our process. |
DWORD process_id = 0; |
::GetWindowThreadProcessId(window, &process_id); |
- if (process_id != ::GetProcessId(GetChildProcessHandle())) |
+ if (process_id != ::GetProcessId(process_->GetHandle())) |
return; |
::GetWindowThreadProcessId(parent, &process_id); |
if (process_id != ::GetCurrentProcessId()) |
@@ -114,11 +116,12 @@ |
#endif // defined(TOOLKIT_USES_GTK) |
PluginProcessHost::PluginProcessHost() |
- : BrowserChildProcessHost(content::PROCESS_TYPE_PLUGIN) |
#if defined(OS_MACOSX) |
- , plugin_cursor_visible_(true) |
+ : plugin_cursor_visible_(true) |
#endif |
{ |
+ process_.reset(new BrowserChildProcessHost( |
+ content::PROCESS_TYPE_PLUGIN, this)); |
} |
PluginProcessHost::~PluginProcessHost() { |
@@ -164,11 +167,15 @@ |
CancelRequests(); |
} |
+bool PluginProcessHost::Send(IPC::Message* message) { |
+ return process_->Send(message); |
+} |
+ |
bool PluginProcessHost::Init(const webkit::WebPluginInfo& info) { |
info_ = info; |
- SetName(info_.name); |
+ process_->SetName(info_.name); |
- std::string channel_id = child_process_host()->CreateChannel(); |
+ std::string channel_id = process_->GetHost()->CreateChannel(); |
if (channel_id.empty()) |
return false; |
@@ -258,7 +265,7 @@ |
#endif |
#endif |
- Launch( |
+ process_->Launch( |
#if defined(OS_WIN) |
FilePath(), |
#elif defined(OS_POSIX) |
@@ -271,7 +278,7 @@ |
// called on the plugin. The plugin process exits when it receives the |
// OnChannelError notification indicating that the browser plugin channel has |
// been destroyed. |
- SetTerminateChildOnShutdown(false); |
+ process_->SetTerminateChildOnShutdown(false); |
content::GetContentClient()->browser()->PluginProcessHostCreated(this); |
@@ -281,11 +288,11 @@ |
void PluginProcessHost::ForceShutdown() { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
Send(new PluginProcessMsg_NotifyRenderersOfPendingShutdown()); |
- BrowserChildProcessHost::ForceShutdown(); |
+ process_->ForceShutdown(); |
} |
void PluginProcessHost::AddFilter(IPC::ChannelProxy::MessageFilter* filter) { |
- child_process_host()->AddFilter(filter); |
+ process_->GetHost()->AddFilter(filter); |
} |
bool PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { |
@@ -320,7 +327,6 @@ |
} |
void PluginProcessHost::OnChannelConnected(int32 peer_pid) { |
- BrowserChildProcessHost::OnChannelConnected(peer_pid); |
for (size_t i = 0; i < pending_requests_.size(); ++i) { |
RequestPluginChannel(pending_requests_[i]); |
} |
@@ -352,9 +358,8 @@ |
// static |
void PluginProcessHost::CancelPendingRequestsForResourceContext( |
const content::ResourceContext* context) { |
- for (BrowserChildProcessHost::Iterator host_it(content::PROCESS_TYPE_PLUGIN); |
- !host_it.Done(); ++host_it) { |
- PluginProcessHost* host = static_cast<PluginProcessHost*>(*host_it); |
+ for (PluginProcessHostIterator host_it; !host_it.Done(); ++host_it) { |
+ PluginProcessHost* host = *host_it; |
for (size_t i = 0; i < host->pending_requests_.size(); ++i) { |
if (&host->pending_requests_[i]->GetResourceContext() == context) { |
host->pending_requests_[i]->OnError(); |
@@ -366,9 +371,9 @@ |
} |
void PluginProcessHost::OpenChannelToPlugin(Client* client) { |
- Notify(content::NOTIFICATION_CHILD_INSTANCE_CREATED); |
+ process_->Notify(content::NOTIFICATION_CHILD_INSTANCE_CREATED); |
client->SetPluginInfo(info_); |
- if (child_process_host()->IsChannelOpening()) { |
+ if (process_->GetHost()->IsChannelOpening()) { |
// The channel is already in the process of being opened. Put |
// this "open channel" request into a queue of requests that will |
// be run once the channel is open. |