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/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" | 11 #include "ppapi/c/private/ppb_net_address_private.h" |
12 | 12 |
13 namespace pp { | 13 namespace pp { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 template <> const char* interface_name<PPB_NetAddress_Private>() { | 17 template <> const char* interface_name<PPB_NetAddress_Private>() { |
18 return PPB_NETADDRESS_PRIVATE_INTERFACE; | 18 return PPB_NETADDRESS_PRIVATE_INTERFACE; |
19 } | 19 } |
20 | 20 |
21 } // namespace | 21 } // namespace |
22 | 22 |
23 // static | 23 // static |
| 24 bool NetAddressPrivate::IsAvailable() { |
| 25 return has_interface<PPB_NetAddress_Private>(); |
| 26 } |
| 27 |
| 28 // static |
24 bool NetAddressPrivate::AreEqual(const PP_NetAddress_Private& addr1, | 29 bool NetAddressPrivate::AreEqual(const PP_NetAddress_Private& addr1, |
25 const PP_NetAddress_Private& addr2) { | 30 const PP_NetAddress_Private& addr2) { |
26 if (!has_interface<PPB_NetAddress_Private>()) | 31 if (!has_interface<PPB_NetAddress_Private>()) |
27 return false; | 32 return false; |
28 return !!get_interface<PPB_NetAddress_Private>()->AreEqual(&addr1, &addr2); | 33 return !!get_interface<PPB_NetAddress_Private>()->AreEqual(&addr1, &addr2); |
29 } | 34 } |
30 | 35 |
31 // static | 36 // static |
32 bool NetAddressPrivate::AreHostsEqual(const PP_NetAddress_Private& addr1, | 37 bool NetAddressPrivate::AreHostsEqual(const PP_NetAddress_Private& addr1, |
33 const PP_NetAddress_Private& addr2) { | 38 const PP_NetAddress_Private& addr2) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // static | 74 // static |
70 void NetAddressPrivate::GetAnyAddress(bool is_ipv6, | 75 void NetAddressPrivate::GetAnyAddress(bool is_ipv6, |
71 PP_NetAddress_Private* addr) { | 76 PP_NetAddress_Private* addr) { |
72 if (!has_interface<PPB_NetAddress_Private>()) | 77 if (!has_interface<PPB_NetAddress_Private>()) |
73 return; | 78 return; |
74 get_interface<PPB_NetAddress_Private>()->GetAnyAddress(PP_FromBool(is_ipv6), | 79 get_interface<PPB_NetAddress_Private>()->GetAnyAddress(PP_FromBool(is_ipv6), |
75 addr); | 80 addr); |
76 } | 81 } |
77 | 82 |
78 } // namespace pp | 83 } // namespace pp |
OLD | NEW |