| 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 |
| 6 /* From ppb_url_response_info.idl modified Sat Jul 16 16:50:26 2011. */ |
| 7 |
| 5 #ifndef PPAPI_C_PPB_URL_RESPONSE_INFO_H_ | 8 #ifndef PPAPI_C_PPB_URL_RESPONSE_INFO_H_ |
| 6 #define PPAPI_C_PPB_URL_RESPONSE_INFO_H_ | 9 #define PPAPI_C_PPB_URL_RESPONSE_INFO_H_ |
| 7 | 10 |
| 8 #include "ppapi/c/pp_bool.h" | 11 #include "ppapi/c/pp_bool.h" |
| 9 #include "ppapi/c/pp_macros.h" | 12 #include "ppapi/c/pp_macros.h" |
| 10 #include "ppapi/c/pp_resource.h" | 13 #include "ppapi/c/pp_resource.h" |
| 14 #include "ppapi/c/pp_stdint.h" |
| 11 #include "ppapi/c/pp_var.h" | 15 #include "ppapi/c/pp_var.h" |
| 12 | 16 |
| 13 /** | 17 /** |
| 14 * @file | 18 * @file |
| 15 * This file defines the <code>PPB_URLResponseInfo</code> API for examining URL | 19 * This file defines the <code>PPB_URLResponseInfo</code> API for examining URL |
| 16 * responses. | 20 * responses. |
| 17 */ | 21 */ |
| 18 | 22 |
| 23 |
| 19 /** | 24 /** |
| 20 * | |
| 21 * @addtogroup Enums | 25 * @addtogroup Enums |
| 22 * @{ | 26 * @{ |
| 23 */ | 27 */ |
| 24 | |
| 25 /** | 28 /** |
| 26 * This enumeration contains properties set on a URL response. | 29 * This enumeration contains properties set on a URL response. |
| 27 */ | 30 */ |
| 28 typedef enum { | 31 typedef enum { |
| 29 /** | 32 /** |
| 30 * This corresponds to a string (PP_VARTYPE_STRING); an absolute URL formed by | 33 * This corresponds to a string (PP_VARTYPE_STRING); an absolute URL formed by |
| 31 * resolving the relative request URL with the absolute document URL. Refer | 34 * resolving the relative request URL with the absolute document URL. Refer |
| 32 * to the | 35 * to the |
| 33 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2"> | 36 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2"> |
| 34 * HTTP Request URI</a> and | 37 * HTTP Request URI</a> and |
| 35 * <a href="http://www.w3.org/TR/html4/struct/links.html#h-12.4.1"> | 38 * <a href="http://www.w3.org/TR/html4/struct/links.html#h-12.4.1"> |
| 36 * HTML Resolving Relative URIs</a> documentation for further information. | 39 * HTML Resolving Relative URIs</a> documentation for further information. |
| 37 */ | 40 */ |
| 38 PP_URLRESPONSEPROPERTY_URL, | 41 PP_URLRESPONSEPROPERTY_URL, |
| 39 | |
| 40 /** | 42 /** |
| 41 * This corresponds to a string (PP_VARTYPE_STRING); the absolute URL returned | 43 * This corresponds to a string (PP_VARTYPE_STRING); the absolute URL returned |
| 42 * in the response header's 'Location' field if this is a redirect response, | 44 * in the response header's 'Location' field if this is a redirect response, |
| 43 * an empty string otherwise. Refer to the | 45 * an empty string otherwise. Refer to the |
| 44 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3"> | 46 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3"> |
| 45 * HTTP Status Codes - Redirection</a> documentation for further information. | 47 * HTTP Status Codes - Redirection</a> documentation for further information. |
| 46 */ | 48 */ |
| 47 PP_URLRESPONSEPROPERTY_REDIRECTURL, | 49 PP_URLRESPONSEPROPERTY_REDIRECTURL, |
| 48 | |
| 49 /** | 50 /** |
| 50 * This corresponds to a string (PP_VARTYPE_STRING); the HTTP method to be | 51 * This corresponds to a string (PP_VARTYPE_STRING); the HTTP method to be |
| 51 * used in a new request if this is a redirect response, an empty string | 52 * used in a new request if this is a redirect response, an empty string |
| 52 * otherwise. Refer to the | 53 * otherwise. Refer to the |
| 53 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3"> | 54 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3"> |
| 54 * HTTP Status Codes - Redirection</a> documentation for further information. | 55 * HTTP Status Codes - Redirection</a> documentation for further information. |
| 55 */ | 56 */ |
| 56 PP_URLRESPONSEPROPERTY_REDIRECTMETHOD, | 57 PP_URLRESPONSEPROPERTY_REDIRECTMETHOD, |
| 57 | |
| 58 /** | 58 /** |
| 59 * This corresponds to an int32 (PP_VARETYPE_INT32); the status code from the | 59 * This corresponds to an int32 (PP_VARETYPE_INT32); the status code from the |
| 60 * response, e.g., 200 if the request was successful. Refer to the | 60 * response, e.g., 200 if the request was successful. Refer to the |
| 61 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1.1"> | 61 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1.1"> |
| 62 * HTTP Status Code and Reason Phrase</a> documentation for further | 62 * HTTP Status Code and Reason Phrase</a> documentation for further |
| 63 * information. | 63 * information. |
| 64 */ | 64 */ |
| 65 PP_URLRESPONSEPROPERTY_STATUSCODE, | 65 PP_URLRESPONSEPROPERTY_STATUSCODE, |
| 66 | |
| 67 /** | 66 /** |
| 68 * This corresponds to a string (PP_VARTYPE_STRING); the status line | 67 * This corresponds to a string (PP_VARTYPE_STRING); the status line |
| 69 * from the response. Refer to the | 68 * from the response. Refer to the |
| 70 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1"> | 69 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1"> |
| 71 * HTTP Response Status Line</a> documentation for further information. | 70 * HTTP Response Status Line</a> documentation for further information. |
| 72 */ | 71 */ |
| 73 PP_URLRESPONSEPROPERTY_STATUSLINE, | 72 PP_URLRESPONSEPROPERTY_STATUSLINE, |
| 74 | |
| 75 /** | 73 /** |
| 76 * This corresponds to a string(PP_VARTYPE_STRING), a \n-delimited list of | 74 * This corresponds to a string(PP_VARTYPE_STRING), a \n-delimited list of |
| 77 * header field/value pairs of the form "field: value", returned by the | 75 * header field/value pairs of the form "field: value", returned by the |
| 78 * server. Refer to the | 76 * server. Refer to the |
| 79 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14"> | 77 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14"> |
| 80 * HTTP Header Field Definitions</a> documentation for further information. | 78 * HTTP Header Field Definitions</a> documentation for further information. |
| 81 */ | 79 */ |
| 82 PP_URLRESPONSEPROPERTY_HEADERS | 80 PP_URLRESPONSEPROPERTY_HEADERS |
| 83 } PP_URLResponseProperty; | 81 } PP_URLResponseProperty; |
| 84 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLResponseProperty, 4); | 82 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLResponseProperty, 4); |
| 85 /** | 83 /** |
| 86 * @} | 84 * @} |
| 87 */ | 85 */ |
| 88 | 86 |
| 89 #define PPB_URLRESPONSEINFO_INTERFACE_0_1 "PPB_URLResponseInfo;0.1" | |
| 90 #define PPB_URLRESPONSEINFO_INTERFACE_1_0 "PPB_URLResponseInfo;1.0" | |
| 91 #define PPB_URLRESPONSEINFO_INTERFACE PPB_URLRESPONSEINFO_INTERFACE_1_0 | |
| 92 | |
| 93 /** | 87 /** |
| 94 * | |
| 95 * @addtogroup Interfaces | 88 * @addtogroup Interfaces |
| 96 * @{ | 89 * @{ |
| 97 */ | 90 */ |
| 98 | |
| 99 /** | 91 /** |
| 100 * The PPB_URLResponseInfo interface contains APIs for | 92 * The PPB_URLResponseInfo interface contains APIs for |
| 101 * examining URL responses. Refer to <code>PPB_URLLoader</code> for further | 93 * examining URL responses. Refer to <code>PPB_URLLoader</code> for further |
| 102 * information. | 94 * information. |
| 103 */ | 95 */ |
| 96 #define PPB_URLRESPONSEINFO_INTERFACE_0_1 "PPB_URLResponseInfo;0.1" |
| 97 #define PPB_URLRESPONSEINFO_INTERFACE_1_0 "PPB_URLResponseInfo;1.0" |
| 98 #define PPB_URLRESPONSEINFO_INTERFACE PPB_URLRESPONSEINFO_INTERFACE_1_0 |
| 99 |
| 104 struct PPB_URLResponseInfo { | 100 struct PPB_URLResponseInfo { |
| 105 | |
| 106 /** | 101 /** |
| 107 * IsURLResponseInfo() determines if a response is a | 102 * IsURLResponseInfo() determines if a response is a |
| 108 * <code>URLResponseInfo</code>. | 103 * <code>URLResponseInfo</code>. |
| 109 * | 104 * |
| 110 * @param[in] resource A <code>PP_Resource</code> corresponding to a | 105 * @param[in] resource A <code>PP_Resource</code> corresponding to a |
| 111 * <code>URLResponseInfo</code>. | 106 * <code>URLResponseInfo</code>. |
| 112 * | 107 * |
| 113 * @return <code>PP_TRUE</code> if the resource is a | 108 * @return <code>PP_TRUE</code> if the resource is a |
| 114 * <code>URLResponseInfo</code>, <code>PP_FALSE</code> if the resource is | 109 * <code>URLResponseInfo</code>, <code>PP_FALSE</code> if the resource is |
| 115 * invalid or some type other than <code>URLResponseInfo</code>. | 110 * invalid or some type other than <code>URLResponseInfo</code>. |
| 116 */ | 111 */ |
| 117 PP_Bool (*IsURLResponseInfo)(PP_Resource resource); | 112 PP_Bool (*IsURLResponseInfo)(PP_Resource resource); |
| 118 | |
| 119 /** | 113 /** |
| 120 * GetProperty() gets a response property. | 114 * GetProperty() gets a response property. |
| 121 * | 115 * |
| 122 * @param[in] request A <code>PP_Resource</code> corresponding to a | 116 * @param[in] request A <code>PP_Resource</code> corresponding to a |
| 123 * <code>URLResponseInfo</code>. | 117 * <code>URLResponseInfo</code>. |
| 124 * @param[in] property A <code>PP_URLResponseProperty</code> identifying | 118 * @param[in] property A <code>PP_URLResponseProperty</code> identifying |
| 125 * the type of property in the response. | 119 * the type of property in the response. |
| 126 * | 120 * |
| 127 * @return A <code>PP_Var</code> containing the response property value if | 121 * @return A <code>PP_Var</code> containing the response property value if |
| 128 * successful, <code>PP_VARTYPE_VOID</code> if an input parameter is invalid. | 122 * successful, <code>PP_VARTYPE_VOID</code> if an input parameter is invalid. |
| 129 */ | 123 */ |
| 130 struct PP_Var (*GetProperty)(PP_Resource response, | 124 struct PP_Var (*GetProperty)(PP_Resource response, |
| 131 PP_URLResponseProperty property); | 125 PP_URLResponseProperty property); |
| 132 | |
| 133 /** | 126 /** |
| 134 * GetBodyAsFileRef() returns a FileRef pointing to the file containing the | 127 * GetBodyAsFileRef() returns a FileRef pointing to the file containing the |
| 135 * response body. This is only valid if | 128 * response body. This is only valid if |
| 136 * <code>PP_URLREQUESTPROPERTY_STREAMTOFILE</code> was set on the | 129 * <code>PP_URLREQUESTPROPERTY_STREAMTOFILE</code> was set on the |
| 137 * <code>URLRequestInfo</code> used to produce this response. This file | 130 * <code>URLRequestInfo</code> used to produce this response. This file |
| 138 * remains valid until the <code>URLLoader</code> associated with this | 131 * remains valid until the <code>URLLoader</code> associated with this |
| 139 * <code>URLResponseInfo is closed or destroyed. | 132 * <code>URLResponseInfo is closed or destroyed. |
| 140 * | 133 * |
| 141 * @param[in] request A <code>PP_Resource</code> corresponding to a | 134 * @param[in] request A <code>PP_Resource</code> corresponding to a |
| 142 * <code>URLResponseInfo</code>. | 135 * <code>URLResponseInfo</code>. |
| 143 * | 136 * |
| 144 * @return A <code>PP_Resource</code> corresponding to a FileRef if | 137 * @return A <code>PP_Resource</code> corresponding to a FileRef if |
| 145 * successful, 0 if <code>PP_URLREQUESTPROPERTY_STREAMTOFILE</code> was not | 138 * successful, 0 if <code>PP_URLREQUESTPROPERTY_STREAMTOFILE</code> was not |
| 146 * requested or if the <code>URLLoader</code> has not been opened yet. | 139 * requested or if the <code>URLLoader</code> has not been opened yet. |
| 147 */ | 140 */ |
| 148 PP_Resource (*GetBodyAsFileRef)(PP_Resource response); | 141 PP_Resource (*GetBodyAsFileRef)(PP_Resource response); |
| 149 }; | 142 }; |
| 150 /** | 143 /** |
| 151 * @} | 144 * @} |
| 152 */ | 145 */ |
| 153 | 146 |
| 154 #endif /* PPAPI_C_PPB_URL_RESPONSE_INFO_H_ */ | 147 #endif /* PPAPI_C_PPB_URL_RESPONSE_INFO_H_ */ |
| 155 | 148 |
| OLD | NEW |