summaryrefslogtreecommitdiffstats
path: root/ppapi/host/ppapi_host.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-15 05:08:38 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-15 05:08:38 +0000
commitb7631cc577c480fa04d0e7f1d4d1b9ffc60b2cdc (patch)
tree7653d8ec53c9f154be07bc7240ad54d0f0f682e6 /ppapi/host/ppapi_host.cc
parenta78f03cf0fb7e2053099bcc4b73d558c9d653ed1 (diff)
downloadchromium_src-b7631cc577c480fa04d0e7f1d4d1b9ffc60b2cdc.zip
chromium_src-b7631cc577c480fa04d0e7f1d4d1b9ffc60b2cdc.tar.gz
chromium_src-b7631cc577c480fa04d0e7f1d4d1b9ffc60b2cdc.tar.bz2
Convert the async device ID getter to a chrome resource host
Review URL: https://codereview.chromium.org/10909138 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156989 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/host/ppapi_host.cc')
-rw-r--r--ppapi/host/ppapi_host.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/ppapi/host/ppapi_host.cc b/ppapi/host/ppapi_host.cc
index 247c781..0ec37b6 100644
--- a/ppapi/host/ppapi_host.cc
+++ b/ppapi/host/ppapi_host.cc
@@ -26,10 +26,8 @@ const size_t kMaxResourcesPerPlugin = 1 << 14;
} // namespace
PpapiHost::PpapiHost(IPC::Sender* sender,
- HostFactory* host_factory,
const PpapiPermissions& perms)
: sender_(sender),
- host_factory_(host_factory),
permissions_(perms) {
}
@@ -73,6 +71,9 @@ void PpapiHost::SendReply(const proxy::ResourceMessageReplyParams& params,
Send(new PpapiPluginMsg_ResourceReply(params, msg));
}
+void PpapiHost::AddHostFactoryFilter(scoped_ptr<HostFactory> filter) {
+ host_factory_filters_.push_back(filter.release());
+}
void PpapiHost::AddInstanceMessageFilter(
scoped_ptr<InstanceMessageFilter> filter) {
@@ -121,8 +122,15 @@ void PpapiHost::OnHostMsgResourceCreated(
if (resources_.size() >= kMaxResourcesPerPlugin)
return;
- scoped_ptr<ResourceHost> resource_host(
- host_factory_->CreateResourceHost(this, params, instance, nested_msg));
+ // Run through all filters until one grabs this message.
+ scoped_ptr<ResourceHost> resource_host;
+ DCHECK(!host_factory_filters_.empty()); // Caller forgot to add a factory.
+ for (size_t i = 0; i < host_factory_filters_.size(); i++) {
+ resource_host = host_factory_filters_[i]->CreateResourceHost(
+ this, params, instance, nested_msg).Pass();
+ if (resource_host.get())
+ break;
+ }
if (!resource_host.get()) {
NOTREACHED();
return;