Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // 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.
| |
| 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 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.
| |
| 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 int instance_id() { return instance_id_; } | |
| 26 | |
| 27 // By default, observers will be deleted when the BrowserPlugin goes away. If | |
| 28 // they want to outlive it, they can override this function. | |
| 29 virtual void OnDestruct(); | |
| 30 | |
| 31 // IPC::Listener implementation. | |
| 32 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
| 33 | |
| 34 // IPC::Sender implementation. | |
| 35 virtual bool Send(IPC::Message* message) OVERRIDE; | |
| 36 | |
| 37 protected: | |
| 38 explicit BrowserPluginObserver(BrowserPlugin* browser_plugin); | |
| 39 virtual ~BrowserPluginObserver(); | |
| 40 | |
| 41 friend class BrowserPluginImpl; | |
| 42 | |
| 43 // This is called by the BrowserPlugin when it's going away so that this | |
| 44 // object can null out its pointer. | |
| 45 void BrowserPluginGone(); | |
| 46 | |
| 47 BrowserPlugin* browser_plugin_; | |
| 48 // The instance ID of the associated BrowserPlugin. | |
| 49 int instance_id_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(BrowserPluginObserver); | |
| 52 }; | |
| 53 | |
| 54 } // namespace content | |
| 55 | |
| 56 #endif // CONTENT_PUBLIC_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_OBSERVER_H_ | |
| OLD | NEW |