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

Side by Side Diff: ppapi/cpp/private/udp_socket.cc

Issue 8506016: Remove 'Flash' from TCP/UDP Pepper interfaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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/cpp/private/flash_udp_socket.h" 5 #include "ppapi/cpp/private/udp_socket.h"
6 6
7 #include "ppapi/c/pp_bool.h" 7 #include "ppapi/c/pp_bool.h"
8 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/cpp/completion_callback.h" 9 #include "ppapi/cpp/completion_callback.h"
10 #include "ppapi/cpp/instance.h" 10 #include "ppapi/cpp/instance.h"
11 #include "ppapi/cpp/module.h" 11 #include "ppapi/cpp/module.h"
12 #include "ppapi/cpp/module_impl.h" 12 #include "ppapi/cpp/module_impl.h"
13 13
14 namespace pp { 14 namespace pp {
15 15
16 namespace { 16 namespace {
17 17
18 template <> const char* interface_name<PPB_Flash_UDPSocket>() { 18 template <> const char* interface_name<PPB_UDPSocket>() {
19 return PPB_FLASH_UDPSOCKET_INTERFACE; 19 return PPB_UDPSOCKET_INTERFACE;
20 } 20 }
21 21
22 } // namespace 22 } // namespace
23 23
24 namespace flash {
25
26 UDPSocket::UDPSocket(Instance* instance) { 24 UDPSocket::UDPSocket(Instance* instance) {
27 if (has_interface<PPB_Flash_UDPSocket>() && instance) { 25 if (has_interface<PPB_UDPSocket>() && instance) {
28 PassRefFromConstructor(get_interface<PPB_Flash_UDPSocket>()->Create( 26 PassRefFromConstructor(get_interface<PPB_UDPSocket>()->Create(
29 instance->pp_instance())); 27 instance->pp_instance()));
30 } 28 }
31 } 29 }
32 30
33 int32_t UDPSocket::Bind(const PP_Flash_NetAddress* addr, 31 int32_t UDPSocket::Bind(const PP_NetAddress* addr,
34 const CompletionCallback& callback) { 32 const CompletionCallback& callback) {
35 if (!has_interface<PPB_Flash_UDPSocket>()) 33 if (!has_interface<PPB_UDPSocket>())
36 return PP_ERROR_NOINTERFACE; 34 return PP_ERROR_NOINTERFACE;
37 return get_interface<PPB_Flash_UDPSocket>()->Bind( 35 return get_interface<PPB_UDPSocket>()->Bind(
38 pp_resource(), addr, callback.pp_completion_callback()); 36 pp_resource(), addr, callback.pp_completion_callback());
39 } 37 }
40 38
41 int32_t UDPSocket::RecvFrom(char* buffer, 39 int32_t UDPSocket::RecvFrom(char* buffer,
42 int32_t num_bytes, 40 int32_t num_bytes,
43 const CompletionCallback& callback) { 41 const CompletionCallback& callback) {
44 if (!has_interface<PPB_Flash_UDPSocket>()) 42 if (!has_interface<PPB_UDPSocket>())
45 return PP_ERROR_NOINTERFACE; 43 return PP_ERROR_NOINTERFACE;
46 return get_interface<PPB_Flash_UDPSocket>()->RecvFrom( 44 return get_interface<PPB_UDPSocket>()->RecvFrom(
47 pp_resource(), buffer, num_bytes, callback.pp_completion_callback()); 45 pp_resource(), buffer, num_bytes, callback.pp_completion_callback());
48 } 46 }
49 47
50 bool UDPSocket::GetRecvFromAddress(PP_Flash_NetAddress* addr) { 48 bool UDPSocket::GetRecvFromAddress(PP_NetAddress* addr) {
51 if (!has_interface<PPB_Flash_UDPSocket>()) 49 if (!has_interface<PPB_UDPSocket>())
52 return false; 50 return false;
53 51
54 PP_Bool result = get_interface<PPB_Flash_UDPSocket>()->GetRecvFromAddress( 52 PP_Bool result = get_interface<PPB_UDPSocket>()->GetRecvFromAddress(
55 pp_resource(), addr); 53 pp_resource(), addr);
56 return PP_ToBool(result); 54 return PP_ToBool(result);
57 } 55 }
58 56
59 int32_t UDPSocket::SendTo(const char* buffer, 57 int32_t UDPSocket::SendTo(const char* buffer,
60 int32_t num_bytes, 58 int32_t num_bytes,
61 const struct PP_Flash_NetAddress* addr, 59 const struct PP_NetAddress* addr,
62 const CompletionCallback& callback) { 60 const CompletionCallback& callback) {
63 if (!has_interface<PPB_Flash_UDPSocket>()) 61 if (!has_interface<PPB_UDPSocket>())
64 return PP_ERROR_NOINTERFACE; 62 return PP_ERROR_NOINTERFACE;
65 return get_interface<PPB_Flash_UDPSocket>()->SendTo( 63 return get_interface<PPB_UDPSocket>()->SendTo(
66 pp_resource(), buffer, num_bytes, addr, 64 pp_resource(), buffer, num_bytes, addr,
67 callback.pp_completion_callback()); 65 callback.pp_completion_callback());
68 } 66 }
69 67
70 } // namespace flash
71 } // namespace pp 68 } // namespace pp
72 69
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698