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

Unified Diff: ppapi/host/instance_message_filter.h

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: 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
Index: ppapi/host/instance_message_filter.h
diff --git a/ppapi/host/instance_message_filter.h b/ppapi/host/instance_message_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..2392b6c65328a9ae8e0be861cad3cbea3c698a18
--- /dev/null
+++ b/ppapi/host/instance_message_filter.h
@@ -0,0 +1,54 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_HOST_INSTANCE_MESSAGE_FILTER_H_
+#define PPAPI_HOST_INSTANCE_MESSAGE_FILTER_H_
+
+#include "base/basictypes.h"
+#include "ppapi/host/ppapi_host_export.h"
+
+namespace IPC {
+class Message;
+}
+
+namespace ppapi {
+namespace host {
+
+class PpapiHost;
+
+class PPAPI_HOST_EXPORT InstanceMessageFilter {
+ public:
+ // Invoked when the PpapiHost is being destroyed. Gives subclasses a chance
+ // to cleanup. At the time this is invoked, host() returns NULL. It is safe
+ // to |delete this| from this function.
+ virtual void PpapiHostDestroyed(PpapiHost* host) {}
+
+ // Processes an instance message from the plugin process. Returns true if the
+ // message was handled. On false, the PpapiHost will forward the message to
+ // the next filter.
+ virtual bool OnInstanceMessageReceived(const IPC::Message& msg) = 0;
+
+ // Will return NULL if the host is destroyed.
+ PpapiHost* host() { return host_; }
+
+ protected:
+ explicit InstanceMessageFilter(PpapiHost* host);
+ virtual ~InstanceMessageFilter();
+
+ private:
+ friend class PpapiHost;
+
+ // Invoked by PpapiHost when the host is destroyed. Nulls out host_ and calls
+ // PpapiHostDestroyed().
+ void CallPpapiHostDestroyed();
dmichael (off chromium) 2012/07/25 16:57:27 nit: Since it does a little more than call PpapiHo
+
+ PpapiHost* host_;
+
+ DISALLOW_COPY_AND_ASSIGN(InstanceMessageFilter);
+};
+
+} // namespace host
+} // namespace ppapi
+
+#endif // PPAPI_HOST_INSTANCE_MESSAGE_FILTER_H_

Powered by Google App Engine
This is Rietveld 408576698