Chromium Code Reviews| Index: content/renderer/browser_plugin/browser_plugin.cc |
| diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc |
| index a3e78d59460a49429ba6a0abb7f22ba3b77200d0..856f6076673d7281554ebfe8fb90708afce473e7 100644 |
| --- a/content/renderer/browser_plugin/browser_plugin.cc |
| +++ b/content/renderer/browser_plugin/browser_plugin.cc |
| @@ -64,6 +64,8 @@ BrowserPlugin::BrowserPlugin(RenderViewImpl* render_view, |
| } |
| BrowserPlugin::~BrowserPlugin() { |
| + browser_plugin_manager()->RemoveBrowserPluginInternal( |
| + browser_plugin_instance_id_); |
| // If the BrowserPlugin has never navigated then the browser process and |
| // BrowserPluginManager don't know about it and so there is nothing to do |
| // here. |
| @@ -158,10 +160,8 @@ void BrowserPlugin::ParseAllowTransparencyAttribute() { |
| opaque)); |
| } |
| -void BrowserPlugin::Attach(int guest_instance_id, |
| - scoped_ptr<base::DictionaryValue> extra_params) { |
| - CHECK(guest_instance_id != browser_plugin::kInstanceIDNone); |
| - |
| +void BrowserPlugin::Attach(int guest_instance_id) { |
| + CHECK_NE(browser_plugin::kInstanceIDNone, guest_instance_id); |
| // If this BrowserPlugin is already attached to a guest, then kill the guest. |
| if (HasGuestInstanceID()) { |
| if (guest_instance_id == guest_instance_id_) |
| @@ -177,8 +177,6 @@ void BrowserPlugin::Attach(int guest_instance_id, |
| render_view_routing_id_, guest_instance_id_)); |
| } |
| - // This API may be called directly without setting the src attribute. |
| - // In that case, we need to make sure we don't allocate another instance ID. |
| guest_instance_id_ = guest_instance_id; |
| browser_plugin_manager()->AddBrowserPlugin(guest_instance_id, this); |
| @@ -189,10 +187,10 @@ void BrowserPlugin::Attach(int guest_instance_id, |
| attach_params.origin = plugin_rect().origin(); |
| GetSizeParams(&attach_params.resize_guest_params, false); |
| - browser_plugin_manager()->Send( |
| - new BrowserPluginHostMsg_Attach(render_view_routing_id_, |
| - guest_instance_id_, attach_params, |
| - *extra_params)); |
| + browser_plugin_manager()->Send(new BrowserPluginHostMsg_Attach( |
| + render_view_routing_id_, |
| + browser_plugin_instance_id_, |
| + attach_params)); |
| } |
| void BrowserPlugin::DidCommitCompositorFrame() { |
| @@ -206,6 +204,7 @@ void BrowserPlugin::OnAdvanceFocus(int guest_instance_id, bool reverse) { |
| } |
| void BrowserPlugin::OnAttachACK(int guest_instance_id) { |
| + DCHECK(!attached()); |
| attached_ = true; |
| } |
| @@ -299,9 +298,9 @@ void BrowserPlugin::OnSetMouseLock(int guest_instance_id, |
| void BrowserPlugin::OnShouldAcceptTouchEvents(int guest_instance_id, |
| bool accept) { |
| if (container()) { |
| - container()->requestTouchEventType(accept ? |
| - blink::WebPluginContainer::TouchEventRequestTypeRaw : |
| - blink::WebPluginContainer::TouchEventRequestTypeNone); |
| + container()->requestTouchEventType( |
| + accept ? WebPluginContainer::TouchEventRequestTypeRaw |
| + : WebPluginContainer::TouchEventRequestTypeNone); |
| } |
| } |
| @@ -389,7 +388,7 @@ bool BrowserPlugin::ShouldGuestBeFocused() const { |
| return plugin_focused_ && embedder_focused; |
| } |
| -blink::WebPluginContainer* BrowserPlugin::container() const { |
| +WebPluginContainer* BrowserPlugin::container() const { |
| return container_; |
| } |
| @@ -404,10 +403,15 @@ bool BrowserPlugin::initialize(WebPluginContainer* container) { |
| bindings_.reset(new BrowserPluginBindings(this)); |
| container_ = container; |
| container_->setWantsWheelEvents(true); |
| - // This is a way to notify observers of our attributes that we have the |
| - // bindings ready. This also means that this plugin is available in render |
| - // tree. |
| - UpdateDOMAttribute("internalbindings", "true"); |
| + |
| + // This is a way to notify observers of our attributes that this plugin is |
| + // available in render tree. |
| + browser_plugin_instance_id_ = browser_plugin_manager()->GetNextInstanceID(); |
| + UpdateDOMAttribute("internalinstanceid", |
| + base::StringPrintf("%d", browser_plugin_instance_id_)); |
| + |
| + browser_plugin_manager()->AddBrowserPluginInternal( |
| + browser_plugin_instance_id_, this); |
| return true; |
| } |
| @@ -511,8 +515,8 @@ void BrowserPlugin::paint(WebCanvas* canvas, const WebRect& rect) { |
| bool BrowserPlugin::ShouldForwardToBrowserPlugin( |
| const IPC::Message& message) { |
| switch (message.type()) { |
| - case BrowserPluginMsg_AdvanceFocus::ID: |
| case BrowserPluginMsg_Attach_ACK::ID: |
|
Xi Han
2014/08/12 18:17:55
Please sort it alphabetically, i.e., move to after
Fady Samuel
2014/08/13 22:24:39
Done.
|
| + case BrowserPluginMsg_AdvanceFocus::ID: |
| case BrowserPluginMsg_BuffersSwapped::ID: |
| case BrowserPluginMsg_CompositorFrameSwapped::ID: |
| case BrowserPluginMsg_CopyFromCompositingSurface::ID: |