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 #include "ppapi/cpp/url_request_info.h"
7 #include "ppapi/cpp/file_ref.h"
8 #include "ppapi/cpp/instance_handle.h"
9 #include "ppapi/cpp/module.h"
10 #include "ppapi/cpp/module_impl.h"
16 template <> const char* interface_name
<PPB_URLRequestInfo_1_0
>() {
17 return PPB_URLREQUESTINFO_INTERFACE_1_0
;
22 URLRequestInfo::URLRequestInfo(const InstanceHandle
& instance
) {
23 if (!has_interface
<PPB_URLRequestInfo_1_0
>())
25 PassRefFromConstructor(
26 get_interface
<PPB_URLRequestInfo_1_0
>()->Create(instance
.pp_instance()));
29 URLRequestInfo::URLRequestInfo(const URLRequestInfo
& other
)
33 bool URLRequestInfo::SetProperty(PP_URLRequestProperty property
,
35 if (!has_interface
<PPB_URLRequestInfo_1_0
>())
37 return PP_ToBool(get_interface
<PPB_URLRequestInfo_1_0
>()->SetProperty(
38 pp_resource(), property
, value
.pp_var()));
41 bool URLRequestInfo::AppendDataToBody(const void* data
, uint32_t len
) {
42 if (!has_interface
<PPB_URLRequestInfo_1_0
>())
44 return PP_ToBool(get_interface
<PPB_URLRequestInfo_1_0
>()->AppendDataToBody(
45 pp_resource(), data
, len
));
48 bool URLRequestInfo::AppendFileToBody(const FileRef
& file_ref
,
49 PP_Time expected_last_modified_time
) {
50 if (!has_interface
<PPB_URLRequestInfo_1_0
>())
53 get_interface
<PPB_URLRequestInfo_1_0
>()->AppendFileToBody(
55 file_ref
.pp_resource(),
58 expected_last_modified_time
));
61 bool URLRequestInfo::AppendFileRangeToBody(
62 const FileRef
& file_ref
,
65 PP_Time expected_last_modified_time
) {
66 if (!has_interface
<PPB_URLRequestInfo_1_0
>())
68 return PP_ToBool(get_interface
<PPB_URLRequestInfo_1_0
>()->AppendFileToBody(
70 file_ref
.pp_resource(),
73 expected_last_modified_time
));