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 22 matching lines...) Expand all Loading... |
33 public MouseLockDispatcher::LockTarget { | 33 public MouseLockDispatcher::LockTarget { |
34 public: | 34 public: |
35 RenderViewImpl* render_view() const { return render_view_.get(); } | 35 RenderViewImpl* render_view() const { return render_view_.get(); } |
36 int render_view_routing_id() const { return render_view_routing_id_; } | 36 int render_view_routing_id() const { return render_view_routing_id_; } |
37 int guest_instance_id() const { return guest_instance_id_; } | 37 int guest_instance_id() const { return guest_instance_id_; } |
38 bool attached() const { return attached_; } | 38 bool attached() const { return attached_; } |
39 BrowserPluginManager* browser_plugin_manager() const { | 39 BrowserPluginManager* browser_plugin_manager() const { |
40 return browser_plugin_manager_.get(); | 40 return browser_plugin_manager_.get(); |
41 } | 41 } |
42 | 42 |
| 43 void AttachToPlugin(int instance_id); |
| 44 |
43 bool OnMessageReceived(const IPC::Message& msg); | 45 bool OnMessageReceived(const IPC::Message& msg); |
44 | 46 |
45 // Update Browser Plugin's DOM Node attribute |attribute_name| with the value | 47 // Update Browser Plugin's DOM Node attribute |attribute_name| with the value |
46 // |attribute_value|. | 48 // |attribute_value|. |
47 void UpdateDOMAttribute(const std::string& attribute_name, | 49 void UpdateDOMAttribute(const std::string& attribute_name, |
48 const std::string& attribute_value); | 50 const std::string& attribute_value); |
49 // Remove the DOM Node attribute with the name |attribute_name|. | 51 // Remove the DOM Node attribute with the name |attribute_name|. |
50 void RemoveDOMAttribute(const std::string& attribute_name); | 52 void RemoveDOMAttribute(const std::string& attribute_name); |
51 // Get Browser Plugin's DOM Node attribute |attribute_name|'s value. | 53 // Get Browser Plugin's DOM Node attribute |attribute_name|'s value. |
52 std::string GetDOMAttributeValue(const std::string& attribute_name) const; | 54 std::string GetDOMAttributeValue(const std::string& attribute_name) const; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 gfx::Size dest_size); | 247 gfx::Size dest_size); |
246 void OnGuestContentWindowReady(int instance_id, | 248 void OnGuestContentWindowReady(int instance_id, |
247 int content_window_routing_id); | 249 int content_window_routing_id); |
248 void OnGuestGone(int instance_id); | 250 void OnGuestGone(int instance_id); |
249 void OnSetCursor(int instance_id, const WebCursor& cursor); | 251 void OnSetCursor(int instance_id, const WebCursor& cursor); |
250 void OnSetMouseLock(int instance_id, bool enable); | 252 void OnSetMouseLock(int instance_id, bool enable); |
251 void OnShouldAcceptTouchEvents(int instance_id, bool accept); | 253 void OnShouldAcceptTouchEvents(int instance_id, bool accept); |
252 void OnUpdateRect(int instance_id, | 254 void OnUpdateRect(int instance_id, |
253 const BrowserPluginMsg_UpdateRect_Params& params); | 255 const BrowserPluginMsg_UpdateRect_Params& params); |
254 | 256 |
| 257 void MaybeAttach(); |
| 258 |
255 // This is the browser-process-allocated instance ID that uniquely identifies | 259 // This is the browser-process-allocated instance ID that uniquely identifies |
256 // a guest WebContents. | 260 // a guest WebContents. |
257 int guest_instance_id_; | 261 int guest_instance_id_; |
258 // This indicates whether this BrowserPlugin has been attached to a | 262 // This indicates whether this BrowserPlugin has been attached to a |
259 // WebContents. | 263 // WebContents. |
260 bool attached_; | 264 bool attached_; |
261 const base::WeakPtr<RenderViewImpl> render_view_; | 265 const base::WeakPtr<RenderViewImpl> render_view_; |
262 // We cache the |render_view_|'s routing ID because we need it on destruction. | 266 // We cache the |render_view_|'s routing ID because we need it on destruction. |
263 // If the |render_view_| is destroyed before the BrowserPlugin is destroyed | 267 // If the |render_view_| is destroyed before the BrowserPlugin is destroyed |
264 // then we will attempt to access a NULL pointer. | 268 // then we will attempt to access a NULL pointer. |
(...skipping 15 matching lines...) Expand all Loading... |
280 // embedder RenderView's visibility. | 284 // embedder RenderView's visibility. |
281 bool visible_; | 285 bool visible_; |
282 | 286 |
283 const bool auto_navigate_; | 287 const bool auto_navigate_; |
284 std::string html_string_; | 288 std::string html_string_; |
285 | 289 |
286 WebCursor cursor_; | 290 WebCursor cursor_; |
287 | 291 |
288 gfx::Size last_view_size_; | 292 gfx::Size last_view_size_; |
289 bool mouse_locked_; | 293 bool mouse_locked_; |
| 294 bool attach_called_; |
| 295 bool seen_src_; |
| 296 int pending_instance_id_; |
290 | 297 |
291 // BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to | 298 // BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to |
292 // store the BrowserPlugin's BrowserPluginManager in a member variable to | 299 // store the BrowserPlugin's BrowserPluginManager in a member variable to |
293 // avoid accessing the RenderViewImpl. | 300 // avoid accessing the RenderViewImpl. |
294 const scoped_refptr<BrowserPluginManager> browser_plugin_manager_; | 301 const scoped_refptr<BrowserPluginManager> browser_plugin_manager_; |
295 | 302 |
296 // Used for HW compositing. | 303 // Used for HW compositing. |
297 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_; | 304 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_; |
298 | 305 |
299 // Used to identify the plugin to WebBindings. | 306 // Used to identify the plugin to WebBindings. |
300 scoped_ptr<struct _NPP> npp_; | 307 scoped_ptr<struct _NPP> npp_; |
301 | 308 |
302 // URL for the embedder frame. | 309 // URL for the embedder frame. |
303 const GURL embedder_frame_url_; | 310 const GURL embedder_frame_url_; |
304 | 311 |
305 std::vector<EditCommand> edit_commands_; | 312 std::vector<EditCommand> edit_commands_; |
306 | 313 |
307 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might | 314 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might |
308 // get called after BrowserPlugin has been destroyed. | 315 // get called after BrowserPlugin has been destroyed. |
309 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; | 316 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; |
310 | 317 |
311 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 318 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
312 }; | 319 }; |
313 | 320 |
314 } // namespace content | 321 } // namespace content |
315 | 322 |
316 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 323 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
OLD | NEW |