Chromium Code Reviews| Index: content/browser/browser_plugin/browser_plugin_host.cc |
| diff --git a/content/browser/browser_plugin/browser_plugin_host.cc b/content/browser/browser_plugin/browser_plugin_host.cc |
| index 89d3d22346f011bd65a714fb8d89a2951e9552e8..96f0f03f3320035d275ec6dc840cf0479f02de08 100644 |
| --- a/content/browser/browser_plugin/browser_plugin_host.cc |
| +++ b/content/browser/browser_plugin/browser_plugin_host.cc |
| @@ -42,7 +42,7 @@ BrowserPluginHost::BrowserPluginHost( |
| // Construct plumbing helpers when a new RenderViewHost is created for |
| // this BrowserPluginHost's WebContentsImpl. |
| registrar_.Add(this, |
| - NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED, |
| + NOTIFICATION_WILL_CREATE_RENDER_VIEW, |
| Source<WebContents>(web_contents)); |
| } |
| @@ -69,7 +69,7 @@ void BrowserPluginHost::AddGuest(int instance_id, |
| guests_[guest->web_contents()] = frame_id; |
| } |
| -bool BrowserPluginHost::TakeFocus(bool reverse) { |
| +bool BrowserPluginHost::TakeFocus(WebContents* source, bool reverse) { |
| embedder_render_process_host()->Send( |
| new BrowserPluginMsg_AdvanceFocus(instance_id(), reverse)); |
| return true; |
| @@ -89,12 +89,14 @@ void BrowserPluginHost::NavigateOrCreateGuest( |
| RenderViewHost* render_view_host, |
| int instance_id, |
| long long frame_id, |
| - const std::string& src) { |
| + const std::string& src, |
| + const BrowserPluginHostMsg_Surface_Params& params) { |
| BrowserPluginHost* guest = |
| GetGuestByInstanceID(instance_id); |
| WebContentsImpl* guest_web_contents = |
| guest ? |
| static_cast<WebContentsImpl*>(guest->web_contents()): NULL; |
| + surface_params_ = params; |
| GURL url(src); |
| if (!guest) { |
| std::string host = render_view_host->GetSiteInstance()->GetSite().host(); |
| @@ -116,6 +118,7 @@ void BrowserPluginHost::NavigateOrCreateGuest( |
| NULL // session storage namespace |
| )); |
| guest = guest_web_contents->browser_plugin_host(); |
| + guest->set_surface_params(params); |
| guest->set_embedder_render_process_host( |
| render_view_host->GetProcess()); |
| guest->set_instance_id(instance_id); |
| @@ -157,12 +160,6 @@ void BrowserPluginHost::ResizeGuest(int instance_id, |
| void BrowserPluginHost::UpdateRect( |
| RenderViewHost* render_view_host, |
| const ViewHostMsg_UpdateRect_Params& params) { |
| - // This handler is only of interest to us for the 2D software rendering path. |
| - // needs_ack should always be true for the 2D path. |
| - // TODO(fsamuel): Do we need to do something different in the 3D case? |
| - if (!params.needs_ack) |
| - return; |
| - |
| // Only copy damage if the guest's view size is equal to the damage buffer's |
| // size and the guest's scale factor is equal to the damage buffer's scale |
| // factor. |
| @@ -189,6 +186,7 @@ void BrowserPluginHost::UpdateRect( |
| relay_params.scale_factor = params.scale_factor; |
| relay_params.is_resize_ack = ViewHostMsg_UpdateRect_Flags::is_resize_ack( |
| params.flags); |
| + relay_params.needs_ack = params.needs_ack; |
| // We need to send the ACK to the same render_view_host that issued |
| // the UpdateRect. We keep track of this correspondence via a message_id. |
| @@ -258,8 +256,9 @@ void BrowserPluginHost::HandleInputEventAck(RenderViewHost* render_view_host, |
| embedder_render_process_host()->Send(reply_message); |
| RenderViewHostImpl* guest_rvh = |
| static_cast<RenderViewHostImpl*>(render_view_host); |
| - if (guest_rvh->decrement_in_flight_event_count() == 0) |
| + if (guest_rvh->decrement_in_flight_event_count() == 0) { |
|
scshunt
2012/08/12 01:42:45
Unnecessary.
scshunt
2012/08/17 17:30:28
Done.
|
| guest_rvh->StopHangMonitorTimeout(); |
| + } |
| } |
| void BrowserPluginHost::SetFocus(bool focused) { |
| @@ -268,6 +267,20 @@ void BrowserPluginHost::SetFocus(bool focused) { |
| new ViewMsg_SetFocus(render_view_host->GetRoutingID(), focused)); |
| } |
| +void BrowserPluginHost::SendBuffersSwappedToEmbedder( |
| + uint64 surface_handle, |
| + const BrowserPlugin_SwapInfo& info) { |
| + DCHECK(embedder_render_process_host()); |
| + embedder_render_process_host()->Send( |
| + new BrowserPluginMsg_BuffersSwapped(instance_id_, surface_handle, info)); |
| +} |
| + |
| +void BrowserPluginHost::SendSurfaceResizeToEmbedder(const gfx::Size& size) { |
| + DCHECK(embedder_render_process_host()); |
| + embedder_render_process_host()->Send( |
| + new BrowserPluginMsg_SurfaceResize(instance_id_, size)); |
| +} |
| + |
| void BrowserPluginHost::ShowWidget(RenderViewHost* render_view_host, |
| int route_id, |
| const gfx::Rect& initial_pos) { |
| @@ -378,12 +391,12 @@ void BrowserPluginHost::Observe( |
| const NotificationSource& source, |
| const NotificationDetails& details) { |
| switch (type) { |
| - case NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED: { |
| + case NOTIFICATION_WILL_CREATE_RENDER_VIEW: { |
| RenderViewHost* render_view_host = |
| Details<RenderViewHost>(details).ptr(); |
| // BrowserPluginHostHelper is destroyed when its associated RenderViewHost |
| // is destroyed. |
| - new BrowserPluginHostHelper(this, render_view_host); |
| + new BrowserPluginHostHelper(this, render_view_host, surface_params_); |
| break; |
| } |
| case NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED: { |