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" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 void Attach(int browser_plugin_instance_id); | 44 void Attach(int browser_plugin_instance_id); |
45 | 45 |
46 void AddBrowserPlugin(int browser_plugin_instance_id, | 46 void AddBrowserPlugin(int browser_plugin_instance_id, |
47 BrowserPlugin* browser_plugin); | 47 BrowserPlugin* browser_plugin); |
48 void RemoveBrowserPlugin(int browser_plugin_instance_id); | 48 void RemoveBrowserPlugin(int browser_plugin_instance_id); |
49 BrowserPlugin* GetBrowserPlugin(int browser_plugin_instance_id) const; | 49 BrowserPlugin* GetBrowserPlugin(int browser_plugin_instance_id) const; |
50 | 50 |
51 void UpdateDeviceScaleFactor(); | 51 void UpdateDeviceScaleFactor(); |
52 void UpdateFocusState(); | 52 void UpdateFocusState(); |
53 RenderViewImpl* render_view() const { return render_view_.get(); } | 53 RenderViewImpl* render_view() const { return render_view_.get(); } |
| 54 |
| 55 // Returns a new instance ID to be used by BrowserPlugin. Instance IDs are |
| 56 // unique per process. |
54 int GetNextInstanceID(); | 57 int GetNextInstanceID(); |
55 | 58 |
56 // RenderViewObserver override. Call on render thread. | 59 // RenderViewObserver override. Call on render thread. |
57 void DidCommitCompositorFrame() override; | 60 void DidCommitCompositorFrame() override; |
58 bool OnMessageReceived(const IPC::Message& message) override; | 61 bool OnMessageReceived(const IPC::Message& message) override; |
59 bool Send(IPC::Message* msg) override; | 62 bool Send(IPC::Message* msg) override; |
60 | 63 |
61 // Don't destroy the BrowserPluginManager when the RenderViewImpl goes away. | 64 // Don't destroy the BrowserPluginManager when the RenderViewImpl goes away. |
62 // BrowserPluginManager's lifetime is managed by a reference count. Once | 65 // BrowserPluginManager's lifetime is managed by a reference count. Once |
63 // the host RenderViewImpl and all BrowserPlugins release their references, | 66 // the host RenderViewImpl and all BrowserPlugins release their references, |
64 // then the BrowserPluginManager will be destroyed. | 67 // then the BrowserPluginManager will be destroyed. |
65 void OnDestruct() override {} | 68 void OnDestruct() override {} |
66 | 69 |
67 private: | 70 private: |
68 // Friend RefCounted so that the dtor can be non-public. | 71 // Friend RefCounted so that the dtor can be non-public. |
69 friend class base::RefCounted<BrowserPluginManager>; | 72 friend class base::RefCounted<BrowserPluginManager>; |
70 | 73 |
71 ~BrowserPluginManager() override; | 74 ~BrowserPluginManager() override; |
72 | 75 |
73 // IPC message handlers. | 76 // IPC message handlers. |
74 void OnCompositorFrameSwappedPluginUnavailable(const IPC::Message& message); | 77 void OnCompositorFrameSwappedPluginUnavailable(const IPC::Message& message); |
75 | 78 |
76 // This map is keyed by guest instance IDs. | 79 // This map is keyed by guest instance IDs. |
77 IDMap<BrowserPlugin> instances_; | 80 IDMap<BrowserPlugin> instances_; |
78 int current_instance_id_; | |
79 base::WeakPtr<RenderViewImpl> render_view_; | 81 base::WeakPtr<RenderViewImpl> render_view_; |
80 | 82 |
81 DISALLOW_COPY_AND_ASSIGN(BrowserPluginManager); | 83 DISALLOW_COPY_AND_ASSIGN(BrowserPluginManager); |
82 }; | 84 }; |
83 | 85 |
84 } // namespace content | 86 } // namespace content |
85 | 87 |
86 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_MANAGER_H_ | 88 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_MANAGER_H_ |
OLD | NEW |