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 #ifndef PPAPI_C_PPB_URL_LOADER_H_ | 5 #ifndef PPAPI_C_PPB_URL_LOADER_H_ |
6 #define PPAPI_C_PPB_URL_LOADER_H_ | 6 #define PPAPI_C_PPB_URL_LOADER_H_ |
7 | 7 |
8 #include "ppapi/c/pp_bool.h" | 8 #include "ppapi/c/pp_bool.h" |
9 #include "ppapi/c/pp_instance.h" | 9 #include "ppapi/c/pp_instance.h" |
10 #include "ppapi/c/pp_resource.h" | 10 #include "ppapi/c/pp_resource.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 int64_t* total_bytes_to_be_received); | 89 int64_t* total_bytes_to_be_received); |
90 | 90 |
91 // Returns the current URLResponseInfo object. | 91 // Returns the current URLResponseInfo object. |
92 PP_Resource (*GetResponseInfo)(PP_Resource loader); | 92 PP_Resource (*GetResponseInfo)(PP_Resource loader); |
93 | 93 |
94 // Call this method to read the response body. The size of the buffer must | 94 // Call this method to read the response body. The size of the buffer must |
95 // be large enough to hold the specified number of bytes to read. May | 95 // be large enough to hold the specified number of bytes to read. May |
96 // perform a partial read. Returns the number of bytes read or an error | 96 // perform a partial read. Returns the number of bytes read or an error |
97 // code. | 97 // code. |
98 int32_t (*ReadResponseBody)(PP_Resource loader, | 98 int32_t (*ReadResponseBody)(PP_Resource loader, |
99 char* buffer, | 99 void* buffer, |
100 int32_t bytes_to_read, | 100 int32_t bytes_to_read, |
101 struct PP_CompletionCallback callback); | 101 struct PP_CompletionCallback callback); |
102 | 102 |
103 // If PP_URLREQUESTPROPERTY_STREAMTOFILE was set on the URLRequestInfo passed | 103 // If PP_URLREQUESTPROPERTY_STREAMTOFILE was set on the URLRequestInfo passed |
104 // to the Open method, then this method may be used to wait for the response | 104 // to the Open method, then this method may be used to wait for the response |
105 // body to be completely downloaded to the file provided by URLResponseInfo's | 105 // body to be completely downloaded to the file provided by URLResponseInfo's |
106 // GetBody method. | 106 // GetBody method. |
107 int32_t (*FinishStreamingToFile)(PP_Resource loader, | 107 int32_t (*FinishStreamingToFile)(PP_Resource loader, |
108 struct PP_CompletionCallback callback); | 108 struct PP_CompletionCallback callback); |
109 | 109 |
110 // Cancels any IO that may be pending, and closes the URLLoader object. Any | 110 // Cancels any IO that may be pending, and closes the URLLoader object. Any |
111 // pending callbacks will still run, reporting PP_ERROR_ABORTED if pending IO | 111 // pending callbacks will still run, reporting PP_ERROR_ABORTED if pending IO |
112 // was interrupted. It is NOT valid to call Open again after a call to this | 112 // was interrupted. It is NOT valid to call Open again after a call to this |
113 // method. Note: If the URLLoader object is destroyed, and it is still open, | 113 // method. Note: If the URLLoader object is destroyed, and it is still open, |
114 // then it will be implicitly closed, so you are not required to call the | 114 // then it will be implicitly closed, so you are not required to call the |
115 // Close method. | 115 // Close method. |
116 void (*Close)(PP_Resource loader); | 116 void (*Close)(PP_Resource loader); |
117 }; | 117 }; |
118 /** | 118 /** |
119 * @} | 119 * @} |
120 */ | 120 */ |
121 | 121 |
122 #endif /* PPAPI_C_PPB_URL_LOADER_H_ */ | 122 #endif /* PPAPI_C_PPB_URL_LOADER_H_ */ |
123 | 123 |
OLD | NEW |