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

Side by Side Diff: ppapi/thunk/ppb_network_list_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
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 Mon Sep 9 11:18:02 2013.
6 // modified Fri Aug 30 12:04:19 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_NetworkList_Type 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_TYPE_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_NetworkList_State 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_STATE_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_ArrayOutput output) { 61 struct PP_ArrayOutput output) {
63 VLOG(4) << "PPB_NetworkList_Private::GetIpAddresses()"; 62 VLOG(4) << "PPB_NetworkList::GetIpAddresses()";
64 EnterResource<PPB_NetworkList_API> enter(resource, true); 63 EnterResource<PPB_NetworkList_API> enter(resource, true);
65 if (enter.failed()) 64 if (enter.failed())
66 return enter.retval(); 65 return enter.retval();
67 return enter.object()->GetIpAddresses(index, output); 66 return enter.object()->GetIpAddresses(index, output);
68 } 67 }
69 68
70 struct PP_Var GetDisplayName(PP_Resource resource, uint32_t index) { 69 struct PP_Var GetDisplayName(PP_Resource resource, uint32_t index) {
71 VLOG(4) << "PPB_NetworkList_Private::GetDisplayName()"; 70 VLOG(4) << "PPB_NetworkList::GetDisplayName()";
72 EnterResource<PPB_NetworkList_API> enter(resource, true); 71 EnterResource<PPB_NetworkList_API> enter(resource, true);
73 if (enter.failed()) 72 if (enter.failed())
74 return PP_MakeUndefined(); 73 return PP_MakeUndefined();
75 return enter.object()->GetDisplayName(index); 74 return enter.object()->GetDisplayName(index);
76 } 75 }
77 76
78 uint32_t GetMTU(PP_Resource resource, uint32_t index) { 77 uint32_t GetMTU(PP_Resource resource, uint32_t index) {
79 VLOG(4) << "PPB_NetworkList_Private::GetMTU()"; 78 VLOG(4) << "PPB_NetworkList::GetMTU()";
80 EnterResource<PPB_NetworkList_API> enter(resource, true); 79 EnterResource<PPB_NetworkList_API> enter(resource, true);
81 if (enter.failed()) 80 if (enter.failed())
82 return 0; 81 return 0;
83 return enter.object()->GetMTU(index); 82 return enter.object()->GetMTU(index);
84 } 83 }
85 84
86 const PPB_NetworkList_Private_0_3 g_ppb_networklist_private_thunk_0_3 = { 85 const PPB_NetworkList_1_0 g_ppb_networklist_thunk_1_0 = {
87 &IsNetworkList, 86 &IsNetworkList,
88 &GetCount, 87 &GetCount,
89 &GetName, 88 &GetName,
90 &GetType, 89 &GetType,
91 &GetState, 90 &GetState,
92 &GetIpAddresses, 91 &GetIpAddresses,
93 &GetDisplayName, 92 &GetDisplayName,
94 &GetMTU 93 &GetMTU
95 }; 94 };
96 95
97 } // namespace 96 } // namespace
98 97
99 const PPB_NetworkList_Private_0_3* GetPPB_NetworkList_Private_0_3_Thunk() { 98 const PPB_NetworkList_1_0* GetPPB_NetworkList_1_0_Thunk() {
100 return &g_ppb_networklist_private_thunk_0_3; 99 return &g_ppb_networklist_thunk_1_0;
101 } 100 }
102 101
103 } // namespace thunk 102 } // namespace thunk
104 } // namespace ppapi 103 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698