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 #include "ppapi/proxy/network_list_resource.h" | 5 #include "ppapi/proxy/network_list_resource.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 uint32_t NetworkListResource::GetCount() { | 30 uint32_t NetworkListResource::GetCount() { |
31 return static_cast<uint32_t>(list_.size()); | 31 return static_cast<uint32_t>(list_.size()); |
32 } | 32 } |
33 | 33 |
34 PP_Var NetworkListResource::GetName(uint32_t index) { | 34 PP_Var NetworkListResource::GetName(uint32_t index) { |
35 if (index >= list_.size()) | 35 if (index >= list_.size()) |
36 return PP_MakeUndefined(); | 36 return PP_MakeUndefined(); |
37 return StringVar::StringToPPVar(list_.at(index).name); | 37 return StringVar::StringToPPVar(list_.at(index).name); |
38 } | 38 } |
39 | 39 |
40 PP_NetworkListType_Private NetworkListResource::GetType(uint32_t index) { | 40 PP_NetworkList_Type NetworkListResource::GetType(uint32_t index) { |
41 if (index >= list_.size()) | 41 if (index >= list_.size()) |
42 return PP_NETWORKLIST_UNKNOWN; | 42 return PP_NETWORKLIST_TYPE_UNKNOWN; |
43 return list_.at(index).type; | 43 return list_.at(index).type; |
44 } | 44 } |
45 | 45 |
46 PP_NetworkListState_Private NetworkListResource::GetState(uint32_t index) { | 46 PP_NetworkList_State NetworkListResource::GetState(uint32_t index) { |
47 if (index >= list_.size()) | 47 if (index >= list_.size()) |
48 return PP_NETWORKLIST_DOWN; | 48 return PP_NETWORKLIST_STATE_DOWN; |
49 return list_.at(index).state; | 49 return list_.at(index).state; |
50 } | 50 } |
51 | 51 |
52 int32_t NetworkListResource::GetIpAddresses(uint32_t index, | 52 int32_t NetworkListResource::GetIpAddresses(uint32_t index, |
53 const PP_ArrayOutput& output) { | 53 const PP_ArrayOutput& output) { |
54 ArrayWriter writer(output); | 54 ArrayWriter writer(output); |
55 if (index >= list_.size() || !writer.is_valid()) | 55 if (index >= list_.size() || !writer.is_valid()) |
56 return PP_ERROR_BADARGUMENT; | 56 return PP_ERROR_BADARGUMENT; |
57 | 57 |
58 thunk::EnterResourceCreationNoLock enter(pp_instance()); | 58 thunk::EnterResourceCreationNoLock enter(pp_instance()); |
(...skipping 21 matching lines...) Expand all Loading... |
80 } | 80 } |
81 | 81 |
82 uint32_t NetworkListResource::GetMTU(uint32_t index) { | 82 uint32_t NetworkListResource::GetMTU(uint32_t index) { |
83 if (index >= list_.size()) | 83 if (index >= list_.size()) |
84 return 0; | 84 return 0; |
85 return list_.at(index).mtu; | 85 return list_.at(index).mtu; |
86 } | 86 } |
87 | 87 |
88 } // namespace proxy | 88 } // namespace proxy |
89 } // namespace thunk | 89 } // namespace thunk |
OLD | NEW |