Modified code to report caret offset and text selection in all editable text and...
[chromium-blink-merge.git] / ppapi / thunk / ppb_network_list_thunk.cc
blob5a108102d04a82e6c0e6814c6553a5afa0c3858f
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.
5 // From ppb_network_list.idl modified Fri Nov 1 16:12:12 2013.
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/ppb_network_list.h"
9 #include "ppapi/shared_impl/tracked_callback.h"
10 #include "ppapi/thunk/enter.h"
11 #include "ppapi/thunk/ppapi_thunk_export.h"
12 #include "ppapi/thunk/ppb_network_list_api.h"
14 namespace ppapi {
15 namespace thunk {
17 namespace {
19 PP_Bool IsNetworkList(PP_Resource resource) {
20 VLOG(4) << "PPB_NetworkList::IsNetworkList()";
21 EnterResource<PPB_NetworkList_API> enter(resource, false);
22 return PP_FromBool(enter.succeeded());
25 uint32_t GetCount(PP_Resource resource) {
26 VLOG(4) << "PPB_NetworkList::GetCount()";
27 EnterResource<PPB_NetworkList_API> enter(resource, true);
28 if (enter.failed())
29 return 0;
30 return enter.object()->GetCount();
33 struct PP_Var GetName(PP_Resource resource, uint32_t index) {
34 VLOG(4) << "PPB_NetworkList::GetName()";
35 EnterResource<PPB_NetworkList_API> enter(resource, true);
36 if (enter.failed())
37 return PP_MakeUndefined();
38 return enter.object()->GetName(index);
41 PP_NetworkList_Type GetType(PP_Resource resource, uint32_t index) {
42 VLOG(4) << "PPB_NetworkList::GetType()";
43 EnterResource<PPB_NetworkList_API> enter(resource, true);
44 if (enter.failed())
45 return PP_NETWORKLIST_TYPE_UNKNOWN;
46 return enter.object()->GetType(index);
49 PP_NetworkList_State GetState(PP_Resource resource, uint32_t index) {
50 VLOG(4) << "PPB_NetworkList::GetState()";
51 EnterResource<PPB_NetworkList_API> enter(resource, true);
52 if (enter.failed())
53 return PP_NETWORKLIST_STATE_DOWN;
54 return enter.object()->GetState(index);
57 int32_t GetIpAddresses(PP_Resource resource,
58 uint32_t index,
59 struct PP_ArrayOutput output) {
60 VLOG(4) << "PPB_NetworkList::GetIpAddresses()";
61 EnterResource<PPB_NetworkList_API> enter(resource, true);
62 if (enter.failed())
63 return enter.retval();
64 return enter.object()->GetIpAddresses(index, output);
67 struct PP_Var GetDisplayName(PP_Resource resource, uint32_t index) {
68 VLOG(4) << "PPB_NetworkList::GetDisplayName()";
69 EnterResource<PPB_NetworkList_API> enter(resource, true);
70 if (enter.failed())
71 return PP_MakeUndefined();
72 return enter.object()->GetDisplayName(index);
75 uint32_t GetMTU(PP_Resource resource, uint32_t index) {
76 VLOG(4) << "PPB_NetworkList::GetMTU()";
77 EnterResource<PPB_NetworkList_API> enter(resource, true);
78 if (enter.failed())
79 return 0;
80 return enter.object()->GetMTU(index);
83 const PPB_NetworkList_1_0 g_ppb_networklist_thunk_1_0 = {&IsNetworkList,
84 &GetCount,
85 &GetName,
86 &GetType,
87 &GetState,
88 &GetIpAddresses,
89 &GetDisplayName,
90 &GetMTU};
92 } // namespace
94 PPAPI_THUNK_EXPORT const PPB_NetworkList_1_0* GetPPB_NetworkList_1_0_Thunk() {
95 return &g_ppb_networklist_thunk_1_0;
98 } // namespace thunk
99 } // namespace ppapi