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 ppb_url_response_info.idl modified Thu Apr 25 13:21:08 2013. 6 7 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/c/ppb_url_response_info.h" 9 #include "ppapi/shared_impl/tracked_callback.h" 10 #include "ppapi/thunk/enter.h" 11 #include "ppapi/thunk/ppb_instance_api.h" 12 #include "ppapi/thunk/ppb_url_response_info_api.h" 13 #include "ppapi/thunk/resource_creation_api.h" 14 #include "ppapi/thunk/thunk.h" 15 16 namespace ppapi { 17 namespace thunk { 18 19 namespace { 20 21 PP_Bool IsURLResponseInfo(PP_Resource resource) { 22 VLOG(4) << "PPB_URLResponseInfo::IsURLResponseInfo()"; 23 EnterResource<PPB_URLResponseInfo_API> enter(resource, false); 24 return PP_FromBool(enter.succeeded()); 25 } 26 27 struct PP_Var GetProperty(PP_Resource response, 28 PP_URLResponseProperty property) { 29 VLOG(4) << "PPB_URLResponseInfo::GetProperty()"; 30 EnterResource<PPB_URLResponseInfo_API> enter(response, true); 31 if (enter.failed()) 32 return PP_MakeUndefined(); 33 return enter.object()->GetProperty(property); 34 } 35 36 PP_Resource GetBodyAsFileRef(PP_Resource response) { 37 VLOG(4) << "PPB_URLResponseInfo::GetBodyAsFileRef()"; 38 EnterResource<PPB_URLResponseInfo_API> enter(response, true); 39 if (enter.failed()) 40 return 0; 41 return enter.object()->GetBodyAsFileRef(); 42 } 43 44 const PPB_URLResponseInfo_1_0 g_ppb_urlresponseinfo_thunk_1_0 = { 45 &IsURLResponseInfo, 46 &GetProperty, 47 &GetBodyAsFileRef 48 }; 49 50 } // namespace 51 52 const PPB_URLResponseInfo_1_0* GetPPB_URLResponseInfo_1_0_Thunk() { 53 return &g_ppb_urlresponseinfo_thunk_1_0; 54 } 55 56 } // namespace thunk 57 } // namespace ppapi 58