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 class BrowserPluginManager; | 33 class BrowserPluginManager; |
34 class MockBrowserPlugin; | 34 class MockBrowserPlugin; |
35 | 35 |
36 class CONTENT_EXPORT BrowserPlugin : | 36 class CONTENT_EXPORT BrowserPlugin : |
37 NON_EXPORTED_BASE(public WebKit::WebPlugin), | 37 NON_EXPORTED_BASE(public WebKit::WebPlugin), |
38 public MouseLockDispatcher::LockTarget { | 38 public MouseLockDispatcher::LockTarget { |
39 public: | 39 public: |
40 RenderViewImpl* render_view() const { return render_view_.get(); } | 40 RenderViewImpl* render_view() const { return render_view_.get(); } |
41 int render_view_routing_id() const { return render_view_routing_id_; } | 41 int render_view_routing_id() const { return render_view_routing_id_; } |
42 int guest_instance_id() const { return guest_instance_id_; } | 42 int guest_instance_id() const { return guest_instance_id_; } |
43 int instance_id() const { return instance_id_; } | |
44 | 43 |
45 static BrowserPlugin* FromContainer(WebKit::WebPluginContainer* container); | 44 static BrowserPlugin* FromContainer(WebKit::WebPluginContainer* container); |
46 | 45 |
47 bool OnMessageReceived(const IPC::Message& msg); | 46 bool OnMessageReceived(const IPC::Message& msg); |
48 | 47 |
49 // Update Browser Plugin's DOM Node attribute |attribute_name| with the value | 48 // Update Browser Plugin's DOM Node attribute |attribute_name| with the value |
50 // |attribute_value|. | 49 // |attribute_value|. |
51 void UpdateDOMAttribute(const std::string& attribute_name, | 50 void UpdateDOMAttribute(const std::string& attribute_name, |
52 const std::string& attribute_value); | 51 const std::string& attribute_value); |
53 // Remove the DOM Node attribute with the name |attribute_name|. | 52 // Remove the DOM Node attribute with the name |attribute_name|. |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 // A BrowserPlugin object is a controller that represents an instance of a | 211 // A BrowserPlugin object is a controller that represents an instance of a |
213 // browser plugin within the embedder renderer process. Each BrowserPlugin | 212 // browser plugin within the embedder renderer process. Each BrowserPlugin |
214 // within a RenderView has a unique instance_id that is used to track per- | 213 // within a RenderView has a unique instance_id that is used to track per- |
215 // BrowserPlugin state in the browser process. Once a BrowserPlugin does | 214 // BrowserPlugin state in the browser process. Once a BrowserPlugin does |
216 // an initial navigation or is attached to a newly created guest, it acquires | 215 // an initial navigation or is attached to a newly created guest, it acquires |
217 // a guest_instance_id as well. The guest instance ID uniquely identifies a | 216 // a guest_instance_id as well. The guest instance ID uniquely identifies a |
218 // guest WebContents that's hosted by this BrowserPlugin. | 217 // guest WebContents that's hosted by this BrowserPlugin. |
219 BrowserPlugin( | 218 BrowserPlugin( |
220 RenderViewImpl* render_view, | 219 RenderViewImpl* render_view, |
221 WebKit::WebFrame* frame, | 220 WebKit::WebFrame* frame, |
222 const WebKit::WebPluginParams& params, | 221 const WebKit::WebPluginParams& params); |
223 int instance_id); | |
224 | 222 |
225 virtual ~BrowserPlugin(); | 223 virtual ~BrowserPlugin(); |
226 | 224 |
227 int width() const { return plugin_rect_.width(); } | 225 int width() const { return plugin_rect_.width(); } |
228 int height() const { return plugin_rect_.height(); } | 226 int height() const { return plugin_rect_.height(); } |
229 gfx::Rect plugin_rect() { return plugin_rect_; } | 227 gfx::Rect plugin_rect() { return plugin_rect_; } |
230 // Gets the Max Height value used for auto size. | 228 // Gets the Max Height value used for auto size. |
231 int GetAdjustedMaxHeight() const; | 229 int GetAdjustedMaxHeight() const; |
232 // Gets the Max Width value used for auto size. | 230 // Gets the Max Width value used for auto size. |
233 int GetAdjustedMaxWidth() const; | 231 int GetAdjustedMaxWidth() const; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 void OnSetCursor(int instance_id, const WebCursor& cursor); | 327 void OnSetCursor(int instance_id, const WebCursor& cursor); |
330 void OnSetMouseLock(int instance_id, bool enable); | 328 void OnSetMouseLock(int instance_id, bool enable); |
331 void OnShouldAcceptTouchEvents(int instance_id, bool accept); | 329 void OnShouldAcceptTouchEvents(int instance_id, bool accept); |
332 void OnUpdatedName(int instance_id, const std::string& name); | 330 void OnUpdatedName(int instance_id, const std::string& name); |
333 void OnUpdateRect(int instance_id, | 331 void OnUpdateRect(int instance_id, |
334 const BrowserPluginMsg_UpdateRect_Params& params); | 332 const BrowserPluginMsg_UpdateRect_Params& params); |
335 | 333 |
336 // This is the browser-process-allocated instance ID that uniquely identifies | 334 // This is the browser-process-allocated instance ID that uniquely identifies |
337 // a guest WebContents. | 335 // a guest WebContents. |
338 int guest_instance_id_; | 336 int guest_instance_id_; |
339 // This is a render-process-allocated instance ID that uniquely identifies a | |
340 // BrowserPlugin. | |
341 int instance_id_; | |
342 base::WeakPtr<RenderViewImpl> render_view_; | 337 base::WeakPtr<RenderViewImpl> render_view_; |
343 // We cache the |render_view_|'s routing ID because we need it on destruction. | 338 // We cache the |render_view_|'s routing ID because we need it on destruction. |
344 // If the |render_view_| is destroyed before the BrowserPlugin is destroyed | 339 // If the |render_view_| is destroyed before the BrowserPlugin is destroyed |
345 // then we will attempt to access a NULL pointer. | 340 // then we will attempt to access a NULL pointer. |
346 int render_view_routing_id_; | 341 int render_view_routing_id_; |
347 WebKit::WebPluginContainer* container_; | 342 WebKit::WebPluginContainer* container_; |
348 scoped_ptr<BrowserPluginBindings> bindings_; | 343 scoped_ptr<BrowserPluginBindings> bindings_; |
349 scoped_ptr<BrowserPluginBackingStore> backing_store_; | 344 scoped_ptr<BrowserPluginBackingStore> backing_store_; |
350 scoped_ptr<base::SharedMemory> current_damage_buffer_; | 345 scoped_ptr<base::SharedMemory> current_damage_buffer_; |
351 scoped_ptr<base::SharedMemory> pending_damage_buffer_; | 346 scoped_ptr<base::SharedMemory> pending_damage_buffer_; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; | 393 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; |
399 | 394 |
400 std::vector<EditCommand> edit_commands_; | 395 std::vector<EditCommand> edit_commands_; |
401 | 396 |
402 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 397 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
403 }; | 398 }; |
404 | 399 |
405 } // namespace content | 400 } // namespace content |
406 | 401 |
407 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 402 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
OLD | NEW |