| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 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/cpp/dev/url_request_info_dev.h" | |
| 6 | |
| 7 #include "ppapi/cpp/common.h" | |
| 8 #include "ppapi/cpp/dev/file_ref_dev.h" | |
| 9 #include "ppapi/cpp/module.h" | |
| 10 #include "ppapi/cpp/module_impl.h" | |
| 11 | |
| 12 namespace { | |
| 13 | |
| 14 DeviceFuncs<PPB_URLRequestInfo_Dev> url_request_info_f( | |
| 15 PPB_URLREQUESTINFO_DEV_INTERFACE); | |
| 16 | |
| 17 } // namespace | |
| 18 | |
| 19 namespace pp { | |
| 20 | |
| 21 URLRequestInfo_Dev::URLRequestInfo_Dev() { | |
| 22 if (!url_request_info_f) | |
| 23 return; | |
| 24 PassRefFromConstructor( | |
| 25 url_request_info_f->Create(Module::Get()->pp_module())); | |
| 26 } | |
| 27 | |
| 28 URLRequestInfo_Dev::URLRequestInfo_Dev(const URLRequestInfo_Dev& other) | |
| 29 : Resource(other) { | |
| 30 } | |
| 31 | |
| 32 URLRequestInfo_Dev& URLRequestInfo_Dev::operator=( | |
| 33 const URLRequestInfo_Dev& other) { | |
| 34 URLRequestInfo_Dev copy(other); | |
| 35 swap(copy); | |
| 36 return *this; | |
| 37 } | |
| 38 | |
| 39 void URLRequestInfo_Dev::swap(URLRequestInfo_Dev& other) { | |
| 40 Resource::swap(other); | |
| 41 } | |
| 42 | |
| 43 bool URLRequestInfo_Dev::SetProperty(PP_URLRequestProperty_Dev property, | |
| 44 const Var& value) { | |
| 45 if (!url_request_info_f) | |
| 46 return false; | |
| 47 return PPBoolToBool(url_request_info_f->SetProperty(pp_resource(), | |
| 48 property, | |
| 49 value.pp_var())); | |
| 50 } | |
| 51 | |
| 52 bool URLRequestInfo_Dev::AppendDataToBody(const char* data, uint32_t len) { | |
| 53 if (!url_request_info_f) | |
| 54 return false; | |
| 55 return PPBoolToBool(url_request_info_f->AppendDataToBody(pp_resource(), | |
| 56 data, | |
| 57 len)); | |
| 58 } | |
| 59 | |
| 60 bool URLRequestInfo_Dev::AppendFileToBody( | |
| 61 const FileRef_Dev& file_ref, | |
| 62 PP_Time expected_last_modified_time) { | |
| 63 if (!url_request_info_f) | |
| 64 return false; | |
| 65 return PPBoolToBool( | |
| 66 url_request_info_f->AppendFileToBody(pp_resource(), | |
| 67 file_ref.pp_resource(), | |
| 68 0, | |
| 69 -1, | |
| 70 expected_last_modified_time)); | |
| 71 } | |
| 72 | |
| 73 bool URLRequestInfo_Dev::AppendFileRangeToBody( | |
| 74 const FileRef_Dev& file_ref, | |
| 75 int64_t start_offset, | |
| 76 int64_t length, | |
| 77 PP_Time expected_last_modified_time) { | |
| 78 return PPBoolToBool( | |
| 79 url_request_info_f->AppendFileToBody(pp_resource(), | |
| 80 file_ref.pp_resource(), | |
| 81 start_offset, | |
| 82 length, | |
| 83 expected_last_modified_time)); | |
| 84 } | |
| 85 | |
| 86 } // namespace pp | |
| OLD | NEW |