Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Side by Side Diff: ppapi/thunk/ppb_network_list_private_thunk.cc

Issue 23450012: Make NetworkList and NetworkMonitor APIs public (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 Tue Apr 16 11:25:45 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_NetAddress_Private addresses[],
63 uint32_t count) {
64 VLOG(4) << "PPB_NetworkList_Private::GetIpAddresses()";
65 EnterResource<PPB_NetworkList_API> enter(resource, true);
66 if (enter.failed())
67 return enter.retval();
68 return enter.object()->GetIpAddresses(index, addresses, count);
69 }
70
71 struct PP_Var GetDisplayName(PP_Resource resource, uint32_t index) {
72 VLOG(4) << "PPB_NetworkList_Private::GetDisplayName()";
73 EnterResource<PPB_NetworkList_API> enter(resource, true);
74 if (enter.failed())
75 return PP_MakeUndefined();
76 return enter.object()->GetDisplayName(index);
77 }
78
79 uint32_t GetMTU(PP_Resource resource, uint32_t index) {
80 VLOG(4) << "PPB_NetworkList_Private::GetMTU()";
81 EnterResource<PPB_NetworkList_API> enter(resource, true);
82 if (enter.failed())
83 return 0;
84 return enter.object()->GetMTU(index);
85 }
86
87 const PPB_NetworkList_Private_0_2 g_ppb_networklist_private_thunk_0_2 = {
88 &IsNetworkList,
89 &GetCount,
90 &GetName,
91 &GetType,
92 &GetState,
93 &GetIpAddresses,
94 &GetDisplayName,
95 &GetMTU
96 };
97
98 } // namespace
99
100 const PPB_NetworkList_Private_0_2* GetPPB_NetworkList_Private_0_2_Thunk() {
101 return &g_ppb_networklist_private_thunk_0_2;
102 }
103
104 } // namespace thunk
105 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698