Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Unified Diff: ppapi/host/ppapi_host.cc

Issue 10803050: Hook up the PPB_Flash_Print interface to new host system. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: with deps Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/host/ppapi_host.h ('k') | ppapi/ppapi_host.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/host/ppapi_host.cc
diff --git a/ppapi/host/ppapi_host.cc b/ppapi/host/ppapi_host.cc
index 87545019e1a88abc7927f3ffa54958487d8fc0f4..14a3a4f3860b4fe84933b81f9fa34b99ae6e7131 100644
--- a/ppapi/host/ppapi_host.cc
+++ b/ppapi/host/ppapi_host.cc
@@ -8,6 +8,7 @@
#include "ppapi/c/pp_errors.h"
#include "ppapi/host/host_factory.h"
#include "ppapi/host/host_message_context.h"
+#include "ppapi/host/instance_message_filter.h"
#include "ppapi/host/resource_host.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/resource_message_params.h"
@@ -33,6 +34,10 @@ PpapiHost::PpapiHost(IPC::Sender* sender,
}
PpapiHost::~PpapiHost() {
+ // Delete these explicitly before destruction since then the host is still
+ // technically alive in case one of the filters accesses us from the
+ // destructor.
+ instance_message_filters_.clear();
}
bool PpapiHost::Send(IPC::Message* msg) {
@@ -50,6 +55,16 @@ bool PpapiHost::OnMessageReceived(const IPC::Message& msg) {
OnHostMsgResourceDestroyed)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
+
+ if (!handled) {
+ for (size_t i = 0; i < instance_message_filters_.size(); i++) {
+ if (instance_message_filters_[i]->OnInstanceMessageReceived(msg)) {
+ handled = true;
+ break;
+ }
+ }
+ }
+
return handled;
}
@@ -58,6 +73,12 @@ void PpapiHost::SendReply(const proxy::ResourceMessageReplyParams& params,
Send(new PpapiPluginMsg_ResourceReply(params, msg));
}
+
+void PpapiHost::AddInstanceMessageFilter(
+ scoped_ptr<InstanceMessageFilter> filter) {
+ instance_message_filters_.push_back(filter.release());
+}
+
void PpapiHost::OnHostMsgResourceCall(
const proxy::ResourceMessageCallParams& params,
const IPC::Message& nested_msg) {
@@ -100,8 +121,7 @@ void PpapiHost::OnHostMsgResourceCreated(
return;
scoped_ptr<ResourceHost> resource_host(
- host_factory_->CreateResourceHost(this, params, instance,
- nested_msg));
+ host_factory_->CreateResourceHost(this, params, instance, nested_msg));
if (!resource_host.get()) {
NOTREACHED();
return;
« no previous file with comments | « ppapi/host/ppapi_host.h ('k') | ppapi/ppapi_host.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698