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 #ifndef PPAPI_C_PPB_URL_RESPONSE_INFO_H_ | 5 #ifndef PPAPI_C_PPB_URL_RESPONSE_INFO_H_ |
6 #define PPAPI_C_PPB_URL_RESPONSE_INFO_H_ | 6 #define PPAPI_C_PPB_URL_RESPONSE_INFO_H_ |
7 | 7 |
8 #include "ppapi/c/pp_bool.h" | 8 #include "ppapi/c/pp_bool.h" |
9 #include "ppapi/c/pp_macros.h" | 9 #include "ppapi/c/pp_macros.h" |
10 #include "ppapi/c/pp_resource.h" | 10 #include "ppapi/c/pp_resource.h" |
11 #include "ppapi/c/pp_var.h" | 11 #include "ppapi/c/pp_var.h" |
12 | 12 |
13 /** | 13 /** |
14 * @file | 14 * @file |
15 * This file defines the PPB_URLResponseInfo API for examining URL | 15 * This file defines the <code>PPB_URLResponseInfo</code> API for examining URL |
16 * responses. | 16 * responses. |
17 */ | 17 */ |
18 | 18 |
19 /** | 19 /** |
20 * | 20 * |
21 * @addtogroup Enums | 21 * @addtogroup Enums |
22 * @{ | 22 * @{ |
23 */ | 23 */ |
24 | 24 |
25 /** | 25 /** |
26 * This enumeration contains properties set on a URL response. | 26 * This enumeration contains properties set on a URL response. |
27 */ | 27 */ |
28 // TODO(viettrungluu) Explain each property in more detail (e.g. note how the | 28 // TODO(viettrungluu) Explain each property in more detail (e.g. note how the |
29 // full URL in the response corresponds to the relative URL in the original | 29 // full URL in the response corresponds to the relative URL in the original |
30 // request). | 30 // request). |
31 typedef enum { | 31 typedef enum { |
32 /** This corresponds to a string (PP_VARTYPE_STRING). */ | 32 /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ |
33 PP_URLRESPONSEPROPERTY_URL, | 33 PP_URLRESPONSEPROPERTY_URL, |
34 | 34 |
35 /** This corresponds to a string (PP_VARTYPE_STRING).*/ | 35 /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>).*/ |
36 PP_URLRESPONSEPROPERTY_REDIRECTURL, | 36 PP_URLRESPONSEPROPERTY_REDIRECTURL, |
37 | 37 |
38 /** This corresponds to a string (PP_VARTYPE_STRING).*/ | 38 /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>).*/ |
39 PP_URLRESPONSEPROPERTY_REDIRECTMETHOD, | 39 PP_URLRESPONSEPROPERTY_REDIRECTMETHOD, |
40 | 40 |
41 /** This corresponds to an int32 (PP_VARETYPE_INT32)*/ | 41 /** This corresponds to an int32 (<code>PP_VARETYPE_INT32</code>)*/ |
42 PP_URLRESPONSEPROPERTY_STATUSCODE, | 42 PP_URLRESPONSEPROPERTY_STATUSCODE, |
43 | 43 |
44 /** This corresponds to a string (PP_VARTYPE_STRING).*/ | 44 /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>).*/ |
45 PP_URLRESPONSEPROPERTY_STATUSLINE, | 45 PP_URLRESPONSEPROPERTY_STATUSLINE, |
46 | 46 |
47 /** This corresponds to a string(PP_VARTYPE_STRING), \n delimited */ | 47 /** |
48 * This corresponds to a string(<code>PP_VARTYPE_STRING</code>), | |
49 * \n delimited | |
50 */ | |
48 PP_URLRESPONSEPROPERTY_HEADERS | 51 PP_URLRESPONSEPROPERTY_HEADERS |
49 } PP_URLResponseProperty; | 52 } PP_URLResponseProperty; |
50 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLResponseProperty, 4); | 53 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLResponseProperty, 4); |
51 /** | 54 /** |
52 * @} | 55 * @} |
53 */ | 56 */ |
54 | 57 |
55 #define PPB_URLRESPONSEINFO_INTERFACE_0_1 "PPB_URLResponseInfo;0.1" | 58 #define PPB_URLRESPONSEINFO_INTERFACE_0_1 "PPB_URLResponseInfo;0.1" |
56 #define PPB_URLRESPONSEINFO_INTERFACE PPB_URLRESPONSEINFO_INTERFACE_0_1 | 59 #define PPB_URLRESPONSEINFO_INTERFACE PPB_URLRESPONSEINFO_INTERFACE_0_1 |
57 | 60 |
58 /** | 61 /** |
59 * | 62 * |
60 * @addtogroup Interfaces | 63 * @addtogroup Interfaces |
61 * @{ | 64 * @{ |
62 */ | 65 */ |
63 | 66 |
64 /** | 67 /** |
65 * The PPB_URLResponseInfo interface contains pointers to functions for | 68 * The PPB_URLResponseInfo interface contains APIs for |
66 * examining URL responses. Refer to PPB_URLLoader for further | 69 * examining URL responses. Refer to <code>PPB_URLLoader</code> for further |
67 * information. | 70 * information. |
68 */ | 71 */ |
69 struct PPB_URLResponseInfo { | 72 struct PPB_URLResponseInfo { |
70 | 73 |
71 /** | 74 /** |
72 * IsURLResponseInfo is a pointer to a function that determines if a | 75 * IsURLResponseInfo() determines if a response is a |
73 * response is a URLResponseInfo. | 76 * <code>URLResponseInfo</code>. |
74 * | 77 * |
75 * @param[in] resource A PP_Resource corresponding to a URLResponseInfo. | 78 * @param[in] resource A <code>PP_Resource</code> corresponding to a |
76 * @return PP_TRUE if the resource is a URLResponseInfo, | 79 * <code>URLResponseInfo</code>. |
77 * PP_FALSE if the resource is invalid or some type other than | 80 * |
78 * URLResponseInfo. | 81 * @return <code>PP_TRUE</code> if the resource is a |
82 * <code>URLResponseInfo</code>, <code>PP_FALSE</code> if the resource is | |
83 * invalid or some type other than <code>URLResponseInfo</code>. | |
79 */ | 84 */ |
80 PP_Bool (*IsURLResponseInfo)(PP_Resource resource); | 85 PP_Bool (*IsURLResponseInfo)(PP_Resource resource); |
81 | 86 |
82 /** | 87 /** |
83 * GetProperty is a pointer to a function that gets a response property. | 88 * GetProperty() gets a response property. |
84 * | 89 * |
85 * @param[in] request A PP_Resource corresponding to a URLResponseInfo. | 90 * @param[in] request A <code>PP_Resource</code> corresponding to a |
86 * @param[in] property A PP_URLResponseProperty identifying the type of | 91 * <code>URLResponseInfo</code>. |
87 * property in the response. | 92 * @param[in] property A <code>PP_URLResponseProperty</code> identifying |
88 * @return A PP_Var containing the response property value if successful, | 93 * the type of property in the response. |
89 * PP_VARTYPE_VOID if an input parameter is invalid. | 94 * |
95 * @return A <code>PP_Var</code> containing the response property value if | |
96 * successful, <code>PP_VARTYPE_VOID</code> if an input parameter is invalid. | |
90 */ | 97 */ |
91 struct PP_Var (*GetProperty)(PP_Resource response, | 98 struct PP_Var (*GetProperty)(PP_Resource response, |
92 PP_URLResponseProperty property); | 99 PP_URLResponseProperty property); |
93 | 100 |
94 /** | 101 /** |
95 * GetBodyAsFileRef is a pointer to a function that returns a FileRef | 102 * GetBodyAsFileRef() returns a FileRef pointing to the file containing the |
96 * pointing to the file containing the response body. This | 103 * response body. This is only valid if |
97 * is only valid if PP_URLREQUESTPROPERTY_STREAMTOFILE was set on the | 104 * <code>PP_URLREQUESTPROPERTY_STREAMTOFILE</code> was set on the |
98 * URLRequestInfo used to produce this response. This file remains valid | 105 * <code>URLRequestInfo</code> used to produce this response. This file |
99 * until the URLLoader associated with this URLResponseInfo is closed or | 106 * remains valid until the <code>URLLoader</code> associated with this |
100 * destroyed. | 107 * <code>URLResponseInfo is closed or destroyed. |
101 * | 108 * |
102 * @param[in] request A PP_Resource corresponding to a URLResponseInfo. | 109 * @param[in] request A <code>PP_Resource</code> corresponding to a |
103 * @return A PP_Resource corresponding to a FileRef if successful, 0 if | 110 * <code>URLResponseInfo</code>. |
104 * PP_URLREQUESTPROPERTY_STREAMTOFILE was not requested or if the URLLoader | 111 * |
105 * has not been opened yet. | 112 * @return A <code>PP_Resource</code> corresponding to a FileRef if |
113 * successful, 0 if <code>PP_URLREQUESTPROPERTY_STREAMTOFILE was not | |
dmichael (off chromium)
2011/07/01 16:45:00
missing </code>
jond
2011/07/01 20:31:23
Done.
| |
114 * requested or if the <code>URLLoader</code> has not been opened yet. | |
106 */ | 115 */ |
107 PP_Resource (*GetBodyAsFileRef)(PP_Resource response); | 116 PP_Resource (*GetBodyAsFileRef)(PP_Resource response); |
108 }; | 117 }; |
109 /** | 118 /** |
110 * @} | 119 * @} |
111 */ | 120 */ |
112 | 121 |
113 #endif /* PPAPI_C_PPB_URL_RESPONSE_INFO_H_ */ | 122 #endif /* PPAPI_C_PPB_URL_RESPONSE_INFO_H_ */ |
114 | 123 |
OLD | NEW |