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/network_list_private.h" | 5 #include "ppapi/cpp/private/network_list_private.h" |
6 | 6 |
7 #include "ppapi/cpp/module_impl.h" | 7 #include "ppapi/cpp/module_impl.h" |
8 #include "ppapi/cpp/var.h" | 8 #include "ppapi/cpp/var.h" |
9 | 9 |
10 namespace pp { | 10 namespace pp { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 return get_interface<PPB_NetworkList_Private>()->GetState( | 57 return get_interface<PPB_NetworkList_Private>()->GetState( |
58 pp_resource(), index); | 58 pp_resource(), index); |
59 } | 59 } |
60 | 60 |
61 void NetworkListPrivate::GetIpAddresses( | 61 void NetworkListPrivate::GetIpAddresses( |
62 uint32_t index, | 62 uint32_t index, |
63 std::vector<PP_NetAddress_Private>* addresses) const { | 63 std::vector<PP_NetAddress_Private>* addresses) const { |
64 if (!has_interface<PPB_NetworkList_Private>()) | 64 if (!has_interface<PPB_NetworkList_Private>()) |
65 return; | 65 return; |
66 | 66 |
67 // Most netword interfaces don't have more than 3 network | 67 // Most network interfaces don't have more than 3 network |
68 // interfaces. | 68 // interfaces. |
69 addresses->resize(3); | 69 addresses->resize(3); |
70 | 70 |
71 int32_t result = get_interface<PPB_NetworkList_Private>()->GetIpAddresses( | 71 int32_t result = get_interface<PPB_NetworkList_Private>()->GetIpAddresses( |
72 pp_resource(), index, &addresses->front(), addresses->size()); | 72 pp_resource(), index, &addresses->front(), addresses->size()); |
73 | 73 |
74 if (result < 0) { | 74 if (result < 0) { |
75 addresses->resize(0); | 75 addresses->resize(0); |
76 return; | 76 return; |
77 } | 77 } |
(...skipping 23 matching lines...) Expand all Loading... |
101 } | 101 } |
102 | 102 |
103 uint32_t NetworkListPrivate::GetMTU(uint32_t index) const { | 103 uint32_t NetworkListPrivate::GetMTU(uint32_t index) const { |
104 if (!has_interface<PPB_NetworkList_Private>()) | 104 if (!has_interface<PPB_NetworkList_Private>()) |
105 return 0; | 105 return 0; |
106 return get_interface<PPB_NetworkList_Private>()->GetMTU( | 106 return get_interface<PPB_NetworkList_Private>()->GetMTU( |
107 pp_resource(), index); | 107 pp_resource(), index); |
108 } | 108 } |
109 | 109 |
110 } // namespace pp | 110 } // namespace pp |
OLD | NEW |