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 <cstddef> |
9 #include <map> | 9 #include <map> |
10 #include <queue> | 10 #include <queue> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/file_path.h" | 15 #include "base/file_path.h" |
16 #include "base/file_util_proxy.h" | 16 #include "base/file_util_proxy.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/string_split.h" | 18 #include "base/string_split.h" |
19 #include "base/sync_socket.h" | 19 #include "base/sync_socket.h" |
20 #include "base/time.h" | 20 #include "base/time.h" |
21 #include "content/common/child_process.h" | 21 #include "content/common/child_process.h" |
22 #include "content/common/child_process_messages.h" | 22 #include "content/common/child_process_messages.h" |
23 #include "content/common/child_thread.h" | 23 #include "content/common/child_thread.h" |
24 #include "content/common/fileapi/file_system_dispatcher.h" | 24 #include "content/common/fileapi/file_system_dispatcher.h" |
25 #include "content/common/fileapi/file_system_messages.h" | 25 #include "content/common/fileapi/file_system_messages.h" |
26 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 26 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 27 #include "content/common/pepper_messages.h" |
27 #include "content/common/pepper_plugin_registry.h" | 28 #include "content/common/pepper_plugin_registry.h" |
28 #include "content/common/pepper_messages.h" | |
29 #include "content/common/quota_dispatcher.h" | 29 #include "content/common/quota_dispatcher.h" |
30 #include "content/common/view_messages.h" | 30 #include "content/common/view_messages.h" |
31 #include "content/public/common/content_switches.h" | 31 #include "content/public/common/content_switches.h" |
32 #include "content/public/common/context_menu_params.h" | 32 #include "content/public/common/context_menu_params.h" |
33 #include "content/public/common/media_stream_request.h" | 33 #include "content/public/common/media_stream_request.h" |
34 #include "content/public/common/referrer.h" | 34 #include "content/public/common/referrer.h" |
35 #include "content/public/renderer/content_renderer_client.h" | 35 #include "content/public/renderer/content_renderer_client.h" |
36 #include "content/public/renderer/renderer_restrict_dispatch_group.h" | 36 #include "content/public/renderer/renderer_restrict_dispatch_group.h" |
37 #include "content/renderer/browser_plugin/old/browser_plugin_constants.h" | 37 #include "content/renderer/browser_plugin/old/browser_plugin_constants.h" |
38 #include "content/renderer/browser_plugin/old/browser_plugin_registry.h" | 38 #include "content/renderer/browser_plugin/old/browser_plugin_registry.h" |
(...skipping 16 matching lines...) Expand all Loading... |
55 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" | 55 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
56 #include "content/renderer/render_thread_impl.h" | 56 #include "content/renderer/render_thread_impl.h" |
57 #include "content/renderer/render_view_impl.h" | 57 #include "content/renderer/render_view_impl.h" |
58 #include "content/renderer/render_widget_fullscreen_pepper.h" | 58 #include "content/renderer/render_widget_fullscreen_pepper.h" |
59 #include "content/renderer/renderer_clipboard_client.h" | 59 #include "content/renderer/renderer_clipboard_client.h" |
60 #include "content/renderer/webplugin_delegate_proxy.h" | 60 #include "content/renderer/webplugin_delegate_proxy.h" |
61 #include "googleurl/src/gurl.h" | 61 #include "googleurl/src/gurl.h" |
62 #include "ipc/ipc_channel_handle.h" | 62 #include "ipc/ipc_channel_handle.h" |
63 #include "media/video/capture/video_capture_proxy.h" | 63 #include "media/video/capture/video_capture_proxy.h" |
64 #include "ppapi/c/dev/pp_video_dev.h" | 64 #include "ppapi/c/dev/pp_video_dev.h" |
| 65 #include "ppapi/c/pp_bool.h" |
65 #include "ppapi/c/pp_errors.h" | 66 #include "ppapi/c/pp_errors.h" |
66 #include "ppapi/c/private/ppb_flash.h" | 67 #include "ppapi/c/private/ppb_flash.h" |
67 #include "ppapi/host/ppapi_host.h" | 68 #include "ppapi/host/ppapi_host.h" |
68 #include "ppapi/proxy/host_dispatcher.h" | 69 #include "ppapi/proxy/host_dispatcher.h" |
69 #include "ppapi/proxy/pepper_file_messages.h" | 70 #include "ppapi/proxy/pepper_file_messages.h" |
70 #include "ppapi/proxy/ppapi_messages.h" | 71 #include "ppapi/proxy/ppapi_messages.h" |
71 #include "ppapi/shared_impl/file_path.h" | 72 #include "ppapi/shared_impl/file_path.h" |
72 #include "ppapi/shared_impl/platform_file.h" | 73 #include "ppapi/shared_impl/platform_file.h" |
73 #include "ppapi/shared_impl/ppapi_permissions.h" | 74 #include "ppapi/shared_impl/ppapi_permissions.h" |
74 #include "ppapi/shared_impl/ppapi_preferences.h" | 75 #include "ppapi/shared_impl/ppapi_preferences.h" |
75 #include "ppapi/shared_impl/ppb_device_ref_shared.h" | 76 #include "ppapi/shared_impl/ppb_device_ref_shared.h" |
76 #include "ppapi/thunk/enter.h" | 77 #include "ppapi/thunk/enter.h" |
77 #include "ppapi/thunk/ppb_tcp_server_socket_private_api.h" | 78 #include "ppapi/thunk/ppb_tcp_server_socket_private_api.h" |
78 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 79 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
79 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 80 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
80 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 81 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
81 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 82 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
82 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 83 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
83 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 84 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
84 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 85 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
85 #include "ui/gfx/size.h" | 86 #include "ui/gfx/size.h" |
86 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 87 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
87 #include "webkit/plugins/npapi/webplugin.h" | 88 #include "webkit/plugins/npapi/webplugin.h" |
88 #include "webkit/plugins/ppapi/ppb_file_io_impl.h" | |
89 #include "webkit/plugins/ppapi/plugin_module.h" | 89 #include "webkit/plugins/ppapi/plugin_module.h" |
90 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 90 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 91 #include "webkit/plugins/ppapi/ppb_file_io_impl.h" |
91 #include "webkit/plugins/ppapi/ppb_flash_impl.h" | 92 #include "webkit/plugins/ppapi/ppb_flash_impl.h" |
92 #include "webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.h" | 93 #include "webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.h" |
93 #include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h" | 94 #include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h" |
94 #include "webkit/plugins/ppapi/ppb_udp_socket_private_impl.h" | 95 #include "webkit/plugins/ppapi/ppb_udp_socket_private_impl.h" |
95 #include "webkit/plugins/ppapi/resource_helper.h" | 96 #include "webkit/plugins/ppapi/resource_helper.h" |
96 #include "webkit/plugins/webplugininfo.h" | 97 #include "webkit/plugins/webplugininfo.h" |
97 | 98 |
98 using WebKit::WebView; | 99 using WebKit::WebView; |
99 using WebKit::WebFrame; | 100 using WebKit::WebFrame; |
100 | 101 |
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 tcp_sockets_.AddWithID(socket, socket_id); | 1140 tcp_sockets_.AddWithID(socket, socket_id); |
1140 } | 1141 } |
1141 | 1142 |
1142 uint32 PepperPluginDelegateImpl::UDPSocketCreate() { | 1143 uint32 PepperPluginDelegateImpl::UDPSocketCreate() { |
1143 uint32 socket_id = 0; | 1144 uint32 socket_id = 0; |
1144 render_view_->Send(new PpapiHostMsg_PPBUDPSocket_Create( | 1145 render_view_->Send(new PpapiHostMsg_PPBUDPSocket_Create( |
1145 render_view_->routing_id(), 0, &socket_id)); | 1146 render_view_->routing_id(), 0, &socket_id)); |
1146 return socket_id; | 1147 return socket_id; |
1147 } | 1148 } |
1148 | 1149 |
| 1150 void PepperPluginDelegateImpl::UDPSocketSetSocketFeature( |
| 1151 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket, |
| 1152 uint32 socket_id, |
| 1153 PP_UDPSocketFeature_Private name, |
| 1154 PP_Var value) { |
| 1155 switch (name) { |
| 1156 case PP_UDPSOCKETFEATURE_ADDRESS_REUSE: |
| 1157 case PP_UDPSOCKETFEATURE_BROADCAST: |
| 1158 DCHECK_EQ(PP_VARTYPE_BOOL, value.type); |
| 1159 render_view_->Send( |
| 1160 new PpapiHostMsg_PPBUDPSocket_SetBoolSocketFeature( |
| 1161 render_view_->routing_id(), socket_id, |
| 1162 static_cast<int32_t>(name), PP_ToBool(value.value.as_bool))); |
| 1163 break; |
| 1164 default: |
| 1165 NOTREACHED(); |
| 1166 } |
| 1167 } |
| 1168 |
1149 void PepperPluginDelegateImpl::UDPSocketBind( | 1169 void PepperPluginDelegateImpl::UDPSocketBind( |
1150 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket, | 1170 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket, |
1151 uint32 socket_id, | 1171 uint32 socket_id, |
1152 const PP_NetAddress_Private& addr) { | 1172 const PP_NetAddress_Private& addr) { |
1153 udp_sockets_.AddWithID(socket, socket_id); | 1173 if (!udp_sockets_.Lookup(socket_id)) |
| 1174 udp_sockets_.AddWithID(socket, socket_id); |
1154 render_view_->Send(new PpapiHostMsg_PPBUDPSocket_Bind( | 1175 render_view_->Send(new PpapiHostMsg_PPBUDPSocket_Bind( |
1155 render_view_->routing_id(), socket_id, addr)); | 1176 render_view_->routing_id(), socket_id, addr)); |
1156 } | 1177 } |
1157 | 1178 |
1158 void PepperPluginDelegateImpl::UDPSocketRecvFrom(uint32 socket_id, | 1179 void PepperPluginDelegateImpl::UDPSocketRecvFrom(uint32 socket_id, |
1159 int32_t num_bytes) { | 1180 int32_t num_bytes) { |
1160 DCHECK(udp_sockets_.Lookup(socket_id)); | 1181 DCHECK(udp_sockets_.Lookup(socket_id)); |
1161 render_view_->Send( | 1182 render_view_->Send( |
1162 new PpapiHostMsg_PPBUDPSocket_RecvFrom(socket_id, num_bytes)); | 1183 new PpapiHostMsg_PPBUDPSocket_RecvFrom(socket_id, num_bytes)); |
1163 } | 1184 } |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1788 else | 1809 else |
1789 return render_view_->mouse_lock_dispatcher(); | 1810 return render_view_->mouse_lock_dispatcher(); |
1790 } | 1811 } |
1791 | 1812 |
1792 webkit_glue::ClipboardClient* | 1813 webkit_glue::ClipboardClient* |
1793 PepperPluginDelegateImpl::CreateClipboardClient() const { | 1814 PepperPluginDelegateImpl::CreateClipboardClient() const { |
1794 return new RendererClipboardClient; | 1815 return new RendererClipboardClient; |
1795 } | 1816 } |
1796 | 1817 |
1797 } // namespace content | 1818 } // namespace content |
OLD | NEW |