| 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/url_request_info.h" | 5 #include "ppapi/cpp/url_request_info.h" |
| 6 | 6 |
| 7 #include "ppapi/cpp/common.h" | |
| 8 #include "ppapi/cpp/dev/file_ref_dev.h" | 7 #include "ppapi/cpp/dev/file_ref_dev.h" |
| 9 #include "ppapi/cpp/instance.h" | 8 #include "ppapi/cpp/instance.h" |
| 10 #include "ppapi/cpp/module.h" | 9 #include "ppapi/cpp/module.h" |
| 11 #include "ppapi/cpp/module_impl.h" | 10 #include "ppapi/cpp/module_impl.h" |
| 12 | 11 |
| 13 namespace pp { | 12 namespace pp { |
| 14 | 13 |
| 15 namespace { | 14 namespace { |
| 16 | 15 |
| 17 template <> const char* interface_name<PPB_URLRequestInfo>() { | 16 template <> const char* interface_name<PPB_URLRequestInfo>() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 28 } | 27 } |
| 29 | 28 |
| 30 URLRequestInfo::URLRequestInfo(const URLRequestInfo& other) | 29 URLRequestInfo::URLRequestInfo(const URLRequestInfo& other) |
| 31 : Resource(other) { | 30 : Resource(other) { |
| 32 } | 31 } |
| 33 | 32 |
| 34 bool URLRequestInfo::SetProperty(PP_URLRequestProperty property, | 33 bool URLRequestInfo::SetProperty(PP_URLRequestProperty property, |
| 35 const Var& value) { | 34 const Var& value) { |
| 36 if (!has_interface<PPB_URLRequestInfo>()) | 35 if (!has_interface<PPB_URLRequestInfo>()) |
| 37 return false; | 36 return false; |
| 38 return PPBoolToBool(get_interface<PPB_URLRequestInfo>()->SetProperty( | 37 return PP_ToBool(get_interface<PPB_URLRequestInfo>()->SetProperty( |
| 39 pp_resource(), property, value.pp_var())); | 38 pp_resource(), property, value.pp_var())); |
| 40 } | 39 } |
| 41 | 40 |
| 42 bool URLRequestInfo::AppendDataToBody(const void* data, uint32_t len) { | 41 bool URLRequestInfo::AppendDataToBody(const void* data, uint32_t len) { |
| 43 if (!has_interface<PPB_URLRequestInfo>()) | 42 if (!has_interface<PPB_URLRequestInfo>()) |
| 44 return false; | 43 return false; |
| 45 return PPBoolToBool(get_interface<PPB_URLRequestInfo>()->AppendDataToBody( | 44 return PP_ToBool(get_interface<PPB_URLRequestInfo>()->AppendDataToBody( |
| 46 pp_resource(), data, len)); | 45 pp_resource(), data, len)); |
| 47 } | 46 } |
| 48 | 47 |
| 49 bool URLRequestInfo::AppendFileToBody(const FileRef_Dev& file_ref, | 48 bool URLRequestInfo::AppendFileToBody(const FileRef_Dev& file_ref, |
| 50 PP_Time expected_last_modified_time) { | 49 PP_Time expected_last_modified_time) { |
| 51 if (!has_interface<PPB_URLRequestInfo>()) | 50 if (!has_interface<PPB_URLRequestInfo>()) |
| 52 return false; | 51 return false; |
| 53 return PPBoolToBool( | 52 return PP_ToBool( |
| 54 get_interface<PPB_URLRequestInfo>()->AppendFileToBody( | 53 get_interface<PPB_URLRequestInfo>()->AppendFileToBody( |
| 55 pp_resource(), | 54 pp_resource(), |
| 56 file_ref.pp_resource(), | 55 file_ref.pp_resource(), |
| 57 0, | 56 0, |
| 58 -1, | 57 -1, |
| 59 expected_last_modified_time)); | 58 expected_last_modified_time)); |
| 60 } | 59 } |
| 61 | 60 |
| 62 bool URLRequestInfo::AppendFileRangeToBody( | 61 bool URLRequestInfo::AppendFileRangeToBody( |
| 63 const FileRef_Dev& file_ref, | 62 const FileRef_Dev& file_ref, |
| 64 int64_t start_offset, | 63 int64_t start_offset, |
| 65 int64_t length, | 64 int64_t length, |
| 66 PP_Time expected_last_modified_time) { | 65 PP_Time expected_last_modified_time) { |
| 67 if (!has_interface<PPB_URLRequestInfo>()) | 66 if (!has_interface<PPB_URLRequestInfo>()) |
| 68 return false; | 67 return false; |
| 69 return PPBoolToBool( | 68 return PP_ToBool(get_interface<PPB_URLRequestInfo>()->AppendFileToBody( |
| 70 get_interface<PPB_URLRequestInfo>()->AppendFileToBody( | 69 pp_resource(), |
| 71 pp_resource(), | 70 file_ref.pp_resource(), |
| 72 file_ref.pp_resource(), | 71 start_offset, |
| 73 start_offset, | 72 length, |
| 74 length, | 73 expected_last_modified_time)); |
| 75 expected_last_modified_time)); | |
| 76 } | 74 } |
| 77 | 75 |
| 78 } // namespace pp | 76 } // namespace pp |
| OLD | NEW |