Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: content/renderer/pepper/pepper_plugin_delegate_impl.cc

Issue 9455092: HostResolver is exposed to plugin. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: s/class HostPortPair/struct HostPortPair. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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"
59 #include "ppapi/proxy/host_dispatcher.h" 60 #include "ppapi/proxy/host_dispatcher.h"
60 #include "ppapi/proxy/ppapi_messages.h" 61 #include "ppapi/proxy/ppapi_messages.h"
61 #include "ppapi/shared_impl/ppb_device_ref_shared.h"
62 #include "ppapi/shared_impl/platform_file.h" 62 #include "ppapi/shared_impl/platform_file.h"
63 #include "ppapi/shared_impl/ppapi_preferences.h" 63 #include "ppapi/shared_impl/ppapi_preferences.h"
64 #include "ppapi/shared_impl/ppb_device_ref_shared.h"
64 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" 65 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
65 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" 66 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
66 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserComplet ion.h" 67 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserComplet ion.h"
67 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams. h" 68 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams. h"
68 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 69 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
69 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" 70 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
70 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" 71 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h"
71 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" 72 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
72 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 73 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
73 #include "ui/gfx/size.h" 74 #include "ui/gfx/size.h"
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 // Pending Listen request. 1324 // Pending Listen request.
1324 uninitialized_tcp_server_sockets_.Remove(temp_socket_id); 1325 uninitialized_tcp_server_sockets_.Remove(temp_socket_id);
1325 } 1326 }
1326 } else { 1327 } else {
1327 render_view_->Send( 1328 render_view_->Send(
1328 new PpapiHostMsg_PPBTCPServerSocket_Destroy(real_socket_id)); 1329 new PpapiHostMsg_PPBTCPServerSocket_Destroy(real_socket_id));
1329 tcp_server_sockets_.Remove(real_socket_id); 1330 tcp_server_sockets_.Remove(real_socket_id);
1330 } 1331 }
1331 } 1332 }
1332 1333
1334 void PepperPluginDelegateImpl::RegisterHostResolver(
1335 ppapi::PPB_HostResolver_Shared* host_resolver,
1336 uint32 host_resolver_id) {
1337 host_resolvers_.AddWithID(host_resolver, host_resolver_id);
1338 }
1339
1340 void PepperPluginDelegateImpl::HostResolverResolve(
1341 uint32 host_resolver_id,
1342 const ::ppapi::HostPortPair& host_port,
1343 const PP_HostResolver_Private_Hint* hint) {
1344 DCHECK(host_resolvers_.Lookup(host_resolver_id));
1345 if (!hint) {
1346 PP_HostResolver_Private_Hint empty_hint;
1347 empty_hint.family = PP_NETADDRESSFAMILY_UNSPECIFIED;
1348 empty_hint.flags = static_cast<PP_HostResolver_Private_Flags>(0);
1349 render_view_->Send(
1350 new PpapiHostMsg_PPBHostResolver_Resolve(
1351 GetRoutingId(),
1352 0,
1353 host_resolver_id,
1354 host_port,
1355 empty_hint));
1356 } else {
1357 render_view_->Send(
1358 new PpapiHostMsg_PPBHostResolver_Resolve(
1359 GetRoutingId(),
1360 0,
1361 host_resolver_id,
1362 host_port,
1363 *hint));
1364 }
1365 }
1366
1367 void PepperPluginDelegateImpl::UnregisterHostResolver(
1368 uint32 host_resolver_id) {
1369 host_resolvers_.Remove(host_resolver_id);
1370 }
1371
1333 int32_t PepperPluginDelegateImpl::ShowContextMenu( 1372 int32_t PepperPluginDelegateImpl::ShowContextMenu(
1334 webkit::ppapi::PluginInstance* instance, 1373 webkit::ppapi::PluginInstance* instance,
1335 webkit::ppapi::PPB_Flash_Menu_Impl* menu, 1374 webkit::ppapi::PPB_Flash_Menu_Impl* menu,
1336 const gfx::Point& position) { 1375 const gfx::Point& position) {
1337 int32 render_widget_id = render_view_->routing_id(); 1376 int32 render_widget_id = render_view_->routing_id();
1338 if (instance->FlashIsFullscreen(instance->pp_instance())) { 1377 if (instance->FlashIsFullscreen(instance->pp_instance())) {
1339 webkit::ppapi::FullscreenContainer* container = 1378 webkit::ppapi::FullscreenContainer* container =
1340 instance->fullscreen_container(); 1379 instance->fullscreen_container();
1341 DCHECK(container); 1380 DCHECK(container);
1342 render_widget_id = 1381 render_widget_id =
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK) 1617 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK)
1579 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK) 1618 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK)
1580 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_BindACK, OnUDPSocketBindACK) 1619 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_BindACK, OnUDPSocketBindACK)
1581 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_RecvFromACK, 1620 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_RecvFromACK,
1582 OnUDPSocketRecvFromACK) 1621 OnUDPSocketRecvFromACK)
1583 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_SendToACK, OnUDPSocketSendToACK) 1622 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_SendToACK, OnUDPSocketSendToACK)
1584 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPServerSocket_ListenACK, 1623 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPServerSocket_ListenACK,
1585 OnTCPServerSocketListenACK) 1624 OnTCPServerSocketListenACK)
1586 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPServerSocket_AcceptACK, 1625 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPServerSocket_AcceptACK,
1587 OnTCPServerSocketAcceptACK) 1626 OnTCPServerSocketAcceptACK)
1627 IPC_MESSAGE_HANDLER(PpapiMsg_PPBHostResolver_ResolveACK,
1628 OnHostResolverResolveACK)
1588 IPC_MESSAGE_UNHANDLED(handled = false) 1629 IPC_MESSAGE_UNHANDLED(handled = false)
1589 IPC_END_MESSAGE_MAP() 1630 IPC_END_MESSAGE_MAP()
1590 return handled; 1631 return handled;
1591 } 1632 }
1592 1633
1593 void PepperPluginDelegateImpl::OnDestruct() { 1634 void PepperPluginDelegateImpl::OnDestruct() {
1594 // Nothing to do here. Default implementation in RenderViewObserver does 1635 // Nothing to do here. Default implementation in RenderViewObserver does
1595 // 'delete this' but it's not suitable for PepperPluginDelegateImpl because 1636 // 'delete this' but it's not suitable for PepperPluginDelegateImpl because
1596 // it's non-pointer member in RenderViewImpl. 1637 // it's non-pointer member in RenderViewImpl.
1597 } 1638 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1705 tcp_server_sockets_.Lookup(real_server_socket_id); 1746 tcp_server_sockets_.Lookup(real_server_socket_id);
1706 if (socket) { 1747 if (socket) {
1707 bool succeeded = accepted_socket_id != 0; 1748 bool succeeded = accepted_socket_id != 0;
1708 socket->OnAcceptCompleted(succeeded, 1749 socket->OnAcceptCompleted(succeeded,
1709 accepted_socket_id, 1750 accepted_socket_id,
1710 local_addr, 1751 local_addr,
1711 remote_addr); 1752 remote_addr);
1712 } 1753 }
1713 } 1754 }
1714 1755
1756 void PepperPluginDelegateImpl::OnHostResolverResolveACK(
1757 uint32 plugin_dispatcher_id,
1758 uint32 host_resolver_id,
1759 bool succeeded,
1760 const ppapi::NetworkList& network_list) {
1761 ppapi::PPB_HostResolver_Shared* host_resolver =
1762 host_resolvers_.Lookup(host_resolver_id);
1763 if (host_resolver)
1764 host_resolver->OnResolveCompleted(succeeded, network_list);
1765 }
1766
1715 int PepperPluginDelegateImpl::GetRoutingId() const { 1767 int PepperPluginDelegateImpl::GetRoutingId() const {
1716 return render_view_->routing_id(); 1768 return render_view_->routing_id();
1717 } 1769 }
1718 1770
1719 int PepperPluginDelegateImpl::OpenDevice(PP_DeviceType_Dev type, 1771 int PepperPluginDelegateImpl::OpenDevice(PP_DeviceType_Dev type,
1720 const std::string& device_id, 1772 const std::string& device_id,
1721 const OpenDeviceCallback& callback) { 1773 const OpenDeviceCallback& callback) {
1722 int request_id = 1774 int request_id =
1723 device_enumeration_event_handler_->RegisterOpenDeviceCallback(callback); 1775 device_enumeration_event_handler_->RegisterOpenDeviceCallback(callback);
1724 1776
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1796 render_view_->mouse_lock_dispatcher()->OnLockTargetDestroyed(target); 1848 render_view_->mouse_lock_dispatcher()->OnLockTargetDestroyed(target);
1797 delete target; 1849 delete target;
1798 mouse_lock_instances_.erase(it); 1850 mouse_lock_instances_.erase(it);
1799 } 1851 }
1800 } 1852 }
1801 1853
1802 webkit_glue::ClipboardClient* 1854 webkit_glue::ClipboardClient*
1803 PepperPluginDelegateImpl::CreateClipboardClient() const { 1855 PepperPluginDelegateImpl::CreateClipboardClient() const {
1804 return new RendererClipboardClient; 1856 return new RendererClipboardClient;
1805 } 1857 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698