Roll Syzygy deps to 0.8.6.4.
[chromium-blink-merge.git] / ppapi / thunk / ppb_url_request_info_thunk.cc
blobaa546ba9db8210d7b010b7c0e629f12b8723fe69
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.
5 // From ppb_url_request_info.idl modified Mon May 6 10:11:29 2013.
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/ppb_url_request_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_request_info_api.h"
14 namespace ppapi {
15 namespace thunk {
17 namespace {
19 PP_Resource Create(PP_Instance instance) {
20 VLOG(4) << "PPB_URLRequestInfo::Create()";
21 EnterResourceCreation enter(instance);
22 if (enter.failed())
23 return 0;
24 return enter.functions()->CreateURLRequestInfo(instance);
27 PP_Bool IsURLRequestInfo(PP_Resource resource) {
28 VLOG(4) << "PPB_URLRequestInfo::IsURLRequestInfo()";
29 EnterResource<PPB_URLRequestInfo_API> enter(resource, false);
30 return PP_FromBool(enter.succeeded());
33 PP_Bool SetProperty(PP_Resource request,
34 PP_URLRequestProperty property,
35 struct PP_Var value) {
36 VLOG(4) << "PPB_URLRequestInfo::SetProperty()";
37 EnterResource<PPB_URLRequestInfo_API> enter(request, true);
38 if (enter.failed())
39 return PP_FALSE;
40 return enter.object()->SetProperty(property, value);
43 PP_Bool AppendDataToBody(PP_Resource request, const void* data, uint32_t len) {
44 VLOG(4) << "PPB_URLRequestInfo::AppendDataToBody()";
45 EnterResource<PPB_URLRequestInfo_API> enter(request, true);
46 if (enter.failed())
47 return PP_FALSE;
48 return enter.object()->AppendDataToBody(data, len);
51 PP_Bool AppendFileToBody(PP_Resource request,
52 PP_Resource file_ref,
53 int64_t start_offset,
54 int64_t number_of_bytes,
55 PP_Time expected_last_modified_time) {
56 VLOG(4) << "PPB_URLRequestInfo::AppendFileToBody()";
57 EnterResource<PPB_URLRequestInfo_API> enter(request, true);
58 if (enter.failed())
59 return PP_FALSE;
60 return enter.object()->AppendFileToBody(
61 file_ref, start_offset, number_of_bytes, expected_last_modified_time);
64 const PPB_URLRequestInfo_1_0 g_ppb_urlrequestinfo_thunk_1_0 = {
65 &Create,
66 &IsURLRequestInfo,
67 &SetProperty,
68 &AppendDataToBody,
69 &AppendFileToBody};
71 } // namespace
73 PPAPI_THUNK_EXPORT const PPB_URLRequestInfo_1_0*
74 GetPPB_URLRequestInfo_1_0_Thunk() {
75 return &g_ppb_urlrequestinfo_thunk_1_0;
78 } // namespace thunk
79 } // namespace ppapi