| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 5 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 GetWebContents()->GetBrowserPluginGuestManager()->RemoveGuest(instance_id_); | 500 GetWebContents()->GetBrowserPluginGuestManager()->RemoveGuest(instance_id_); |
| 501 delete GetWebContents(); | 501 delete GetWebContents(); |
| 502 } | 502 } |
| 503 | 503 |
| 504 bool BrowserPluginGuest::OnMessageReceivedFromEmbedder( | 504 bool BrowserPluginGuest::OnMessageReceivedFromEmbedder( |
| 505 const IPC::Message& message) { | 505 const IPC::Message& message) { |
| 506 bool handled = true; | 506 bool handled = true; |
| 507 IPC_BEGIN_MESSAGE_MAP(BrowserPluginGuest, message) | 507 IPC_BEGIN_MESSAGE_MAP(BrowserPluginGuest, message) |
| 508 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_BuffersSwappedACK, | 508 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_BuffersSwappedACK, |
| 509 OnSwapBuffersACK) | 509 OnSwapBuffersACK) |
| 510 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_CompositorFrameACK, | 510 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_CompositorFrameSwappedACK, |
| 511 OnCompositorFrameACK) | 511 OnCompositorFrameSwappedACK) |
| 512 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_CopyFromCompositingSurfaceAck, | 512 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_CopyFromCompositingSurfaceAck, |
| 513 OnCopyFromCompositingSurfaceAck) | 513 OnCopyFromCompositingSurfaceAck) |
| 514 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_DragStatusUpdate, | 514 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_DragStatusUpdate, |
| 515 OnDragStatusUpdate) | 515 OnDragStatusUpdate) |
| 516 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ExecuteEditCommand, | 516 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ExecuteEditCommand, |
| 517 OnExecuteEditCommand) | 517 OnExecuteEditCommand) |
| 518 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ExtendSelectionAndDelete, | 518 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ExtendSelectionAndDelete, |
| 519 OnExtendSelectionAndDelete) | 519 OnExtendSelectionAndDelete) |
| 520 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_HandleInputEvent, | 520 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_HandleInputEvent, |
| 521 OnHandleInputEvent) | 521 OnHandleInputEvent) |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1135 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | 1135 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
| 1136 gpu_host_id, | 1136 gpu_host_id, |
| 1137 ack_params); | 1137 ack_params); |
| 1138 } | 1138 } |
| 1139 | 1139 |
| 1140 // static | 1140 // static |
| 1141 bool BrowserPluginGuest::ShouldForwardToBrowserPluginGuest( | 1141 bool BrowserPluginGuest::ShouldForwardToBrowserPluginGuest( |
| 1142 const IPC::Message& message) { | 1142 const IPC::Message& message) { |
| 1143 switch (message.type()) { | 1143 switch (message.type()) { |
| 1144 case BrowserPluginHostMsg_BuffersSwappedACK::ID: | 1144 case BrowserPluginHostMsg_BuffersSwappedACK::ID: |
| 1145 case BrowserPluginHostMsg_CompositorFrameACK::ID: | 1145 case BrowserPluginHostMsg_CompositorFrameSwappedACK::ID: |
| 1146 case BrowserPluginHostMsg_CopyFromCompositingSurfaceAck::ID: | 1146 case BrowserPluginHostMsg_CopyFromCompositingSurfaceAck::ID: |
| 1147 case BrowserPluginHostMsg_DragStatusUpdate::ID: | 1147 case BrowserPluginHostMsg_DragStatusUpdate::ID: |
| 1148 case BrowserPluginHostMsg_ExecuteEditCommand::ID: | 1148 case BrowserPluginHostMsg_ExecuteEditCommand::ID: |
| 1149 case BrowserPluginHostMsg_ExtendSelectionAndDelete::ID: | 1149 case BrowserPluginHostMsg_ExtendSelectionAndDelete::ID: |
| 1150 case BrowserPluginHostMsg_HandleInputEvent::ID: | 1150 case BrowserPluginHostMsg_HandleInputEvent::ID: |
| 1151 case BrowserPluginHostMsg_ImeConfirmComposition::ID: | 1151 case BrowserPluginHostMsg_ImeConfirmComposition::ID: |
| 1152 case BrowserPluginHostMsg_ImeSetComposition::ID: | 1152 case BrowserPluginHostMsg_ImeSetComposition::ID: |
| 1153 case BrowserPluginHostMsg_LockMouse_ACK::ID: | 1153 case BrowserPluginHostMsg_LockMouse_ACK::ID: |
| 1154 case BrowserPluginHostMsg_NavigateGuest::ID: | 1154 case BrowserPluginHostMsg_NavigateGuest::ID: |
| 1155 case BrowserPluginHostMsg_PluginDestroyed::ID: | 1155 case BrowserPluginHostMsg_PluginDestroyed::ID: |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1249 if (!name_.empty()) | 1249 if (!name_.empty()) |
| 1250 params.name.clear(); | 1250 params.name.clear(); |
| 1251 | 1251 |
| 1252 Initialize(params, embedder_web_contents); | 1252 Initialize(params, embedder_web_contents); |
| 1253 | 1253 |
| 1254 SendQueuedMessages(); | 1254 SendQueuedMessages(); |
| 1255 | 1255 |
| 1256 RecordAction(UserMetricsAction("BrowserPlugin.Guest.Attached")); | 1256 RecordAction(UserMetricsAction("BrowserPlugin.Guest.Attached")); |
| 1257 } | 1257 } |
| 1258 | 1258 |
| 1259 void BrowserPluginGuest::OnCompositorFrameACK( | 1259 void BrowserPluginGuest::OnCompositorFrameSwappedACK( |
| 1260 int instance_id, | 1260 int instance_id, |
| 1261 int route_id, | 1261 const FrameHostMsg_CompositorFrameSwappedACK_Params& params) { |
| 1262 uint32 output_surface_id, | 1262 RenderWidgetHostImpl::SendSwapCompositorFrameAck(params.producing_route_id, |
| 1263 int renderer_host_id, | 1263 params.output_surface_id, |
| 1264 const cc::CompositorFrameAck& ack) { | 1264 params.producing_host_id, |
| 1265 RenderWidgetHostImpl::SendSwapCompositorFrameAck(route_id, | 1265 params.ack); |
| 1266 output_surface_id, | |
| 1267 renderer_host_id, | |
| 1268 ack); | |
| 1269 } | 1266 } |
| 1270 | 1267 |
| 1271 void BrowserPluginGuest::OnDragStatusUpdate(int instance_id, | 1268 void BrowserPluginGuest::OnDragStatusUpdate(int instance_id, |
| 1272 blink::WebDragStatus drag_status, | 1269 blink::WebDragStatus drag_status, |
| 1273 const DropData& drop_data, | 1270 const DropData& drop_data, |
| 1274 blink::WebDragOperationsMask mask, | 1271 blink::WebDragOperationsMask mask, |
| 1275 const gfx::Point& location) { | 1272 const gfx::Point& location) { |
| 1276 RenderViewHost* host = GetWebContents()->GetRenderViewHost(); | 1273 RenderViewHost* host = GetWebContents()->GetRenderViewHost(); |
| 1277 switch (drag_status) { | 1274 switch (drag_status) { |
| 1278 case blink::WebDragStatusEnter: | 1275 case blink::WebDragStatusEnter: |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1568 } | 1565 } |
| 1569 | 1566 |
| 1570 void BrowserPluginGuest::OnSetVisibility(int instance_id, bool visible) { | 1567 void BrowserPluginGuest::OnSetVisibility(int instance_id, bool visible) { |
| 1571 guest_visible_ = visible; | 1568 guest_visible_ = visible; |
| 1572 if (embedder_visible_ && guest_visible_) | 1569 if (embedder_visible_ && guest_visible_) |
| 1573 GetWebContents()->WasShown(); | 1570 GetWebContents()->WasShown(); |
| 1574 else | 1571 else |
| 1575 GetWebContents()->WasHidden(); | 1572 GetWebContents()->WasHidden(); |
| 1576 } | 1573 } |
| 1577 | 1574 |
| 1578 void BrowserPluginGuest::OnSwapBuffersACK(int instance_id, | 1575 void BrowserPluginGuest::OnSwapBuffersACK( |
| 1579 int route_id, | 1576 int instance_id, |
| 1580 int gpu_host_id, | 1577 const FrameHostMsg_BuffersSwappedACK_Params& params) { |
| 1581 const std::string& mailbox_name, | 1578 AcknowledgeBufferPresent(params.gpu_route_id, params.gpu_host_id, |
| 1582 uint32 sync_point) { | 1579 params.mailbox_name, params.sync_point); |
| 1583 AcknowledgeBufferPresent(route_id, gpu_host_id, mailbox_name, sync_point); | |
| 1584 | 1580 |
| 1585 // This is only relevant on MACOSX and WIN when threaded compositing | 1581 // This is only relevant on MACOSX and WIN when threaded compositing |
| 1586 // is not enabled. In threaded mode, above ACK is sufficient. | 1582 // is not enabled. In threaded mode, above ACK is sufficient. |
| 1587 #if defined(OS_MACOSX) || defined(OS_WIN) | 1583 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 1588 RenderWidgetHostImpl* render_widget_host = | 1584 RenderWidgetHostImpl* render_widget_host = |
| 1589 RenderWidgetHostImpl::From(GetWebContents()->GetRenderViewHost()); | 1585 RenderWidgetHostImpl::From(GetWebContents()->GetRenderViewHost()); |
| 1590 render_widget_host->AcknowledgeSwapBuffersToRenderer(); | 1586 render_widget_host->AcknowledgeSwapBuffersToRenderer(); |
| 1591 #endif // defined(OS_MACOSX) || defined(OS_WIN) | 1587 #endif // defined(OS_MACOSX) || defined(OS_WIN) |
| 1592 } | 1588 } |
| 1593 | 1589 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1853 request_info.Set(browser_plugin::kRequestMethod, | 1849 request_info.Set(browser_plugin::kRequestMethod, |
| 1854 base::Value::CreateStringValue(request_method)); | 1850 base::Value::CreateStringValue(request_method)); |
| 1855 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); | 1851 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); |
| 1856 | 1852 |
| 1857 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD, | 1853 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD, |
| 1858 new DownloadRequest(callback), | 1854 new DownloadRequest(callback), |
| 1859 request_info); | 1855 request_info); |
| 1860 } | 1856 } |
| 1861 | 1857 |
| 1862 } // namespace content | 1858 } // namespace content |
| OLD | NEW |