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

Unified Diff: content/renderer/pepper/pepper_plugin_delegate_impl.cc

Issue 10735056: AllowBroadcast() is exposed to NaCl. (Closed) Base URL: http://git.chromium.org/chromium/src.git@udp_broadcast
Patch Set: Fixed comments. Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/pepper/pepper_plugin_delegate_impl.cc
diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
index e690fb4e8e65eb9146748b80ecea1019125af30c..9f29c4e7d05d496e41fd4f6ffdfe47be328ece9f 100644
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
@@ -24,8 +24,8 @@
#include "content/common/fileapi/file_system_dispatcher.h"
#include "content/common/fileapi/file_system_messages.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
-#include "content/common/pepper_plugin_registry.h"
#include "content/common/pepper_messages.h"
+#include "content/common/pepper_plugin_registry.h"
#include "content/common/quota_dispatcher.h"
#include "content/common/view_messages.h"
#include "content/public/common/content_switches.h"
@@ -86,9 +86,9 @@
#include "ui/gfx/size.h"
#include "webkit/fileapi/file_system_callback_dispatcher.h"
#include "webkit/plugins/npapi/webplugin.h"
-#include "webkit/plugins/ppapi/ppb_file_io_impl.h"
#include "webkit/plugins/ppapi/plugin_module.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
+#include "webkit/plugins/ppapi/ppb_file_io_impl.h"
#include "webkit/plugins/ppapi/ppb_flash_impl.h"
#include "webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.h"
#include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h"
@@ -1125,11 +1125,33 @@ uint32 PepperPluginDelegateImpl::UDPSocketCreate() {
return socket_id;
}
+void PepperPluginDelegateImpl::UDPSocketSetSocketFeature(
+ webkit::ppapi::PPB_UDPSocket_Private_Impl* socket,
+ uint32 socket_id,
+ PP_UDPSocketFeature_Private name,
+ PP_Var value) {
+ if (!udp_sockets_.Lookup(socket_id))
+ udp_sockets_.AddWithID(socket, socket_id);
+ switch (name) {
+ case PP_UDPSOCKETFEATURE_ADDRESS_REUSE:
+ case PP_UDPSOCKETFEATURE_BROADCAST:
+ DCHECK_EQ(PP_VARTYPE_BOOL, value.type);
+ render_view_->Send(
+ new PpapiHostMsg_PPBUDPSocket_SetBoolSocketFeature(
+ render_view_->routing_id(), socket_id,
+ name, (value.value.as_bool == PP_TRUE)));
+ break;
+ default:
+ NOTREACHED();
+ }
+}
+
void PepperPluginDelegateImpl::UDPSocketBind(
webkit::ppapi::PPB_UDPSocket_Private_Impl* socket,
uint32 socket_id,
const PP_NetAddress_Private& addr) {
- udp_sockets_.AddWithID(socket, socket_id);
+ if (!udp_sockets_.Lookup(socket_id))
+ udp_sockets_.AddWithID(socket, socket_id);
render_view_->Send(new PpapiHostMsg_PPBUDPSocket_Bind(
render_view_->routing_id(), socket_id, addr));
}
@@ -1515,6 +1537,8 @@ bool PepperPluginDelegateImpl::OnMessageReceived(const IPC::Message& message) {
OnTCPSocketSSLHandshakeACK)
IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK)
IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK)
+ IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_SetSocketFeatureACK,
+ OnUDPSocketSetSocketFeatureACK)
IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_BindACK, OnUDPSocketBindACK)
IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_RecvFromACK,
OnUDPSocketRecvFromACK)
@@ -1581,6 +1605,16 @@ void PepperPluginDelegateImpl::OnTCPSocketWriteACK(uint32 plugin_dispatcher_id,
socket->OnWriteCompleted(succeeded, bytes_written);
}
+void PepperPluginDelegateImpl::OnUDPSocketSetSocketFeatureACK(
+ uint32 plugin_dispatcher_id,
+ uint32 socket_id,
+ bool succeeded) {
+ webkit::ppapi::PPB_UDPSocket_Private_Impl* socket =
+ udp_sockets_.Lookup(socket_id);
+ if (socket)
+ socket->OnSetSocketFeatureCompleted(succeeded);
+}
+
void PepperPluginDelegateImpl::OnUDPSocketBindACK(
uint32 plugin_dispatcher_id,
uint32 socket_id,

Powered by Google App Engine
This is Rietveld 408576698