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/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "content/public/renderer/render_process_observer.h" | 10 #include "content/public/renderer/render_process_observer.h" |
11 #include "ipc/ipc_sender.h" | 11 #include "ipc/ipc_sender.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 class WebFrame; | 14 class WebFrame; |
15 } | 15 } |
16 | 16 |
| 17 namespace IPC { |
| 18 class SyncChannel; |
| 19 } |
| 20 |
17 namespace content { | 21 namespace content { |
18 | 22 |
19 class BrowserPlugin; | 23 class BrowserPlugin; |
20 class BrowserPluginDelegate; | 24 class BrowserPluginDelegate; |
21 class RenderFrame; | 25 class RenderFrame; |
| 26 class GuestScrollCompletionFilter; |
22 | 27 |
23 // BrowserPluginManager manages the routing of messages to the appropriate | 28 // BrowserPluginManager manages the routing of messages to the appropriate |
24 // BrowserPlugin object based on its instance ID. There is one BrowserPlugin | 29 // BrowserPlugin object based on its instance ID. There is one BrowserPlugin |
25 // for the RenderThread. | 30 // for the RenderThread. |
26 class CONTENT_EXPORT BrowserPluginManager : public RenderProcessObserver { | 31 class CONTENT_EXPORT BrowserPluginManager : public RenderProcessObserver { |
27 public: | 32 public: |
28 static BrowserPluginManager* Get(); | 33 static BrowserPluginManager* Get(); |
29 | 34 |
30 BrowserPluginManager(); | 35 BrowserPluginManager(); |
31 ~BrowserPluginManager() override; | 36 ~BrowserPluginManager() override; |
32 | 37 |
| 38 // Creates and registers scroll completion filter. |
| 39 void Init(scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 40 IPC::SyncChannel* channel); |
| 41 |
33 // Creates a new BrowserPlugin object. | 42 // Creates a new BrowserPlugin object. |
34 // BrowserPlugin is responsible for associating itself with the | 43 // BrowserPlugin is responsible for associating itself with the |
35 // BrowserPluginManager via AddBrowserPlugin. When it is destroyed, it is | 44 // BrowserPluginManager via AddBrowserPlugin. When it is destroyed, it is |
36 // responsible for removing its association via RemoveBrowserPlugin. | 45 // responsible for removing its association via RemoveBrowserPlugin. |
37 // The |delegate| is expected to manage its own lifetime. | 46 // The |delegate| is expected to manage its own lifetime. |
38 // Generally BrowserPlugin calls DidDestroyElement() on the delegate and | 47 // Generally BrowserPlugin calls DidDestroyElement() on the delegate and |
39 // right now the delegate destroys itself once it hears that callback. | 48 // right now the delegate destroys itself once it hears that callback. |
40 BrowserPlugin* CreateBrowserPlugin( | 49 BrowserPlugin* CreateBrowserPlugin( |
41 RenderFrame* render_frame, | 50 RenderFrame* render_frame, |
42 const base::WeakPtr<BrowserPluginDelegate>& delegate); | 51 const base::WeakPtr<BrowserPluginDelegate>& delegate); |
43 | 52 |
44 void Attach(int browser_plugin_instance_id); | 53 void Attach(int browser_plugin_instance_id); |
45 | 54 |
46 void Detach(int browser_plugin_instance_id); | 55 void Detach(int browser_plugin_instance_id); |
47 | 56 |
48 void AddBrowserPlugin(int browser_plugin_instance_id, | 57 void AddBrowserPlugin(int browser_plugin_instance_id, |
49 BrowserPlugin* browser_plugin); | 58 BrowserPlugin* browser_plugin); |
50 void RemoveBrowserPlugin(int browser_plugin_instance_id); | 59 void RemoveBrowserPlugin(int browser_plugin_instance_id); |
51 BrowserPlugin* GetBrowserPlugin(int browser_plugin_instance_id) const; | 60 BrowserPlugin* GetBrowserPlugin(int browser_plugin_instance_id) const; |
52 | 61 |
53 void UpdateFocusState(); | 62 void UpdateFocusState(); |
54 | 63 |
55 // Returns a new instance ID to be used by BrowserPlugin. Instance IDs are | 64 // Returns a new instance ID to be used by BrowserPlugin. Instance IDs are |
56 // unique per process. | 65 // unique per process. |
57 int GetNextInstanceID(); | 66 int GetNextInstanceID(); |
58 | 67 |
59 void DidCommitCompositorFrame(int render_frame_routing_id); | 68 void DidCommitCompositorFrame(int render_frame_routing_id); |
60 bool Send(IPC::Message* msg); | 69 bool Send(IPC::Message* msg); |
61 | 70 |
| 71 bool GetScrollHandledStatus(); |
| 72 |
62 // RenderProcessObserver override. | 73 // RenderProcessObserver override. |
63 bool OnControlMessageReceived(const IPC::Message& message) override; | 74 bool OnControlMessageReceived(const IPC::Message& message) override; |
64 | 75 |
65 private: | 76 private: |
66 // IPC message handlers. | 77 // IPC message handlers. |
67 void OnCompositorFrameSwappedPluginUnavailable(const IPC::Message& message); | 78 void OnCompositorFrameSwappedPluginUnavailable(const IPC::Message& message); |
68 | 79 |
69 // This map is keyed by guest instance IDs. | 80 // This map is keyed by guest instance IDs. |
70 IDMap<BrowserPlugin> instances_; | 81 IDMap<BrowserPlugin> instances_; |
| 82 scoped_refptr<GuestScrollCompletionFilter> scroll_completion_filter_; |
71 | 83 |
72 DISALLOW_COPY_AND_ASSIGN(BrowserPluginManager); | 84 DISALLOW_COPY_AND_ASSIGN(BrowserPluginManager); |
73 }; | 85 }; |
74 | 86 |
75 } // namespace content | 87 } // namespace content |
76 | 88 |
77 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_MANAGER_H_ | 89 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_MANAGER_H_ |
OLD | NEW |