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_UTIL_DEV_H_ | 5 #ifndef PPAPI_C_DEV_PPB_URL_UTIL_DEV_H_ |
6 #define PPAPI_C_DEV_PPB_URL_UTIL_DEV_H_ | 6 #define PPAPI_C_DEV_PPB_URL_UTIL_DEV_H_ |
7 | 7 |
| 8 #include "ppapi/c/pp_bool.h" |
8 #include "ppapi/c/pp_instance.h" | 9 #include "ppapi/c/pp_instance.h" |
9 #include "ppapi/c/pp_stdint.h" | 10 #include "ppapi/c/pp_stdint.h" |
10 #include "ppapi/c/pp_var.h" | 11 #include "ppapi/c/pp_var.h" |
11 | 12 |
12 #define PPB_URLUTIL_DEV_INTERFACE "PPB_UrlUtil(Dev);0.1" | 13 #define PPB_URLUTIL_DEV_INTERFACE "PPB_UrlUtil(Dev);0.2" |
13 | 14 |
14 // A component specifies the range of the part of the URL. The begin specifies | 15 // A component specifies the range of the part of the URL. The begin specifies |
15 // the index into the string of the first character of that component. The len | 16 // the index into the string of the first character of that component. The len |
16 // specifies the length of that component. | 17 // specifies the length of that component. |
17 // | 18 // |
18 // This range does not include any special delimiter for that component, so | 19 // This range does not include any special delimiter for that component, so |
19 // the scheme doesn't include the trailing colon, the username and password | 20 // the scheme doesn't include the trailing colon, the username and password |
20 // don't include the @ and :, the port doesn't include the colon, the query | 21 // don't include the @ and :, the port doesn't include the colon, the query |
21 // doesn't include the ?, and the ref doesn't include the #. | 22 // doesn't include the ?, and the ref doesn't include the #. |
22 // | 23 // |
23 // The exception is that the path *does* include the first /, since that's an | 24 // The exception is that the path *does* include the first /, since that's an |
24 // integral part of the path. | 25 // integral part of the path. |
25 // | 26 // |
26 // If the component is not present at all, begin will be 0 and len will be -1. | 27 // If the component is not present at all, begin will be 0 and len will be -1. |
27 // If the component is present but empty, the length will be 0 instead. Example: | 28 // If the component is present but empty, the length will be 0 instead. Example: |
28 // http://foo/search -> query = (0, -1) | 29 // http://foo/search -> query = (0, -1) |
29 // http://foo/search? -> query = (18, 0) | 30 // http://foo/search? -> query = (18, 0) |
30 struct PP_UrlComponent_Dev { | 31 struct PP_UrlComponent_Dev { |
31 int32_t begin; | 32 int32_t begin; |
32 int32_t len; | 33 int32_t len; |
33 }; | 34 }; |
34 | 35 |
35 struct PP_UrlComponents_Dev { | 36 struct PP_UrlComponents_Dev { |
36 PP_UrlComponent_Dev scheme; | 37 struct PP_UrlComponent_Dev scheme; |
37 PP_UrlComponent_Dev username; | 38 struct PP_UrlComponent_Dev username; |
38 PP_UrlComponent_Dev password; | 39 struct PP_UrlComponent_Dev password; |
39 PP_UrlComponent_Dev host; | 40 struct PP_UrlComponent_Dev host; |
40 PP_UrlComponent_Dev port; | 41 struct PP_UrlComponent_Dev port; |
41 PP_UrlComponent_Dev path; | 42 struct PP_UrlComponent_Dev path; |
42 PP_UrlComponent_Dev query; | 43 struct PP_UrlComponent_Dev query; |
43 PP_UrlComponent_Dev ref; | 44 struct PP_UrlComponent_Dev ref; |
44 }; | 45 }; |
45 | 46 |
46 // URL encoding: URLs are supplied to this interface as NULL-terminated 8-bit | 47 // URL encoding: URLs are supplied to this interface as NULL-terminated 8-bit |
47 // strings. You can pass non-ASCII characters which will be interpreted as | 48 // strings. You can pass non-ASCII characters which will be interpreted as |
48 // UTF-8. Canonicalized URL strings returned by these functions will be ASCII | 49 // UTF-8. Canonicalized URL strings returned by these functions will be ASCII |
49 // except for the reference fragment (stuff after the '#') which will be | 50 // except for the reference fragment (stuff after the '#') which will be |
50 // encoded as UTF-8. | 51 // encoded as UTF-8. |
51 struct PPB_UrlUtil_Dev { | 52 struct PPB_UrlUtil_Dev { |
52 // Canonicalizes the given URL string according to the rules of the host | 53 // Canonicalizes the given URL string according to the rules of the host |
53 // browser. If the URL is invalid or the var is not a string, this will | 54 // browser. If the URL is invalid or the var is not a string, this will |
(...skipping 30 matching lines...) Expand all Loading... |
84 // Danger: This will be identical to resolving a relative URL on the page, | 85 // Danger: This will be identical to resolving a relative URL on the page, |
85 // and might be overridden by the page to something different than its actual | 86 // and might be overridden by the page to something different than its actual |
86 // URL via the <base> tag. Therefore, resolving a relative URL of "" won't | 87 // URL via the <base> tag. Therefore, resolving a relative URL of "" won't |
87 // necessarily give you the URL of the page! | 88 // necessarily give you the URL of the page! |
88 struct PP_Var (*ResolveRelativeToDocument)( | 89 struct PP_Var (*ResolveRelativeToDocument)( |
89 PP_Instance instance, | 90 PP_Instance instance, |
90 struct PP_Var relative_string, | 91 struct PP_Var relative_string, |
91 struct PP_UrlComponents_Dev* components); | 92 struct PP_UrlComponents_Dev* components); |
92 | 93 |
93 // Checks whether the given two URLs are in the same security origin. Returns | 94 // Checks whether the given two URLs are in the same security origin. Returns |
94 // false if either of the URLs are invalid. | 95 // FALSE if either of the URLs are invalid. |
95 bool (*IsSameSecurityOrigin)(struct PP_Var url_a, struct PP_Var url_b); | 96 PP_Bool (*IsSameSecurityOrigin)(struct PP_Var url_a, struct PP_Var url_b); |
96 | 97 |
97 // Checks whether the document hosting the given plugin instance can access | 98 // Checks whether the document hosting the given plugin instance can access |
98 // the given URL according to the same origin policy of the browser. Returns | 99 // the given URL according to the same origin policy of the browser. Returns |
99 // false if the instance or the URL is invalid. | 100 // PP_FALSE if the instance or the URL is invalid. |
100 bool (*DocumentCanRequest)(PP_Instance instance, struct PP_Var url); | 101 PP_Bool (*DocumentCanRequest)(PP_Instance instance, struct PP_Var url); |
101 | 102 |
102 // Checks whether the document containing the |active| plugin instance can | 103 // Checks whether the document containing the |active| plugin instance can |
103 // access the document containing the |target| plugin instance according to | 104 // access the document containing the |target| plugin instance according to |
104 // the security policy of the browser. This includes the same origin policy | 105 // the security policy of the browser. This includes the same origin policy |
105 // and any cross-origin capabilities enabled by the document. If either of | 106 // and any cross-origin capabilities enabled by the document. If either of |
106 // the plugin instances are invalid, returns false. | 107 // the plugin instances are invalid, returns PP_FALSE. |
107 bool (*DocumentCanAccessDocument)(PP_Instance active, PP_Instance target); | 108 PP_Bool (*DocumentCanAccessDocument)(PP_Instance active, PP_Instance target); |
108 }; | 109 }; |
109 | 110 |
110 #endif // PPAPI_C_DEV_PPB_URL_UTIL_DEV_H_ | 111 #endif // PPAPI_C_DEV_PPB_URL_UTIL_DEV_H_ |
111 | |
OLD | NEW |