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. | |
57 int GetNextInstanceID(); | 54 int GetNextInstanceID(); |
58 | 55 |
59 // RenderViewObserver override. Call on render thread. | 56 // RenderViewObserver override. Call on render thread. |
60 void DidCommitCompositorFrame() override; | 57 void DidCommitCompositorFrame() override; |
61 bool OnMessageReceived(const IPC::Message& message) override; | 58 bool OnMessageReceived(const IPC::Message& message) override; |
62 bool Send(IPC::Message* msg) override; | 59 bool Send(IPC::Message* msg) override; |
63 | 60 |
64 // Don't destroy the BrowserPluginManager when the RenderViewImpl goes away. | 61 // Don't destroy the BrowserPluginManager when the RenderViewImpl goes away. |
65 // BrowserPluginManager's lifetime is managed by a reference count. Once | 62 // BrowserPluginManager's lifetime is managed by a reference count. Once |
66 // the host RenderViewImpl and all BrowserPlugins release their references, | 63 // the host RenderViewImpl and all BrowserPlugins release their references, |
67 // then the BrowserPluginManager will be destroyed. | 64 // then the BrowserPluginManager will be destroyed. |
68 void OnDestruct() override {} | 65 void OnDestruct() override {} |
69 | 66 |
70 private: | 67 private: |
71 // Friend RefCounted so that the dtor can be non-public. | 68 // Friend RefCounted so that the dtor can be non-public. |
72 friend class base::RefCounted<BrowserPluginManager>; | 69 friend class base::RefCounted<BrowserPluginManager>; |
73 | 70 |
74 ~BrowserPluginManager() override; | 71 ~BrowserPluginManager() override; |
75 | 72 |
76 // IPC message handlers. | 73 // IPC message handlers. |
77 void OnCompositorFrameSwappedPluginUnavailable(const IPC::Message& message); | 74 void OnCompositorFrameSwappedPluginUnavailable(const IPC::Message& message); |
78 | 75 |
79 // This map is keyed by guest instance IDs. | 76 // This map is keyed by guest instance IDs. |
80 IDMap<BrowserPlugin> instances_; | 77 IDMap<BrowserPlugin> instances_; |
81 static int current_instance_id_; | 78 int current_instance_id_; |
82 base::WeakPtr<RenderViewImpl> render_view_; | 79 base::WeakPtr<RenderViewImpl> render_view_; |
83 | 80 |
84 DISALLOW_COPY_AND_ASSIGN(BrowserPluginManager); | 81 DISALLOW_COPY_AND_ASSIGN(BrowserPluginManager); |
85 }; | 82 }; |
86 | 83 |
87 } // namespace content | 84 } // namespace content |
88 | 85 |
89 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_MANAGER_H_ | 86 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_MANAGER_H_ |
OLD | NEW |