Index: content/public/renderer/browser_plugin/browser_plugin_observer.h |
diff --git a/content/public/renderer/browser_plugin/browser_plugin_observer.h b/content/public/renderer/browser_plugin/browser_plugin_observer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fd05874ee69fb2b38f1ee0c3b36983a82fe54cca |
--- /dev/null |
+++ b/content/public/renderer/browser_plugin/browser_plugin_observer.h |
@@ -0,0 +1,53 @@ |
+// Copyright (c) 2013 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 CONTENT_PUBLIC_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_OBSERVER_H_ |
+#define CONTENT_PUBLIC_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_OBSERVER_H_ |
+ |
+#include "base/compiler_specific.h" |
+#include "content/common/content_export.h" |
+#include "ipc/ipc_listener.h" |
+#include "ipc/ipc_sender.h" |
+ |
+namespace content { |
+ |
+class BrowserPlugin; |
+class BrowserPluginImpl; |
+ |
+// Base class for objects that want to filter incoming IPCs. |
+// A BrowserPluginObserver attaches itself to a particular BrowserPlugin. |
+// By default, its lifetime is tied to the BrowserPlugin's lifetime. |
+class CONTENT_EXPORT BrowserPluginObserver : public IPC::Listener, |
+ public IPC::Sender { |
+ public: |
+ BrowserPlugin* browser_plugin() const; |
+ |
+ // By default, observers will be deleted when the BrowserPlugin goes away. If |
+ // they want to outlive it, they can override this function. |
+ virtual void OnDestruct(); |
+ |
+ // IPC::Listener implementation. |
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
+ |
+ // IPC::Sender implementation. |
+ virtual bool Send(IPC::Message* message) OVERRIDE; |
+ |
+ protected: |
+ explicit BrowserPluginObserver(BrowserPlugin* browser_plugin); |
+ virtual ~BrowserPluginObserver(); |
+ |
+ friend class BrowserPluginImpl; |
+ |
+ // This is called by the BrowserPlugin when it's going away so that this |
+ // object can null out its pointer. |
+ void BrowserPluginGone(); |
+ |
+ BrowserPlugin* browser_plugin_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BrowserPluginObserver); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_PUBLIC_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_OBSERVER_H_ |