| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ppapi/proxy/ppb_flash_udp_socket_proxy.h" | 5 #include "ppapi/proxy/ppb_flash_udp_socket_proxy.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 } | 294 } |
| 295 | 295 |
| 296 PPB_Flash_UDPSocket_Proxy::~PPB_Flash_UDPSocket_Proxy() { | 296 PPB_Flash_UDPSocket_Proxy::~PPB_Flash_UDPSocket_Proxy() { |
| 297 } | 297 } |
| 298 | 298 |
| 299 // static | 299 // static |
| 300 const InterfaceProxy::Info* PPB_Flash_UDPSocket_Proxy::GetInfo() { | 300 const InterfaceProxy::Info* PPB_Flash_UDPSocket_Proxy::GetInfo() { |
| 301 static const Info info = { | 301 static const Info info = { |
| 302 ::ppapi::thunk::GetPPB_Flash_UDPSocket_Thunk(), | 302 ::ppapi::thunk::GetPPB_Flash_UDPSocket_Thunk(), |
| 303 PPB_FLASH_UDPSOCKET_INTERFACE, | 303 PPB_FLASH_UDPSOCKET_INTERFACE, |
| 304 INTERFACE_ID_PPB_FLASH_UDPSOCKET, | 304 API_ID_PPB_FLASH_UDPSOCKET, |
| 305 false, | 305 false, |
| 306 &CreateFlashUDPSocketProxy, | 306 &CreateFlashUDPSocketProxy, |
| 307 }; | 307 }; |
| 308 return &info; | 308 return &info; |
| 309 } | 309 } |
| 310 | 310 |
| 311 // static | 311 // static |
| 312 PP_Resource PPB_Flash_UDPSocket_Proxy::CreateProxyResource( | 312 PP_Resource PPB_Flash_UDPSocket_Proxy::CreateProxyResource( |
| 313 PP_Instance instance) { | 313 PP_Instance instance) { |
| 314 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 314 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
| 315 if (!dispatcher) | 315 if (!dispatcher) |
| 316 return 0; | 316 return 0; |
| 317 | 317 |
| 318 uint32 socket_id = 0; | 318 uint32 socket_id = 0; |
| 319 dispatcher->SendToBrowser(new PpapiHostMsg_PPBFlashUDPSocket_Create( | 319 dispatcher->SendToBrowser(new PpapiHostMsg_PPBFlashUDPSocket_Create( |
| 320 INTERFACE_ID_PPB_FLASH_UDPSOCKET, dispatcher->plugin_dispatcher_id(), | 320 API_ID_PPB_FLASH_UDPSOCKET, dispatcher->plugin_dispatcher_id(), |
| 321 &socket_id)); | 321 &socket_id)); |
| 322 if (socket_id == 0) | 322 if (socket_id == 0) |
| 323 return 0; | 323 return 0; |
| 324 | 324 |
| 325 return (new FlashUDPSocket(HostResource::MakeInstanceOnly(instance), | 325 return (new FlashUDPSocket(HostResource::MakeInstanceOnly(instance), |
| 326 socket_id))->GetReference(); | 326 socket_id))->GetReference(); |
| 327 } | 327 } |
| 328 | 328 |
| 329 bool PPB_Flash_UDPSocket_Proxy::OnMessageReceived(const IPC::Message& msg) { | 329 bool PPB_Flash_UDPSocket_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 330 bool handled = true; | 330 bool handled = true; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 } | 381 } |
| 382 IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); | 382 IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); |
| 383 if (iter == g_id_to_socket->end()) | 383 if (iter == g_id_to_socket->end()) |
| 384 return; | 384 return; |
| 385 iter->second->OnSendToCompleted(succeeded, bytes_written); | 385 iter->second->OnSendToCompleted(succeeded, bytes_written); |
| 386 } | 386 } |
| 387 | 387 |
| 388 } // namespace proxy | 388 } // namespace proxy |
| 389 } // namespace ppapi | 389 } // namespace ppapi |
| 390 | 390 |
| OLD | NEW |