| 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 dev/ppb_url_util_dev.idl modified Wed Dec 7 17:25:52 2011. */ |
| 7 |
| 5 #ifndef PPAPI_C_DEV_PPB_URL_UTIL_DEV_H_ | 8 #ifndef PPAPI_C_DEV_PPB_URL_UTIL_DEV_H_ |
| 6 #define PPAPI_C_DEV_PPB_URL_UTIL_DEV_H_ | 9 #define PPAPI_C_DEV_PPB_URL_UTIL_DEV_H_ |
| 7 | 10 |
| 8 #include "ppapi/c/pp_bool.h" | 11 #include "ppapi/c/pp_bool.h" |
| 9 #include "ppapi/c/pp_instance.h" | 12 #include "ppapi/c/pp_instance.h" |
| 10 #include "ppapi/c/pp_macros.h" | 13 #include "ppapi/c/pp_macros.h" |
| 11 #include "ppapi/c/pp_stdint.h" | 14 #include "ppapi/c/pp_stdint.h" |
| 12 #include "ppapi/c/pp_var.h" | 15 #include "ppapi/c/pp_var.h" |
| 13 | 16 |
| 14 #define PPB_URLUTIL_DEV_INTERFACE_0_6 "PPB_URLUtil(Dev);0.6" | 17 #define PPB_URLUTIL_DEV_INTERFACE_0_6 "PPB_URLUtil(Dev);0.6" |
| 15 #define PPB_URLUTIL_DEV_INTERFACE PPB_URLUTIL_DEV_INTERFACE_0_6 | 18 #define PPB_URLUTIL_DEV_INTERFACE PPB_URLUTIL_DEV_INTERFACE_0_6 |
| 16 | 19 |
| 17 // A component specifies the range of the part of the URL. The begin specifies | 20 /** |
| 18 // the index into the string of the first character of that component. The len | 21 * @file |
| 19 // specifies the length of that component. | 22 * This file defines the <code>PPB_URLUtil_Dev</code> interface. |
| 20 // | 23 */ |
| 21 // This range does not include any special delimiter for that component, so | 24 |
| 22 // the scheme doesn't include the trailing colon, the username and password | 25 |
| 23 // don't include the @ and :, the port doesn't include the colon, the query | 26 /** |
| 24 // doesn't include the ?, and the ref doesn't include the #. | 27 * @addtogroup Structs |
| 25 // | 28 * @{ |
| 26 // The exception is that the path *does* include the first /, since that's an | 29 */ |
| 27 // integral part of the path. | 30 /* |
| 28 // | 31 * A component specifies the range of the part of the URL. The begin specifies |
| 29 // If the component is not present at all, begin will be 0 and len will be -1. | 32 * the index into the string of the first character of that component. The len |
| 30 // If the component is present but empty, the length will be 0 instead. Example: | 33 * specifies the length of that component. |
| 31 // http://foo/search -> query = (0, -1) | 34 * |
| 32 // http://foo/search? -> query = (18, 0) | 35 * This range does not include any special delimiter for that component, so |
| 36 * the scheme doesn't include the trailing colon, the username and password |
| 37 * don't include the @ and :, the port doesn't include the colon, the query |
| 38 * doesn't include the ?, and the ref doesn't include the #. |
| 39 * |
| 40 * The exception is that the path *does* include the first /, since that's an |
| 41 * integral part of the path. |
| 42 * |
| 43 * If the component is not present at all, begin will be 0 and len will be -1. |
| 44 * If the component is present but empty, the length will be 0 instead. Example: |
| 45 * http://foo/search -> query = (0, -1) |
| 46 * http://foo/search? -> query = (18, 0) |
| 47 */ |
| 33 struct PP_URLComponent_Dev { | 48 struct PP_URLComponent_Dev { |
| 34 int32_t begin; | 49 int32_t begin; |
| 35 int32_t len; | 50 int32_t len; |
| 36 }; | 51 }; |
| 37 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_URLComponent_Dev, 8); | 52 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_URLComponent_Dev, 8); |
| 38 | 53 |
| 39 struct PP_URLComponents_Dev { | 54 struct PP_URLComponents_Dev { |
| 40 struct PP_URLComponent_Dev scheme; | 55 struct PP_URLComponent_Dev scheme; |
| 41 struct PP_URLComponent_Dev username; | 56 struct PP_URLComponent_Dev username; |
| 42 struct PP_URLComponent_Dev password; | 57 struct PP_URLComponent_Dev password; |
| 43 struct PP_URLComponent_Dev host; | 58 struct PP_URLComponent_Dev host; |
| 44 struct PP_URLComponent_Dev port; | 59 struct PP_URLComponent_Dev port; |
| 45 struct PP_URLComponent_Dev path; | 60 struct PP_URLComponent_Dev path; |
| 46 struct PP_URLComponent_Dev query; | 61 struct PP_URLComponent_Dev query; |
| 47 struct PP_URLComponent_Dev ref; | 62 struct PP_URLComponent_Dev ref; |
| 48 }; | 63 }; |
| 49 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_URLComponents_Dev, 64); | 64 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_URLComponents_Dev, 64); |
| 65 /** |
| 66 * @} |
| 67 */ |
| 50 | 68 |
| 51 // URL encoding: URLs are supplied to this interface as NULL-terminated 8-bit | 69 /** |
| 52 // strings. You can pass non-ASCII characters which will be interpreted as | 70 * @addtogroup Interfaces |
| 53 // UTF-8. Canonicalized URL strings returned by these functions will be ASCII | 71 * @{ |
| 54 // except for the reference fragment (stuff after the '#') which will be | 72 */ |
| 55 // encoded as UTF-8. | 73 /* |
| 74 * URL encoding: URLs are supplied to this interface as NULL-terminated 8-bit |
| 75 * strings. You can pass non-ASCII characters which will be interpreted as |
| 76 * UTF-8. Canonicalized URL strings returned by these functions will be ASCII |
| 77 * except for the reference fragment (stuff after the '#') which will be |
| 78 * encoded as UTF-8. |
| 79 */ |
| 56 struct PPB_URLUtil_Dev { | 80 struct PPB_URLUtil_Dev { |
| 57 // Canonicalizes the given URL string according to the rules of the host | 81 /* |
| 58 // browser. If the URL is invalid or the var is not a string, this will | 82 * Canonicalizes the given URL string according to the rules of the host |
| 59 // return a Null var and the components structure will be unchanged. | 83 * browser. If the URL is invalid or the var is not a string, this will |
| 60 // | 84 * return a Null var and the components structure will be unchanged. |
| 61 // The components pointer, if non-NULL and the canonicalized URL is valid, | 85 * |
| 62 // will identify the components of the resulting URL. Components may be NULL | 86 * The components pointer, if non-NULL and the canonicalized URL is valid, |
| 63 // to specify that no component information is necessary. | 87 * will identify the components of the resulting URL. Components may be NULL |
| 88 * to specify that no component information is necessary. |
| 89 */ |
| 64 struct PP_Var (*Canonicalize)(struct PP_Var url, | 90 struct PP_Var (*Canonicalize)(struct PP_Var url, |
| 65 struct PP_URLComponents_Dev* components); | 91 struct PP_URLComponents_Dev* components); |
| 66 | 92 /* |
| 67 // Resolves the given URL relative to the given base URL. The resulting URL | 93 * Resolves the given URL relative to the given base URL. The resulting URL |
| 68 // is returned as a string. If the resolution is invalid or either of the | 94 * is returned as a string. If the resolution is invalid or either of the |
| 69 // inputs are not strings, a Null var will be returned. The resulting URL | 95 * inputs are not strings, a Null var will be returned. The resulting URL |
| 70 // will also be canonicalized according to the rules of the browser. | 96 * will also be canonicalized according to the rules of the browser. |
| 71 // | 97 * |
| 72 // Note that the "relative" URL may in fact be absolute, in which case it | 98 * Note that the "relative" URL may in fact be absolute, in which case it |
| 73 // will be returned. This function is identical to resolving the full URL | 99 * will be returned. This function is identical to resolving the full URL |
| 74 // for an <a href="..."> on a web page. Attempting to resolve a relative URL | 100 * for an <a href="..."> on a web page. Attempting to resolve a relative URL |
| 75 // on a base URL that doesn't support this (e.g. "data") will fail and will | 101 * on a base URL that doesn't support this (e.g. "data") will fail and will |
| 76 // return a Null var, unless the relative URL is itself absolute. | 102 * return a Null var, unless the relative URL is itself absolute. |
| 77 // | 103 * |
| 78 // The components pointer, if non-NULL and the canonicalized URL is valid, | 104 * The components pointer, if non-NULL and the canonicalized URL is valid, |
| 79 // will identify the components of the resulting URL. Components may be NULL | 105 * will identify the components of the resulting URL. Components may be NULL |
| 80 // to specify that no component information is necessary. | 106 * to specify that no component information is necessary. |
| 107 */ |
| 81 struct PP_Var (*ResolveRelativeToURL)( | 108 struct PP_Var (*ResolveRelativeToURL)( |
| 82 struct PP_Var base_url, | 109 struct PP_Var base_url, |
| 83 struct PP_Var relative_string, | 110 struct PP_Var relative_string, |
| 84 struct PP_URLComponents_Dev* components); | 111 struct PP_URLComponents_Dev* components); |
| 85 | 112 /* |
| 86 // Identical to ResolveRelativeToURL except that the base URL is the base | 113 * Identical to ResolveRelativeToURL except that the base URL is the base |
| 87 // URL of the document containing the given plugin instance. | 114 * URL of the document containing the given plugin instance. |
| 88 // | 115 * |
| 89 // Danger: This will be identical to resolving a relative URL on the page, | 116 * Danger: This will be identical to resolving a relative URL on the page, |
| 90 // and might be overridden by the page to something different than its actual | 117 * and might be overridden by the page to something different than its actual |
| 91 // URL via the <base> tag. Therefore, resolving a relative URL of "" won't | 118 * URL via the <base> tag. Therefore, resolving a relative URL of "" won't |
| 92 // necessarily give you the URL of the page! | 119 * necessarily give you the URL of the page! |
| 120 */ |
| 93 struct PP_Var (*ResolveRelativeToDocument)( | 121 struct PP_Var (*ResolveRelativeToDocument)( |
| 94 PP_Instance instance, | 122 PP_Instance instance, |
| 95 struct PP_Var relative_string, | 123 struct PP_Var relative_string, |
| 96 struct PP_URLComponents_Dev* components); | 124 struct PP_URLComponents_Dev* components); |
| 97 | 125 /* |
| 98 // Checks whether the given two URLs are in the same security origin. Returns | 126 * Checks whether the given two URLs are in the same security origin. Returns |
| 99 // FALSE if either of the URLs are invalid. | 127 * FALSE if either of the URLs are invalid. |
| 128 */ |
| 100 PP_Bool (*IsSameSecurityOrigin)(struct PP_Var url_a, struct PP_Var url_b); | 129 PP_Bool (*IsSameSecurityOrigin)(struct PP_Var url_a, struct PP_Var url_b); |
| 101 | 130 /* |
| 102 // Checks whether the document hosting the given plugin instance can access | 131 * Checks whether the document hosting the given plugin instance can access |
| 103 // the given URL according to the same origin policy of the browser. Returns | 132 * the given URL according to the same origin policy of the browser. Returns |
| 104 // PP_FALSE if the instance or the URL is invalid. | 133 * PP_FALSE if the instance or the URL is invalid. |
| 134 */ |
| 105 PP_Bool (*DocumentCanRequest)(PP_Instance instance, struct PP_Var url); | 135 PP_Bool (*DocumentCanRequest)(PP_Instance instance, struct PP_Var url); |
| 106 | 136 /* |
| 107 // Checks whether the document containing the |active| plugin instance can | 137 * Checks whether the document containing the |active| plugin instance can |
| 108 // access the document containing the |target| plugin instance according to | 138 * access the document containing the |target| plugin instance according to |
| 109 // the security policy of the browser. This includes the same origin policy | 139 * the security policy of the browser. This includes the same origin policy |
| 110 // and any cross-origin capabilities enabled by the document. If either of | 140 * and any cross-origin capabilities enabled by the document. If either of |
| 111 // the plugin instances are invalid, returns PP_FALSE. | 141 * the plugin instances are invalid, returns PP_FALSE. |
| 142 */ |
| 112 PP_Bool (*DocumentCanAccessDocument)(PP_Instance active, PP_Instance target); | 143 PP_Bool (*DocumentCanAccessDocument)(PP_Instance active, PP_Instance target); |
| 113 | 144 /* |
| 114 // Returns the URL for the document. This is a safe way to retrieve | 145 * Returns the URL for the document. This is a safe way to retrieve |
| 115 // window.location.href. | 146 * window.location.href. |
| 116 // The components pointer, if non-NULL and the canonicalized URL is valid, | 147 * The components pointer, if non-NULL and the canonicalized URL is valid, |
| 117 // will identify the components of the resulting URL. Components may be NULL | 148 * will identify the components of the resulting URL. Components may be NULL |
| 118 // to specify that no component information is necessary. | 149 * to specify that no component information is necessary. |
| 150 */ |
| 119 struct PP_Var (*GetDocumentURL)(PP_Instance instance, | 151 struct PP_Var (*GetDocumentURL)(PP_Instance instance, |
| 120 struct PP_URLComponents_Dev* components); | 152 struct PP_URLComponents_Dev* components); |
| 121 | 153 /* |
| 122 // Returns the Source URL for the plugin. This returns the URL that would be | 154 * Returns the Source URL for the plugin. This returns the URL that would be |
| 123 // streamed to the plugin if it were a NPAPI plugin. This is usually the src | 155 * streamed to the plugin if it were a NPAPI plugin. This is usually the src |
| 124 // attribute on the <embed> element, but the rules are obscure and different | 156 * attribute on the <embed> element, but the rules are obscure and different |
| 125 // based on whether the plugin is loaded from an <embed> element or an | 157 * based on whether the plugin is loaded from an <embed> element or an |
| 126 // <object> element. | 158 * <object> element. |
| 127 // The components pointer, if non-NULL and the canonicalized URL is valid, | 159 * The components pointer, if non-NULL and the canonicalized URL is valid, |
| 128 // will identify the components of the resulting URL. Components may be NULL | 160 * will identify the components of the resulting URL. Components may be NULL |
| 129 // to specify that no component information is necessary. | 161 * to specify that no component information is necessary. |
| 162 */ |
| 130 struct PP_Var (*GetPluginInstanceURL)( | 163 struct PP_Var (*GetPluginInstanceURL)( |
| 131 PP_Instance instance, struct PP_URLComponents_Dev* components); | 164 PP_Instance instance, |
| 165 struct PP_URLComponents_Dev* components); |
| 132 }; | 166 }; |
| 167 /** |
| 168 * @} |
| 169 */ |
| 133 | 170 |
| 134 #endif /* PPAPI_C_DEV_PPB_URL_UTIL_DEV_H_ */ | 171 #endif /* PPAPI_C_DEV_PPB_URL_UTIL_DEV_H_ */ |
| 135 | 172 |
| OLD | NEW |