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