ppb_url_response_info_thunk.cc 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. // From ppb_url_response_info.idl modified Wed Jan 27 17:10:16 2016.
  5. #include <stdint.h>
  6. #include "base/logging.h"
  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/ppapi_thunk_export.h"
  12. #include "ppapi/thunk/ppb_url_response_info_api.h"
  13. namespace ppapi {
  14. namespace thunk {
  15. namespace {
  16. PP_Bool IsURLResponseInfo(PP_Resource resource) {
  17. VLOG(4) << "PPB_URLResponseInfo::IsURLResponseInfo()";
  18. EnterResource<PPB_URLResponseInfo_API> enter(resource, false);
  19. return PP_FromBool(enter.succeeded());
  20. }
  21. struct PP_Var GetProperty(PP_Resource response,
  22. PP_URLResponseProperty property) {
  23. VLOG(4) << "PPB_URLResponseInfo::GetProperty()";
  24. EnterResource<PPB_URLResponseInfo_API> enter(response, true);
  25. if (enter.failed())
  26. return PP_MakeUndefined();
  27. return enter.object()->GetProperty(property);
  28. }
  29. PP_Resource GetBodyAsFileRef(PP_Resource response) {
  30. VLOG(4) << "PPB_URLResponseInfo::GetBodyAsFileRef()";
  31. EnterResource<PPB_URLResponseInfo_API> enter(response, true);
  32. if (enter.failed())
  33. return 0;
  34. return enter.object()->GetBodyAsFileRef();
  35. }
  36. const PPB_URLResponseInfo_1_0 g_ppb_urlresponseinfo_thunk_1_0 = {
  37. &IsURLResponseInfo, &GetProperty, &GetBodyAsFileRef};
  38. } // namespace
  39. PPAPI_THUNK_EXPORT const PPB_URLResponseInfo_1_0*
  40. GetPPB_URLResponseInfo_1_0_Thunk() {
  41. return &g_ppb_urlresponseinfo_thunk_1_0;
  42. }
  43. } // namespace thunk
  44. } // namespace ppapi