| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // From private/ppb_network_list_private.idl, | |
| 6 // modified Fri Aug 30 12:04:19 2013. | |
| 7 | |
| 8 #include "ppapi/c/pp_errors.h" | |
| 9 #include "ppapi/c/private/ppb_network_list_private.h" | |
| 10 #include "ppapi/shared_impl/tracked_callback.h" | |
| 11 #include "ppapi/thunk/enter.h" | |
| 12 #include "ppapi/thunk/ppb_instance_api.h" | |
| 13 #include "ppapi/thunk/ppb_network_list_api.h" | |
| 14 #include "ppapi/thunk/resource_creation_api.h" | |
| 15 #include "ppapi/thunk/thunk.h" | |
| 16 | |
| 17 namespace ppapi { | |
| 18 namespace thunk { | |
| 19 | |
| 20 namespace { | |
| 21 | |
| 22 PP_Bool IsNetworkList(PP_Resource resource) { | |
| 23 VLOG(4) << "PPB_NetworkList_Private::IsNetworkList()"; | |
| 24 EnterResource<PPB_NetworkList_API> enter(resource, false); | |
| 25 return PP_FromBool(enter.succeeded()); | |
| 26 } | |
| 27 | |
| 28 uint32_t GetCount(PP_Resource resource) { | |
| 29 VLOG(4) << "PPB_NetworkList_Private::GetCount()"; | |
| 30 EnterResource<PPB_NetworkList_API> enter(resource, true); | |
| 31 if (enter.failed()) | |
| 32 return 0; | |
| 33 return enter.object()->GetCount(); | |
| 34 } | |
| 35 | |
| 36 struct PP_Var GetName(PP_Resource resource, uint32_t index) { | |
| 37 VLOG(4) << "PPB_NetworkList_Private::GetName()"; | |
| 38 EnterResource<PPB_NetworkList_API> enter(resource, true); | |
| 39 if (enter.failed()) | |
| 40 return PP_MakeUndefined(); | |
| 41 return enter.object()->GetName(index); | |
| 42 } | |
| 43 | |
| 44 PP_NetworkListType_Private GetType(PP_Resource resource, uint32_t index) { | |
| 45 VLOG(4) << "PPB_NetworkList_Private::GetType()"; | |
| 46 EnterResource<PPB_NetworkList_API> enter(resource, true); | |
| 47 if (enter.failed()) | |
| 48 return PP_NETWORKLIST_UNKNOWN; | |
| 49 return enter.object()->GetType(index); | |
| 50 } | |
| 51 | |
| 52 PP_NetworkListState_Private GetState(PP_Resource resource, uint32_t index) { | |
| 53 VLOG(4) << "PPB_NetworkList_Private::GetState()"; | |
| 54 EnterResource<PPB_NetworkList_API> enter(resource, true); | |
| 55 if (enter.failed()) | |
| 56 return PP_NETWORKLIST_DOWN; | |
| 57 return enter.object()->GetState(index); | |
| 58 } | |
| 59 | |
| 60 int32_t GetIpAddresses(PP_Resource resource, | |
| 61 uint32_t index, | |
| 62 struct PP_ArrayOutput output) { | |
| 63 VLOG(4) << "PPB_NetworkList_Private::GetIpAddresses()"; | |
| 64 EnterResource<PPB_NetworkList_API> enter(resource, true); | |
| 65 if (enter.failed()) | |
| 66 return enter.retval(); | |
| 67 return enter.object()->GetIpAddresses(index, output); | |
| 68 } | |
| 69 | |
| 70 struct PP_Var GetDisplayName(PP_Resource resource, uint32_t index) { | |
| 71 VLOG(4) << "PPB_NetworkList_Private::GetDisplayName()"; | |
| 72 EnterResource<PPB_NetworkList_API> enter(resource, true); | |
| 73 if (enter.failed()) | |
| 74 return PP_MakeUndefined(); | |
| 75 return enter.object()->GetDisplayName(index); | |
| 76 } | |
| 77 | |
| 78 uint32_t GetMTU(PP_Resource resource, uint32_t index) { | |
| 79 VLOG(4) << "PPB_NetworkList_Private::GetMTU()"; | |
| 80 EnterResource<PPB_NetworkList_API> enter(resource, true); | |
| 81 if (enter.failed()) | |
| 82 return 0; | |
| 83 return enter.object()->GetMTU(index); | |
| 84 } | |
| 85 | |
| 86 const PPB_NetworkList_Private_0_3 g_ppb_networklist_private_thunk_0_3 = { | |
| 87 &IsNetworkList, | |
| 88 &GetCount, | |
| 89 &GetName, | |
| 90 &GetType, | |
| 91 &GetState, | |
| 92 &GetIpAddresses, | |
| 93 &GetDisplayName, | |
| 94 &GetMTU | |
| 95 }; | |
| 96 | |
| 97 } // namespace | |
| 98 | |
| 99 const PPB_NetworkList_Private_0_3* GetPPB_NetworkList_Private_0_3_Thunk() { | |
| 100 return &g_ppb_networklist_private_thunk_0_3; | |
| 101 } | |
| 102 | |
| 103 } // namespace thunk | |
| 104 } // namespace ppapi | |
| OLD | NEW |