Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_MANAGER_H_ | 5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_MANAGER_H_ |
| 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_MANAGER_H_ | 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/id_map.h" | 8 #include "base/id_map.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 12 #include "content/public/renderer/render_view_observer.h" | 12 #include "content/public/renderer/render_view_observer.h" |
| 13 #include "ipc/ipc_sender.h" | 13 #include "ipc/ipc_sender.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class DictionaryValue; | 16 class DictionaryValue; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace blink { | 19 namespace blink { |
| 20 class WebFrame; | 20 class WebFrame; |
| 21 class WebNode; | 21 class WebNode; |
| 22 struct WebPluginParams; | 22 struct WebPluginParams; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace content { | 25 namespace content { |
| 26 | 26 |
| 27 class BrowserPlugin; | 27 class BrowserPlugin; |
| 28 class BrowserPluginDelegate; | |
| 28 class BrowserPluginManagerFactory; | 29 class BrowserPluginManagerFactory; |
| 29 class RenderViewImpl; | 30 class RenderViewImpl; |
| 30 | 31 |
| 31 // BrowserPluginManager manages the routing of messages to the appropriate | 32 // BrowserPluginManager manages the routing of messages to the appropriate |
| 32 // BrowserPlugin object based on its instance ID. | 33 // BrowserPlugin object based on its instance ID. |
| 33 class CONTENT_EXPORT BrowserPluginManager | 34 class CONTENT_EXPORT BrowserPluginManager |
| 34 : public RenderViewObserver, | 35 : public RenderViewObserver, |
| 35 public base::RefCounted<BrowserPluginManager> { | 36 public base::RefCounted<BrowserPluginManager> { |
| 36 public: | 37 public: |
| 37 // Returns the one BrowserPluginManager for this process. | 38 // Returns the one BrowserPluginManager for this process. |
| 38 static BrowserPluginManager* Create(RenderViewImpl* render_view); | 39 static BrowserPluginManager* Create(RenderViewImpl* render_view); |
| 39 | 40 |
| 40 // Overrides factory for testing. Default (NULL) value indicates regular | 41 // Overrides factory for testing. Default (NULL) value indicates regular |
| 41 // (non-test) environment. | 42 // (non-test) environment. |
| 42 static void set_factory_for_testing(BrowserPluginManagerFactory* factory) { | 43 static void set_factory_for_testing(BrowserPluginManagerFactory* factory) { |
| 43 BrowserPluginManager::factory_ = factory; | 44 BrowserPluginManager::factory_ = factory; |
| 44 } | 45 } |
| 45 | 46 |
| 46 explicit BrowserPluginManager(RenderViewImpl* render_view); | 47 explicit BrowserPluginManager(RenderViewImpl* render_view); |
| 47 | 48 |
| 48 // Creates a new BrowserPlugin object. | 49 // Creates a new BrowserPlugin object. |
| 49 // BrowserPlugin is responsible for associating itself with the | 50 // BrowserPlugin is responsible for associating itself with the |
| 50 // BrowserPluginManager via AddBrowserPlugin. When it is destroyed, it is | 51 // BrowserPluginManager via AddBrowserPlugin. When it is destroyed, it is |
| 51 // responsible for removing its association via RemoveBrowserPlugin. | 52 // responsible for removing its association via RemoveBrowserPlugin. |
| 52 virtual BrowserPlugin* CreateBrowserPlugin( | 53 virtual BrowserPlugin* CreateBrowserPlugin( |
| 53 RenderViewImpl* render_view, | 54 RenderViewImpl* render_view, |
| 54 blink::WebFrame* frame, | 55 blink::WebFrame* frame, |
| 55 bool auto_navigate) = 0; | 56 BrowserPluginDelegate* delegate) = 0; |
|
Ken Rockot(use gerrit already)
2014/09/04 00:57:43
Should this also be a scoped_ptr? Ownership transf
lazyboy
2014/09/04 18:59:33
Done.
| |
| 56 | 57 |
| 57 void Attach(int browser_plugin_instance_id); | 58 void Attach(int browser_plugin_instance_id); |
| 58 | 59 |
| 59 void AddBrowserPlugin(int browser_plugin_instance_id, | 60 void AddBrowserPlugin(int browser_plugin_instance_id, |
| 60 BrowserPlugin* browser_plugin); | 61 BrowserPlugin* browser_plugin); |
| 61 void RemoveBrowserPlugin(int browser_plugin_instance_id); | 62 void RemoveBrowserPlugin(int browser_plugin_instance_id); |
| 62 BrowserPlugin* GetBrowserPlugin(int browser_plugin_instance_id) const; | 63 BrowserPlugin* GetBrowserPlugin(int browser_plugin_instance_id) const; |
| 63 | 64 |
| 64 void UpdateDeviceScaleFactor(float device_scale_factor); | 65 void UpdateDeviceScaleFactor(float device_scale_factor); |
| 65 void UpdateFocusState(); | 66 void UpdateFocusState(); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 89 IDMap<BrowserPlugin> instances_; | 90 IDMap<BrowserPlugin> instances_; |
| 90 int current_instance_id_; | 91 int current_instance_id_; |
| 91 base::WeakPtr<RenderViewImpl> render_view_; | 92 base::WeakPtr<RenderViewImpl> render_view_; |
| 92 | 93 |
| 93 DISALLOW_COPY_AND_ASSIGN(BrowserPluginManager); | 94 DISALLOW_COPY_AND_ASSIGN(BrowserPluginManager); |
| 94 }; | 95 }; |
| 95 | 96 |
| 96 } // namespace content | 97 } // namespace content |
| 97 | 98 |
| 98 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_MANAGER_H_ | 99 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_MANAGER_H_ |
| OLD | NEW |