OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_MANAGER_H_ |
| 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_MANAGER_H_ |
| 7 |
| 8 #include "base/id_map.h" |
| 9 #include "base/threading/non_thread_safe.h" |
| 10 #include "content/public/renderer/render_process_observer.h" |
| 11 #include "ipc/ipc_sender.h" |
| 12 |
| 13 class RenderViewImpl; |
| 14 |
| 15 namespace WebKit { |
| 16 class WebFrame; |
| 17 struct WebPluginParams; |
| 18 } |
| 19 |
| 20 namespace content { |
| 21 namespace browser_plugin { |
| 22 |
| 23 class BrowserPlugin; |
| 24 |
| 25 // BrowserPluginManager manages the routing of messages to the appropriate |
| 26 // BrowserPlugin object based on its instance ID. There is only one |
| 27 // BrowserPluginManager per renderer process, and it should only be accessed |
| 28 // by the render thread. |
| 29 class CONTENT_EXPORT BrowserPluginManager : public IPC::Sender, |
| 30 public RenderProcessObserver, |
| 31 public base::NonThreadSafe { |
| 32 public: |
| 33 // Returns the one BrowserPluginManager for this process. |
| 34 static BrowserPluginManager* Get(); |
| 35 |
| 36 BrowserPluginManager(); |
| 37 virtual ~BrowserPluginManager(); |
| 38 |
| 39 // Creates a new BrowserPlugin object with a unique identifier. |
| 40 // BrowserPlugin is responsible for associating itself with the |
| 41 // BrowserPluginManager via AddBrowserPlugin. When it is destroyed, it is |
| 42 // responsible for removing its association via RemoveBrowserPlugin. |
| 43 virtual BrowserPlugin* CreateBrowserPlugin( |
| 44 RenderViewImpl* render_view, |
| 45 WebKit::WebFrame* frame, |
| 46 const WebKit::WebPluginParams& params) = 0; |
| 47 |
| 48 void AddBrowserPlugin(int instance_id, BrowserPlugin* browser_plugin); |
| 49 void RemoveBrowserPlugin(int instance_id); |
| 50 BrowserPlugin* GetBrowserPlugin(int instance_id) const; |
| 51 |
| 52 protected: |
| 53 IDMap<BrowserPlugin> instances_; |
| 54 int browser_plugin_counter_; |
| 55 }; |
| 56 |
| 57 } // namespace browser_plugin |
| 58 } // namespace content |
| 59 |
| 60 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_MANAGER_H_ |
OLD | NEW |