OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_H_ | 5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
7 | 7 |
8 #include "third_party/WebKit/public/web/WebPlugin.h" | 8 #include "third_party/WebKit/public/web/WebPlugin.h" |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 bool ShouldGuestBeFocused() const; | 72 bool ShouldGuestBeFocused() const; |
73 | 73 |
74 // Embedder's device scale factor changed, we need to update the guest | 74 // Embedder's device scale factor changed, we need to update the guest |
75 // renderer. | 75 // renderer. |
76 void UpdateDeviceScaleFactor(float device_scale_factor); | 76 void UpdateDeviceScaleFactor(float device_scale_factor); |
77 | 77 |
78 // A request to enable hardware compositing. | 78 // A request to enable hardware compositing. |
79 void EnableCompositing(bool enable); | 79 void EnableCompositing(bool enable); |
80 | 80 |
81 // Provided that a guest instance ID has been allocated, this method attaches | 81 // Provided that a guest instance ID has been allocated, this method attaches |
82 // this BrowserPlugin instance to that guest. |extra_params| are parameters | 82 // this BrowserPlugin instance to that guest. |
83 // passed in by the content embedder to the browser process. | 83 void Attach(int guest_instance_id); |
84 void Attach(int guest_instance_id, | |
85 scoped_ptr<base::DictionaryValue> extra_params); | |
86 | 84 |
87 // Notify the plugin about a compositor commit so that frame ACKs could be | 85 // Notify the plugin about a compositor commit so that frame ACKs could be |
88 // sent, if needed. | 86 // sent, if needed. |
89 void DidCommitCompositorFrame(); | 87 void DidCommitCompositorFrame(); |
90 | 88 |
| 89 static BrowserPlugin* FromNode(blink::WebNode& node); |
| 90 |
91 // Returns whether a message should be forwarded to BrowserPlugin. | 91 // Returns whether a message should be forwarded to BrowserPlugin. |
92 static bool ShouldForwardToBrowserPlugin(const IPC::Message& message); | 92 static bool ShouldForwardToBrowserPlugin(const IPC::Message& message); |
93 | 93 |
94 // blink::WebPlugin implementation. | 94 // blink::WebPlugin implementation. |
95 virtual blink::WebPluginContainer* container() const OVERRIDE; | 95 virtual blink::WebPluginContainer* container() const OVERRIDE; |
96 virtual bool initialize(blink::WebPluginContainer* container) OVERRIDE; | 96 virtual bool initialize(blink::WebPluginContainer* container) OVERRIDE; |
97 virtual void destroy() OVERRIDE; | 97 virtual void destroy() OVERRIDE; |
98 virtual NPObject* scriptableObject() OVERRIDE; | 98 virtual NPObject* scriptableObject() OVERRIDE; |
99 virtual struct _NPP* pluginNPP() OVERRIDE; | 99 virtual struct _NPP* pluginNPP() OVERRIDE; |
100 virtual bool supportsKeyboardFocus() const OVERRIDE; | 100 virtual bool supportsKeyboardFocus() const OVERRIDE; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 189 |
190 // Populates ResizeGuest parameters based on the current | 190 // Populates ResizeGuest parameters based on the current |
191 // autosize state. | 191 // autosize state. |
192 void GetSizeParams( | 192 void GetSizeParams( |
193 BrowserPluginHostMsg_ResizeGuest_Params* resize_guest_params, | 193 BrowserPluginHostMsg_ResizeGuest_Params* resize_guest_params, |
194 bool needs_repaint); | 194 bool needs_repaint); |
195 | 195 |
196 // IPC message handlers. | 196 // IPC message handlers. |
197 // Please keep in alphabetical order. | 197 // Please keep in alphabetical order. |
198 void OnAdvanceFocus(int instance_id, bool reverse); | 198 void OnAdvanceFocus(int instance_id, bool reverse); |
199 void OnAttachACK(int instance_id); | 199 void OnAttachACK(int guest_instance_id); |
200 void OnBuffersSwapped(int instance_id, | 200 void OnBuffersSwapped(int instance_id, |
201 const FrameMsg_BuffersSwapped_Params& params); | 201 const FrameMsg_BuffersSwapped_Params& params); |
202 void OnCompositorFrameSwapped(const IPC::Message& message); | 202 void OnCompositorFrameSwapped(const IPC::Message& message); |
203 void OnCopyFromCompositingSurface(int instance_id, | 203 void OnCopyFromCompositingSurface(int instance_id, |
204 int request_id, | 204 int request_id, |
205 gfx::Rect source_rect, | 205 gfx::Rect source_rect, |
206 gfx::Size dest_size); | 206 gfx::Size dest_size); |
207 void OnGuestContentWindowReady(int instance_id, | 207 void OnGuestContentWindowReady(int instance_id, |
208 int content_window_routing_id); | 208 int content_window_routing_id); |
209 void OnGuestGone(int instance_id); | 209 void OnGuestGone(int instance_id); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 // store the BrowserPlugin's BrowserPluginManager in a member variable to | 250 // store the BrowserPlugin's BrowserPluginManager in a member variable to |
251 // avoid accessing the RenderViewImpl. | 251 // avoid accessing the RenderViewImpl. |
252 const scoped_refptr<BrowserPluginManager> browser_plugin_manager_; | 252 const scoped_refptr<BrowserPluginManager> browser_plugin_manager_; |
253 | 253 |
254 // Used for HW compositing. | 254 // Used for HW compositing. |
255 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_; | 255 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_; |
256 | 256 |
257 // Used to identify the plugin to WebBindings. | 257 // Used to identify the plugin to WebBindings. |
258 scoped_ptr<struct _NPP> npp_; | 258 scoped_ptr<struct _NPP> npp_; |
259 | 259 |
| 260 // URL for the embedder frame. |
| 261 int browser_plugin_instance_id_; |
| 262 |
260 std::vector<EditCommand> edit_commands_; | 263 std::vector<EditCommand> edit_commands_; |
261 | 264 |
262 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might | 265 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might |
263 // get called after BrowserPlugin has been destroyed. | 266 // get called after BrowserPlugin has been destroyed. |
264 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; | 267 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; |
265 | 268 |
266 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 269 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
267 }; | 270 }; |
268 | 271 |
269 } // namespace content | 272 } // namespace content |
270 | 273 |
271 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 274 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
OLD | NEW |