OLD | NEW |
(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 #include "ppapi/thunk/enter.h" |
| 6 #include "ppapi/thunk/ppb_device_ref_api.h" |
| 7 #include "ppapi/thunk/thunk.h" |
| 8 |
| 9 namespace ppapi { |
| 10 namespace thunk { |
| 11 |
| 12 namespace { |
| 13 |
| 14 PP_Bool IsDeviceRef(PP_Resource resource) { |
| 15 EnterResource<PPB_DeviceRef_API> enter(resource, false); |
| 16 return enter.succeeded() ? PP_TRUE : PP_FALSE; |
| 17 } |
| 18 |
| 19 PP_DeviceType_Dev GetType(PP_Resource device_ref) { |
| 20 EnterResource<PPB_DeviceRef_API> enter(device_ref, true); |
| 21 if (enter.failed()) |
| 22 return PP_DEVICETYPE_INVALID; |
| 23 return enter.object()->GetType(); |
| 24 } |
| 25 |
| 26 PP_Var GetName(PP_Resource device_ref) { |
| 27 EnterResource<PPB_DeviceRef_API> enter(device_ref, true); |
| 28 if (enter.failed()) |
| 29 return PP_MakeUndefined(); |
| 30 return enter.object()->GetName(); |
| 31 } |
| 32 |
| 33 const PPB_DeviceRef_Dev g_ppb_device_ref_thunk = { |
| 34 &IsDeviceRef, |
| 35 &GetType, |
| 36 &GetName |
| 37 }; |
| 38 |
| 39 } // namespace |
| 40 |
| 41 const PPB_DeviceRef_Dev_0_1* GetPPB_DeviceRef_Dev_0_1_Thunk() { |
| 42 return &g_ppb_device_ref_thunk; |
| 43 } |
| 44 |
| 45 } // namespace thunk |
| 46 } // namespace ppapi |
OLD | NEW |