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..3f6275d493d30ecfe30e1e9687ee6a97d1877820 |
--- /dev/null |
+++ b/content/public/renderer/browser_plugin/browser_plugin_observer.h |
@@ -0,0 +1,56 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
Charlie Reis
2013/02/28 02:12:03
2013 for new files.
Fady Samuel
2013/02/28 22:56:21
Done.
|
+// 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 taht want to filter incoming IPCs. |
Charlie Reis
2013/02/28 02:12:03
nit: that
I'm a bit surprised that this is about
Fady Samuel
2013/02/28 22:56:21
Fixed nit.
|
+// 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; |
+ int instance_id() { return instance_id_; } |
+ |
+ // 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_; |
+ // The instance ID of the associated BrowserPlugin. |
+ int instance_id_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BrowserPluginObserver); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_PUBLIC_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_OBSERVER_H_ |