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