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_tcp_socket_proxy.h" | 5 #include "ppapi/proxy/ppb_flash_tcp_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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 } | 399 } |
400 | 400 |
401 PPB_Flash_TCPSocket_Proxy::~PPB_Flash_TCPSocket_Proxy() { | 401 PPB_Flash_TCPSocket_Proxy::~PPB_Flash_TCPSocket_Proxy() { |
402 } | 402 } |
403 | 403 |
404 // static | 404 // static |
405 const InterfaceProxy::Info* PPB_Flash_TCPSocket_Proxy::GetInfo() { | 405 const InterfaceProxy::Info* PPB_Flash_TCPSocket_Proxy::GetInfo() { |
406 static const Info info = { | 406 static const Info info = { |
407 thunk::GetPPB_Flash_TCPSocket_Thunk(), | 407 thunk::GetPPB_Flash_TCPSocket_Thunk(), |
408 PPB_FLASH_TCPSOCKET_INTERFACE, | 408 PPB_FLASH_TCPSOCKET_INTERFACE, |
409 INTERFACE_ID_PPB_FLASH_TCPSOCKET, | 409 API_ID_PPB_FLASH_TCPSOCKET, |
410 false, | 410 false, |
411 &CreateFlashTCPSocketProxy, | 411 &CreateFlashTCPSocketProxy, |
412 }; | 412 }; |
413 return &info; | 413 return &info; |
414 } | 414 } |
415 | 415 |
416 // static | 416 // static |
417 PP_Resource PPB_Flash_TCPSocket_Proxy::CreateProxyResource( | 417 PP_Resource PPB_Flash_TCPSocket_Proxy::CreateProxyResource( |
418 PP_Instance instance) { | 418 PP_Instance instance) { |
419 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 419 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
420 if (!dispatcher) | 420 if (!dispatcher) |
421 return 0; | 421 return 0; |
422 | 422 |
423 uint32 socket_id = 0; | 423 uint32 socket_id = 0; |
424 dispatcher->SendToBrowser(new PpapiHostMsg_PPBFlashTCPSocket_Create( | 424 dispatcher->SendToBrowser(new PpapiHostMsg_PPBFlashTCPSocket_Create( |
425 INTERFACE_ID_PPB_FLASH_TCPSOCKET, dispatcher->plugin_dispatcher_id(), | 425 API_ID_PPB_FLASH_TCPSOCKET, dispatcher->plugin_dispatcher_id(), |
426 &socket_id)); | 426 &socket_id)); |
427 if (socket_id == 0) | 427 if (socket_id == 0) |
428 return 0; | 428 return 0; |
429 return (new FlashTCPSocket(HostResource::MakeInstanceOnly(instance), | 429 return (new FlashTCPSocket(HostResource::MakeInstanceOnly(instance), |
430 socket_id))->GetReference(); | 430 socket_id))->GetReference(); |
431 } | 431 } |
432 | 432 |
433 bool PPB_Flash_TCPSocket_Proxy::OnMessageReceived(const IPC::Message& msg) { | 433 bool PPB_Flash_TCPSocket_Proxy::OnMessageReceived(const IPC::Message& msg) { |
434 bool handled = true; | 434 bool handled = true; |
435 IPC_BEGIN_MESSAGE_MAP(PPB_Flash_TCPSocket_Proxy, msg) | 435 IPC_BEGIN_MESSAGE_MAP(PPB_Flash_TCPSocket_Proxy, msg) |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 return; | 496 return; |
497 } | 497 } |
498 IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); | 498 IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); |
499 if (iter == g_id_to_socket->end()) | 499 if (iter == g_id_to_socket->end()) |
500 return; | 500 return; |
501 iter->second->OnWriteCompleted(succeeded, bytes_written); | 501 iter->second->OnWriteCompleted(succeeded, bytes_written); |
502 } | 502 } |
503 | 503 |
504 } // namespace proxy | 504 } // namespace proxy |
505 } // namespace ppapi | 505 } // namespace ppapi |
OLD | NEW |