| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_loader.h" | 5 #include "ppapi/cpp/url_loader.h" |
| 6 | 6 |
| 7 #include "ppapi/c/ppb_url_loader.h" | 7 #include "ppapi/c/ppb_url_loader.h" |
| 8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
| 9 #include "ppapi/cpp/common.h" | |
| 10 #include "ppapi/cpp/completion_callback.h" | 9 #include "ppapi/cpp/completion_callback.h" |
| 11 #include "ppapi/cpp/dev/file_ref_dev.h" | 10 #include "ppapi/cpp/dev/file_ref_dev.h" |
| 12 #include "ppapi/cpp/instance.h" | 11 #include "ppapi/cpp/instance.h" |
| 13 #include "ppapi/cpp/module.h" | 12 #include "ppapi/cpp/module.h" |
| 14 #include "ppapi/cpp/module_impl.h" | 13 #include "ppapi/cpp/module_impl.h" |
| 15 #include "ppapi/cpp/url_request_info.h" | 14 #include "ppapi/cpp/url_request_info.h" |
| 16 #include "ppapi/cpp/url_response_info.h" | 15 #include "ppapi/cpp/url_response_info.h" |
| 17 | 16 |
| 18 namespace pp { | 17 namespace pp { |
| 19 | 18 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 if (!has_interface<PPB_URLLoader>()) | 58 if (!has_interface<PPB_URLLoader>()) |
| 60 return cc.MayForce(PP_ERROR_NOINTERFACE); | 59 return cc.MayForce(PP_ERROR_NOINTERFACE); |
| 61 return get_interface<PPB_URLLoader>()->FollowRedirect( | 60 return get_interface<PPB_URLLoader>()->FollowRedirect( |
| 62 pp_resource(), cc.pp_completion_callback()); | 61 pp_resource(), cc.pp_completion_callback()); |
| 63 } | 62 } |
| 64 | 63 |
| 65 bool URLLoader::GetUploadProgress(int64_t* bytes_sent, | 64 bool URLLoader::GetUploadProgress(int64_t* bytes_sent, |
| 66 int64_t* total_bytes_to_be_sent) const { | 65 int64_t* total_bytes_to_be_sent) const { |
| 67 if (!has_interface<PPB_URLLoader>()) | 66 if (!has_interface<PPB_URLLoader>()) |
| 68 return false; | 67 return false; |
| 69 return PPBoolToBool(get_interface<PPB_URLLoader>()->GetUploadProgress( | 68 return PP_ToBool(get_interface<PPB_URLLoader>()->GetUploadProgress( |
| 70 pp_resource(), bytes_sent, total_bytes_to_be_sent)); | 69 pp_resource(), bytes_sent, total_bytes_to_be_sent)); |
| 71 } | 70 } |
| 72 | 71 |
| 73 bool URLLoader::GetDownloadProgress( | 72 bool URLLoader::GetDownloadProgress( |
| 74 int64_t* bytes_received, | 73 int64_t* bytes_received, |
| 75 int64_t* total_bytes_to_be_received) const { | 74 int64_t* total_bytes_to_be_received) const { |
| 76 if (!has_interface<PPB_URLLoader>()) | 75 if (!has_interface<PPB_URLLoader>()) |
| 77 return false; | 76 return false; |
| 78 return PPBoolToBool( | 77 return PP_ToBool(get_interface<PPB_URLLoader>()->GetDownloadProgress( |
| 79 get_interface<PPB_URLLoader>()->GetDownloadProgress( | 78 pp_resource(), bytes_received, total_bytes_to_be_received)); |
| 80 pp_resource(), bytes_received, total_bytes_to_be_received)); | |
| 81 } | 79 } |
| 82 | 80 |
| 83 URLResponseInfo URLLoader::GetResponseInfo() const { | 81 URLResponseInfo URLLoader::GetResponseInfo() const { |
| 84 if (!has_interface<PPB_URLLoader>()) | 82 if (!has_interface<PPB_URLLoader>()) |
| 85 return URLResponseInfo(); | 83 return URLResponseInfo(); |
| 86 return URLResponseInfo(URLResponseInfo::PassRef(), | 84 return URLResponseInfo(URLResponseInfo::PassRef(), |
| 87 get_interface<PPB_URLLoader>()->GetResponseInfo( | 85 get_interface<PPB_URLLoader>()->GetResponseInfo( |
| 88 pp_resource())); | 86 pp_resource())); |
| 89 } | 87 } |
| 90 | 88 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 104 pp_resource(), cc.pp_completion_callback()); | 102 pp_resource(), cc.pp_completion_callback()); |
| 105 } | 103 } |
| 106 | 104 |
| 107 void URLLoader::Close() { | 105 void URLLoader::Close() { |
| 108 if (!has_interface<PPB_URLLoader>()) | 106 if (!has_interface<PPB_URLLoader>()) |
| 109 return; | 107 return; |
| 110 get_interface<PPB_URLLoader>()->Close(pp_resource()); | 108 get_interface<PPB_URLLoader>()->Close(pp_resource()); |
| 111 } | 109 } |
| 112 | 110 |
| 113 } // namespace pp | 111 } // namespace pp |
| OLD | NEW |