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_loader_dev.h" | 5 #include "ppapi/cpp/dev/url_loader_dev.h" |
6 | 6 |
7 #include "ppapi/c/dev/ppb_url_loader_dev.h" | 7 #include "ppapi/c/dev/ppb_url_loader_dev.h" |
8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
| 9 #include "ppapi/cpp/common.h" |
9 #include "ppapi/cpp/completion_callback.h" | 10 #include "ppapi/cpp/completion_callback.h" |
10 #include "ppapi/cpp/dev/file_ref_dev.h" | 11 #include "ppapi/cpp/dev/file_ref_dev.h" |
11 #include "ppapi/cpp/dev/url_request_info_dev.h" | 12 #include "ppapi/cpp/dev/url_request_info_dev.h" |
12 #include "ppapi/cpp/dev/url_response_info_dev.h" | 13 #include "ppapi/cpp/dev/url_response_info_dev.h" |
13 #include "ppapi/cpp/instance.h" | 14 #include "ppapi/cpp/instance.h" |
14 #include "ppapi/cpp/module.h" | 15 #include "ppapi/cpp/module.h" |
15 #include "ppapi/cpp/module_impl.h" | 16 #include "ppapi/cpp/module_impl.h" |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 if (!url_loader_f) | 58 if (!url_loader_f) |
58 return PP_ERROR_NOINTERFACE; | 59 return PP_ERROR_NOINTERFACE; |
59 return url_loader_f->FollowRedirect(pp_resource(), | 60 return url_loader_f->FollowRedirect(pp_resource(), |
60 cc.pp_completion_callback()); | 61 cc.pp_completion_callback()); |
61 } | 62 } |
62 | 63 |
63 bool URLLoader_Dev::GetUploadProgress(int64_t* bytes_sent, | 64 bool URLLoader_Dev::GetUploadProgress(int64_t* bytes_sent, |
64 int64_t* total_bytes_to_be_sent) const { | 65 int64_t* total_bytes_to_be_sent) const { |
65 if (!url_loader_f) | 66 if (!url_loader_f) |
66 return false; | 67 return false; |
67 return url_loader_f->GetUploadProgress( | 68 return PPBoolToBool(url_loader_f->GetUploadProgress(pp_resource(), |
68 pp_resource(), | 69 bytes_sent, |
69 bytes_sent, | 70 total_bytes_to_be_sent)); |
70 total_bytes_to_be_sent); | |
71 } | 71 } |
72 | 72 |
73 bool URLLoader_Dev::GetDownloadProgress( | 73 bool URLLoader_Dev::GetDownloadProgress( |
74 int64_t* bytes_received, | 74 int64_t* bytes_received, |
75 int64_t* total_bytes_to_be_received) const { | 75 int64_t* total_bytes_to_be_received) const { |
76 if (!url_loader_f) | 76 if (!url_loader_f) |
77 return false; | 77 return false; |
78 return url_loader_f->GetDownloadProgress( | 78 return PPBoolToBool( |
79 pp_resource(), | 79 url_loader_f->GetDownloadProgress(pp_resource(), |
80 bytes_received, | 80 bytes_received, |
81 total_bytes_to_be_received); | 81 total_bytes_to_be_received)); |
82 } | 82 } |
83 | 83 |
84 URLResponseInfo_Dev URLLoader_Dev::GetResponseInfo() const { | 84 URLResponseInfo_Dev URLLoader_Dev::GetResponseInfo() const { |
85 if (!url_loader_f) | 85 if (!url_loader_f) |
86 return URLResponseInfo_Dev(); | 86 return URLResponseInfo_Dev(); |
87 return URLResponseInfo_Dev(URLResponseInfo_Dev::PassRef(), | 87 return URLResponseInfo_Dev(URLResponseInfo_Dev::PassRef(), |
88 url_loader_f->GetResponseInfo(pp_resource())); | 88 url_loader_f->GetResponseInfo(pp_resource())); |
89 } | 89 } |
90 | 90 |
91 int32_t URLLoader_Dev::ReadResponseBody(char* buffer, | 91 int32_t URLLoader_Dev::ReadResponseBody(char* buffer, |
(...skipping 14 matching lines...) Expand all Loading... |
106 cc.pp_completion_callback()); | 106 cc.pp_completion_callback()); |
107 } | 107 } |
108 | 108 |
109 void URLLoader_Dev::Close() { | 109 void URLLoader_Dev::Close() { |
110 if (!url_loader_f) | 110 if (!url_loader_f) |
111 return; | 111 return; |
112 url_loader_f->Close(pp_resource()); | 112 url_loader_f->Close(pp_resource()); |
113 } | 113 } |
114 | 114 |
115 } // namespace pp | 115 } // namespace pp |
OLD | NEW |