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