OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_PUBLIC_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_OBSERVER_H_ |
| 6 #define CONTENT_PUBLIC_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_OBSERVER_H_ |
| 7 |
| 8 #include "base/compiler_specific.h" |
| 9 #include "content/common/content_export.h" |
| 10 #include "ipc/ipc_listener.h" |
| 11 #include "ipc/ipc_sender.h" |
| 12 |
| 13 namespace content { |
| 14 |
| 15 class BrowserPlugin; |
| 16 class BrowserPluginImpl; |
| 17 |
| 18 // Base class for objects that want to filter incoming IPCs. |
| 19 // A BrowserPluginObserver attaches itself to a particular BrowserPlugin. |
| 20 // By default, its lifetime is tied to the BrowserPlugin's lifetime. |
| 21 class CONTENT_EXPORT BrowserPluginObserver : public IPC::Listener, |
| 22 public IPC::Sender { |
| 23 public: |
| 24 BrowserPlugin* browser_plugin() const; |
| 25 |
| 26 // By default, observers will be deleted when the BrowserPlugin goes away. If |
| 27 // they want to outlive it, they can override this function. |
| 28 virtual void OnDestruct(); |
| 29 |
| 30 // IPC::Listener implementation. |
| 31 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 32 |
| 33 // IPC::Sender implementation. |
| 34 virtual bool Send(IPC::Message* message) OVERRIDE; |
| 35 |
| 36 protected: |
| 37 explicit BrowserPluginObserver(BrowserPlugin* browser_plugin); |
| 38 virtual ~BrowserPluginObserver(); |
| 39 |
| 40 friend class BrowserPluginImpl; |
| 41 |
| 42 // This is called by the BrowserPlugin when it's going away so that this |
| 43 // object can null out its pointer. |
| 44 void BrowserPluginGone(); |
| 45 |
| 46 BrowserPlugin* browser_plugin_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(BrowserPluginObserver); |
| 49 }; |
| 50 |
| 51 } // namespace content |
| 52 |
| 53 #endif // CONTENT_PUBLIC_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_OBSERVER_H_ |
OLD | NEW |