Chromium Code Reviews| Index: content/browser/renderer_host/pepper/browser_ppapi_host_impl.cc |
| =================================================================== |
| --- content/browser/renderer_host/pepper/browser_ppapi_host_impl.cc (revision 166155) |
| +++ content/browser/renderer_host/pepper/browser_ppapi_host_impl.cc (working copy) |
| @@ -3,6 +3,7 @@ |
| // found in the LICENSE file. |
| #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" |
| +#include "content/browser/renderer_host/pepper/pepper_message_filter.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "content/public/browser/render_view_host.h" |
| @@ -10,11 +11,34 @@ |
| namespace content { |
| +// static |
| +CONTENT_EXPORT BrowserPpapiHost* BrowserPpapiHost::CreateExternalPluginProcess( |
| + IPC::Sender* sender, |
|
brettw
2012/11/07 00:18:11
Nit: should only be indented 4 spaces.
bbudge
2012/11/07 00:51:46
Done.
|
| + ppapi::PpapiPermissions permissions, |
| + base::ProcessHandle plugin_child_process, |
| + IPC::ChannelProxy* channel, |
| + net::HostResolver* host_resolver, |
| + int render_process_id, |
| + int render_view_id) { |
| + BrowserPpapiHostImpl* browser_ppapi_host = |
| + new BrowserPpapiHostImpl(sender, permissions); |
| + browser_ppapi_host->set_plugin_process_handle(plugin_child_process); |
| + |
| + channel->AddFilter( |
| + new PepperMessageFilter(PepperMessageFilter::NACL, |
| + host_resolver, |
| + render_process_id, |
| + render_view_id)); |
| + |
| + return browser_ppapi_host; |
| +} |
| + |
| BrowserPpapiHostImpl::BrowserPpapiHostImpl( |
| IPC::Sender* sender, |
| const ppapi::PpapiPermissions& permissions) |
| : ppapi_host_(sender, permissions), |
| plugin_process_handle_(base::kNullProcessHandle) { |
| + message_filter_ = new HostMessageFilter(&ppapi_host_); |
| ppapi_host_.AddHostFactoryFilter(scoped_ptr<ppapi::host::HostFactory>( |
| new ContentBrowserPepperHostFactory(this))); |
| } |
| @@ -22,18 +46,6 @@ |
| BrowserPpapiHostImpl::~BrowserPpapiHostImpl() { |
| } |
| -bool BrowserPpapiHostImpl::OnMessageReceived(const IPC::Message& msg) { |
| - /* TODO(brettw) when we add messages, here, the code should look like this: |
| - bool handled = true; |
| - IPC_BEGIN_MESSAGE_MAP(BrowserPpapiHostImpl, msg) |
| - // Add necessary message handlers here. |
| - IPC_MESSAGE_UNHANDLED(handled = ppapi_host_.OnMessageReceived(msg)) |
| - IPC_END_MESSAGE_MAP(); |
| - return handled; |
| - */ |
| - return ppapi_host_.OnMessageReceived(msg); |
| -} |
| - |
| ppapi::host::PpapiHost* BrowserPpapiHostImpl::GetPpapiHost() { |
| return &ppapi_host_; |
| } |
| @@ -84,4 +96,17 @@ |
| instance_to_view_.erase(found); |
| } |
| +bool BrowserPpapiHostImpl::HostMessageFilter::OnMessageReceived( |
| + const IPC::Message& msg) { |
| + /* TODO(brettw) when we add messages, here, the code should look like this: |
| + bool handled = true; |
| + IPC_BEGIN_MESSAGE_MAP(BrowserPpapiHostImpl, msg) |
| + // Add necessary message handlers here. |
| + IPC_MESSAGE_UNHANDLED(handled = ppapi_host_->OnMessageReceived(msg)) |
| + IPC_END_MESSAGE_MAP(); |
| + return handled; |
| + */ |
| + return ppapi_host_->OnMessageReceived(msg); |
|
brettw
2012/11/07 00:18:11
Don't forget to null check this when you add the n
bbudge
2012/11/07 00:51:46
Done.
|
| +} |
| + |
| } // namespace content |