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/renderer/pepper/pepper_plugin_delegate_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <cstddef> | |
8 #include <map> | 9 #include <map> |
9 #include <queue> | 10 #include <queue> |
10 | 11 |
11 #include "base/bind.h" | 12 #include "base/bind.h" |
12 #include "base/callback.h" | 13 #include "base/callback.h" |
13 #include "base/command_line.h" | 14 #include "base/command_line.h" |
14 #include "base/file_path.h" | 15 #include "base/file_path.h" |
15 #include "base/file_util_proxy.h" | 16 #include "base/file_util_proxy.h" |
16 #include "base/logging.h" | 17 #include "base/logging.h" |
17 #include "base/string_split.h" | 18 #include "base/string_split.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 #include "content/renderer/render_view_impl.h" | 50 #include "content/renderer/render_view_impl.h" |
50 #include "content/renderer/render_widget_fullscreen_pepper.h" | 51 #include "content/renderer/render_widget_fullscreen_pepper.h" |
51 #include "content/renderer/renderer_clipboard_client.h" | 52 #include "content/renderer/renderer_clipboard_client.h" |
52 #include "content/renderer/webplugin_delegate_proxy.h" | 53 #include "content/renderer/webplugin_delegate_proxy.h" |
53 #include "ipc/ipc_channel_handle.h" | 54 #include "ipc/ipc_channel_handle.h" |
54 #include "media/video/capture/video_capture_proxy.h" | 55 #include "media/video/capture/video_capture_proxy.h" |
55 #include "ppapi/c/dev/pp_video_dev.h" | 56 #include "ppapi/c/dev/pp_video_dev.h" |
56 #include "ppapi/c/pp_errors.h" | 57 #include "ppapi/c/pp_errors.h" |
57 #include "ppapi/c/private/ppb_flash.h" | 58 #include "ppapi/c/private/ppb_flash.h" |
58 #include "ppapi/c/private/ppb_flash_net_connector.h" | 59 #include "ppapi/c/private/ppb_flash_net_connector.h" |
60 // #include "ppapi/c/private/ppb_host_resolver_private.h" | |
yzshen1
2012/02/28 08:29:00
Remove it instead of commenting it out.
ygorshenin1
2012/02/28 12:09:47
Done.
| |
59 #include "ppapi/proxy/host_dispatcher.h" | 61 #include "ppapi/proxy/host_dispatcher.h" |
60 #include "ppapi/proxy/ppapi_messages.h" | 62 #include "ppapi/proxy/ppapi_messages.h" |
61 #include "ppapi/shared_impl/ppb_device_ref_shared.h" | |
62 #include "ppapi/shared_impl/platform_file.h" | 63 #include "ppapi/shared_impl/platform_file.h" |
63 #include "ppapi/shared_impl/ppapi_preferences.h" | 64 #include "ppapi/shared_impl/ppapi_preferences.h" |
65 #include "ppapi/shared_impl/ppb_device_ref_shared.h" | |
66 #include "ppapi/shared_impl/private/network_list.h" | |
64 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 67 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
65 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 68 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
66 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserComplet ion.h" | 69 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserComplet ion.h" |
67 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams. h" | 70 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams. h" |
68 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 71 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
69 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 72 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
70 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 73 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
71 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 74 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
72 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 75 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
73 #include "ui/gfx/size.h" | 76 #include "ui/gfx/size.h" |
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1323 // Pending Listen request. | 1326 // Pending Listen request. |
1324 uninitialized_tcp_server_sockets_.Remove(temp_socket_id); | 1327 uninitialized_tcp_server_sockets_.Remove(temp_socket_id); |
1325 } | 1328 } |
1326 } else { | 1329 } else { |
1327 render_view_->Send( | 1330 render_view_->Send( |
1328 new PpapiHostMsg_PPBTCPServerSocket_Destroy(real_socket_id)); | 1331 new PpapiHostMsg_PPBTCPServerSocket_Destroy(real_socket_id)); |
1329 tcp_server_sockets_.Remove(real_socket_id); | 1332 tcp_server_sockets_.Remove(real_socket_id); |
1330 } | 1333 } |
1331 } | 1334 } |
1332 | 1335 |
1336 void PepperPluginDelegateImpl::RegisterHostResolver( | |
1337 ppapi::PPB_HostResolver_Shared* host_resolver, | |
1338 uint32 host_resolver_id) { | |
1339 host_resolvers_.AddWithID(host_resolver, host_resolver_id); | |
1340 } | |
1341 | |
1342 void PepperPluginDelegateImpl::HostResolverResolve( | |
1343 uint32 host_resolver_id, | |
1344 const std::string& host, | |
1345 uint16_t port, | |
1346 const PP_HostResolver_Private_Hint* hint) { | |
1347 DCHECK(host_resolvers_.Lookup(host_resolver_id)); | |
1348 if (hint == NULL) { | |
yzshen1
2012/02/28 08:29:00
nit: if (!hint) is more common.
ygorshenin1
2012/02/28 12:09:47
Done.
| |
1349 PP_HostResolver_Private_Hint empty_hint; | |
1350 empty_hint.family = PP_NETADDRESSFAMILY_UNSPECIFIED; | |
1351 empty_hint.flags = static_cast<PP_HostResolver_Private_Flags>(0); | |
1352 render_view_->Send( | |
1353 new PpapiHostMsg_PPBHostResolver_Resolve( | |
1354 GetRoutingId(), | |
1355 host_resolver_id, | |
1356 host, | |
1357 port, | |
1358 empty_hint)); | |
1359 } else { | |
1360 render_view_->Send( | |
1361 new PpapiHostMsg_PPBHostResolver_Resolve( | |
1362 GetRoutingId(), | |
1363 host_resolver_id, | |
1364 host, | |
1365 port, | |
1366 *hint)); | |
1367 } | |
1368 } | |
1369 | |
1370 void PepperPluginDelegateImpl::UnregisterHostResolver( | |
1371 uint32 host_resolver_id) { | |
1372 host_resolvers_.Remove(host_resolver_id); | |
1373 } | |
1374 | |
1333 int32_t PepperPluginDelegateImpl::ShowContextMenu( | 1375 int32_t PepperPluginDelegateImpl::ShowContextMenu( |
1334 webkit::ppapi::PluginInstance* instance, | 1376 webkit::ppapi::PluginInstance* instance, |
1335 webkit::ppapi::PPB_Flash_Menu_Impl* menu, | 1377 webkit::ppapi::PPB_Flash_Menu_Impl* menu, |
1336 const gfx::Point& position) { | 1378 const gfx::Point& position) { |
1337 int32 render_widget_id = render_view_->routing_id(); | 1379 int32 render_widget_id = render_view_->routing_id(); |
1338 if (instance->FlashIsFullscreen(instance->pp_instance())) { | 1380 if (instance->FlashIsFullscreen(instance->pp_instance())) { |
1339 webkit::ppapi::FullscreenContainer* container = | 1381 webkit::ppapi::FullscreenContainer* container = |
1340 instance->fullscreen_container(); | 1382 instance->fullscreen_container(); |
1341 DCHECK(container); | 1383 DCHECK(container); |
1342 render_widget_id = | 1384 render_widget_id = |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1564 base::Bind(&DeviceEnumerationEventHandler::OnDevicesEnumerationFailed, | 1606 base::Bind(&DeviceEnumerationEventHandler::OnDevicesEnumerationFailed, |
1565 device_enumeration_event_handler_->AsWeakPtr(), request_id)); | 1607 device_enumeration_event_handler_->AsWeakPtr(), request_id)); |
1566 #endif | 1608 #endif |
1567 | 1609 |
1568 return request_id; | 1610 return request_id; |
1569 } | 1611 } |
1570 | 1612 |
1571 bool PepperPluginDelegateImpl::OnMessageReceived(const IPC::Message& message) { | 1613 bool PepperPluginDelegateImpl::OnMessageReceived(const IPC::Message& message) { |
1572 bool handled = true; | 1614 bool handled = true; |
1573 IPC_BEGIN_MESSAGE_MAP(PepperPluginDelegateImpl, message) | 1615 IPC_BEGIN_MESSAGE_MAP(PepperPluginDelegateImpl, message) |
1616 IPC_MESSAGE_HANDLER(PpapiMsg_PPBHostResolver_ResolveACK, | |
yzshen1
2012/02/28 08:29:00
You might want to keep the list in the same order
ygorshenin1
2012/02/28 12:09:47
Done.
| |
1617 OnHostResolverResolveACK) | |
1574 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK, | 1618 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK, |
1575 OnTCPSocketConnectACK) | 1619 OnTCPSocketConnectACK) |
1576 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK, | 1620 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK, |
1577 OnTCPSocketSSLHandshakeACK) | 1621 OnTCPSocketSSLHandshakeACK) |
1578 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK) | 1622 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK) |
1579 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK) | 1623 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK) |
1580 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_BindACK, OnUDPSocketBindACK) | 1624 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_BindACK, OnUDPSocketBindACK) |
1581 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_RecvFromACK, | 1625 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_RecvFromACK, |
1582 OnUDPSocketRecvFromACK) | 1626 OnUDPSocketRecvFromACK) |
1583 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_SendToACK, OnUDPSocketSendToACK) | 1627 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_SendToACK, OnUDPSocketSendToACK) |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1705 tcp_server_sockets_.Lookup(real_server_socket_id); | 1749 tcp_server_sockets_.Lookup(real_server_socket_id); |
1706 if (socket) { | 1750 if (socket) { |
1707 bool succeeded = accepted_socket_id != 0; | 1751 bool succeeded = accepted_socket_id != 0; |
1708 socket->OnAcceptCompleted(succeeded, | 1752 socket->OnAcceptCompleted(succeeded, |
1709 accepted_socket_id, | 1753 accepted_socket_id, |
1710 local_addr, | 1754 local_addr, |
1711 remote_addr); | 1755 remote_addr); |
1712 } | 1756 } |
1713 } | 1757 } |
1714 | 1758 |
1759 void PepperPluginDelegateImpl::OnHostResolverResolveACK( | |
1760 uint32 host_resolver_id, | |
1761 bool succeeded, | |
1762 const ppapi::NetworkList& network_list) { | |
1763 ppapi::PPB_HostResolver_Shared* host_resolver = | |
1764 host_resolvers_.Lookup(host_resolver_id); | |
1765 if (host_resolver) | |
1766 host_resolver->OnResolveCompleted(succeeded, network_list); | |
1767 } | |
1768 | |
1715 int PepperPluginDelegateImpl::GetRoutingId() const { | 1769 int PepperPluginDelegateImpl::GetRoutingId() const { |
1716 return render_view_->routing_id(); | 1770 return render_view_->routing_id(); |
1717 } | 1771 } |
1718 | 1772 |
1719 int PepperPluginDelegateImpl::OpenDevice(PP_DeviceType_Dev type, | 1773 int PepperPluginDelegateImpl::OpenDevice(PP_DeviceType_Dev type, |
1720 const std::string& device_id, | 1774 const std::string& device_id, |
1721 const OpenDeviceCallback& callback) { | 1775 const OpenDeviceCallback& callback) { |
1722 int request_id = | 1776 int request_id = |
1723 device_enumeration_event_handler_->RegisterOpenDeviceCallback(callback); | 1777 device_enumeration_event_handler_->RegisterOpenDeviceCallback(callback); |
1724 | 1778 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1796 render_view_->mouse_lock_dispatcher()->OnLockTargetDestroyed(target); | 1850 render_view_->mouse_lock_dispatcher()->OnLockTargetDestroyed(target); |
1797 delete target; | 1851 delete target; |
1798 mouse_lock_instances_.erase(it); | 1852 mouse_lock_instances_.erase(it); |
1799 } | 1853 } |
1800 } | 1854 } |
1801 | 1855 |
1802 webkit_glue::ClipboardClient* | 1856 webkit_glue::ClipboardClient* |
1803 PepperPluginDelegateImpl::CreateClipboardClient() const { | 1857 PepperPluginDelegateImpl::CreateClipboardClient() const { |
1804 return new RendererClipboardClient; | 1858 return new RendererClipboardClient; |
1805 } | 1859 } |
OLD | NEW |