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_DEV_PPB_URL_LOADER_DEV_H_ | 5 #ifndef PPAPI_C_PPB_URL_LOADER_H_ |
6 #define PPAPI_C_DEV_PPB_URL_LOADER_DEV_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" |
11 #include "ppapi/c/pp_stdint.h" | 11 #include "ppapi/c/pp_stdint.h" |
12 | 12 |
13 struct PP_CompletionCallback; | 13 struct PP_CompletionCallback; |
14 | 14 |
15 #define PPB_URLLOADER_DEV_INTERFACE "PPB_URLLoader(Dev);0.2" | 15 #define PPB_URLLOADER_INTERFACE "PPB_URLLoader;1" |
16 | 16 |
17 // The interface for loading URLs. | 17 // The interface for loading URLs. |
18 // | 18 // |
19 // Typical steps for loading an URL: | 19 // Typical steps for loading an URL: |
20 // 1- Create an URLLoader object. | 20 // 1- Create an URLLoader object. |
21 // 2- Create an URLRequestInfo object and set properties on it. | 21 // 2- Create an URLRequestInfo object and set properties on it. |
22 // 3- Call URLLoader's Open method passing the URLRequestInfo. | 22 // 3- Call URLLoader's Open method passing the URLRequestInfo. |
23 // 4- When Open completes, call GetResponseInfo to examine the response headers. | 23 // 4- When Open completes, call GetResponseInfo to examine the response headers. |
24 // 5- Then call ReadResponseBody to stream the data for the response. | 24 // 5- Then call ReadResponseBody to stream the data for the response. |
25 // | 25 // |
26 // Alternatively, if PP_URLREQUESTPROPERTY_STREAMTOFILE was set on the | 26 // Alternatively, if PP_URLREQUESTPROPERTY_STREAMTOFILE was set on the |
27 // URLRequestInfo, then call FinishStreamingToFile at step #5 to wait for the | 27 // URLRequestInfo, then call FinishStreamingToFile at step #5 to wait for the |
28 // downloaded file to be complete. The downloaded file may be accessed via the | 28 // downloaded file to be complete. The downloaded file may be accessed via the |
29 // GetBody method of the URLResponseInfo returned in step #4. | 29 // GetBody method of the URLResponseInfo returned in step #4. |
30 // | 30 // |
31 struct PPB_URLLoader_Dev { | 31 struct PPB_URLLoader { |
32 // Create a new URLLoader object. Returns 0 if the instance is invalid. The | 32 // Create a new URLLoader object. Returns 0 if the instance is invalid. The |
33 // URLLoader is associated with a particular instance, so that any UI dialogs | 33 // URLLoader is associated with a particular instance, so that any UI dialogs |
34 // that need to be shown to the user can be positioned relative to the window | 34 // that need to be shown to the user can be positioned relative to the window |
35 // containing the instance. It is also important for security reasons to | 35 // containing the instance. It is also important for security reasons to |
36 // know the origin of the URL request. | 36 // know the origin of the URL request. |
37 PP_Resource (*Create)(PP_Instance instance); | 37 PP_Resource (*Create)(PP_Instance instance); |
38 | 38 |
39 // Returns PP_TRUE if the given resource is an URLLoader. Returns PP_FALSE if | 39 // Returns PP_TRUE if the given resource is an URLLoader. Returns PP_FALSE if |
40 // the resource is invalid or some type other than an URLLoader. | 40 // the resource is invalid or some type other than an URLLoader. |
41 PP_Bool (*IsURLLoader)(PP_Resource resource); | 41 PP_Bool (*IsURLLoader)(PP_Resource resource); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 // Cancels any IO that may be pending, and closes the URLLoader object. Any | 100 // Cancels any IO that may be pending, and closes the URLLoader object. Any |
101 // pending callbacks will still run, reporting PP_ERROR_ABORTED if pending IO | 101 // pending callbacks will still run, reporting PP_ERROR_ABORTED if pending IO |
102 // was interrupted. It is NOT valid to call Open again after a call to this | 102 // was interrupted. It is NOT valid to call Open again after a call to this |
103 // method. Note: If the URLLoader object is destroyed, and it is still open, | 103 // method. Note: If the URLLoader object is destroyed, and it is still open, |
104 // then it will be implicitly closed, so you are not required to call the | 104 // then it will be implicitly closed, so you are not required to call the |
105 // Close method. | 105 // Close method. |
106 void (*Close)(PP_Resource loader); | 106 void (*Close)(PP_Resource loader); |
107 }; | 107 }; |
108 | 108 |
109 #endif // PPAPI_C_DEV_PPB_URL_LOADER_DEV_H_ | 109 #endif // PPAPI_C_PPB_URL_LOADER_H_ |
OLD | NEW |