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 "ppapi/cpp/private/net_address_private.h" | 5 #include "ppapi/cpp/private/net_address_private.h" |
6 | 6 |
7 #include "ppapi/c/pp_bool.h" | 7 #include "ppapi/c/pp_bool.h" |
8 #include "ppapi/cpp/module.h" | 8 #include "ppapi/cpp/module.h" |
9 #include "ppapi/cpp/module_impl.h" | 9 #include "ppapi/cpp/module_impl.h" |
10 #include "ppapi/cpp/var.h" | 10 #include "ppapi/cpp/var.h" |
11 #include "ppapi/c/private/ppb_net_address_private.h" | |
12 | 11 |
13 namespace pp { | 12 namespace pp { |
14 | 13 |
15 namespace { | 14 namespace { |
16 | 15 |
17 template <> const char* interface_name<PPB_NetAddress_Private>() { | 16 template <> const char* interface_name<PPB_NetAddress_Private>() { |
18 return PPB_NETADDRESS_PRIVATE_INTERFACE; | 17 return PPB_NETADDRESS_PRIVATE_INTERFACE; |
19 } | 18 } |
20 | 19 |
21 } // namespace | 20 } // namespace |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 void NetAddressPrivate::GetAnyAddress(bool is_ipv6, | 74 void NetAddressPrivate::GetAnyAddress(bool is_ipv6, |
76 PP_NetAddress_Private* addr) { | 75 PP_NetAddress_Private* addr) { |
77 if (!has_interface<PPB_NetAddress_Private>()) | 76 if (!has_interface<PPB_NetAddress_Private>()) |
78 return; | 77 return; |
79 get_interface<PPB_NetAddress_Private>()->GetAnyAddress( | 78 get_interface<PPB_NetAddress_Private>()->GetAnyAddress( |
80 PP_FromBool(is_ipv6), | 79 PP_FromBool(is_ipv6), |
81 addr); | 80 addr); |
82 } | 81 } |
83 | 82 |
84 // static | 83 // static |
85 uint16_t NetAddressPrivate::GetFamily(const PP_NetAddress_Private& addr) { | 84 PP_NetAddressFamily_Private NetAddressPrivate::GetFamily( |
| 85 const PP_NetAddress_Private& addr) { |
86 if (!has_interface<PPB_NetAddress_Private>()) | 86 if (!has_interface<PPB_NetAddress_Private>()) |
87 return 0; | 87 return PP_NETADDRESSFAMILY_UNSPECIFIED; |
88 return get_interface<PPB_NetAddress_Private>()->GetFamily(&addr); | 88 return get_interface<PPB_NetAddress_Private>()->GetFamily(&addr); |
89 } | 89 } |
90 | 90 |
91 // static | 91 // static |
92 uint16_t NetAddressPrivate::GetPort(const PP_NetAddress_Private& addr) { | 92 uint16_t NetAddressPrivate::GetPort(const PP_NetAddress_Private& addr) { |
93 if (!has_interface<PPB_NetAddress_Private>()) | 93 if (!has_interface<PPB_NetAddress_Private>()) |
94 return 0; | 94 return 0; |
95 return get_interface<PPB_NetAddress_Private>()->GetPort(&addr); | 95 return get_interface<PPB_NetAddress_Private>()->GetPort(&addr); |
96 } | 96 } |
97 | 97 |
98 // static | 98 // static |
99 bool NetAddressPrivate::GetAddress(const PP_NetAddress_Private& addr, | 99 bool NetAddressPrivate::GetAddress(const PP_NetAddress_Private& addr, |
100 void* address, | 100 void* address, |
101 uint16_t address_size) { | 101 uint16_t address_size) { |
102 if (!has_interface<PPB_NetAddress_Private>()) | 102 if (!has_interface<PPB_NetAddress_Private>()) |
103 return false; | 103 return false; |
104 return PP_ToBool(get_interface<PPB_NetAddress_Private>()->GetAddress( | 104 return PP_ToBool(get_interface<PPB_NetAddress_Private>()->GetAddress( |
105 &addr, | 105 &addr, |
106 address, | 106 address, |
107 address_size)); | 107 address_size)); |
108 } | 108 } |
109 | 109 |
110 } // namespace pp | 110 } // namespace pp |
OLD | NEW |