Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: ppapi/c/dev/ppb_url_util_dev.h

Issue 5674004: Add compile assertions to enforce the sizes of all structs and enums in the C... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_bool.h"
9 #include "ppapi/c/pp_instance.h" 9 #include "ppapi/c/pp_instance.h"
10 #include "ppapi/c/pp_macros.h"
10 #include "ppapi/c/pp_stdint.h" 11 #include "ppapi/c/pp_stdint.h"
11 #include "ppapi/c/pp_var.h" 12 #include "ppapi/c/pp_var.h"
12 13
13 #define PPB_URLUTIL_DEV_INTERFACE "PPB_UrlUtil(Dev);0.2" 14 #define PPB_URLUTIL_DEV_INTERFACE "PPB_UrlUtil(Dev);0.3"
14 15
15 // A component specifies the range of the part of the URL. The begin specifies 16 // A component specifies the range of the part of the URL. The begin specifies
16 // the index into the string of the first character of that component. The len 17 // the index into the string of the first character of that component. The len
17 // specifies the length of that component. 18 // specifies the length of that component.
18 // 19 //
19 // This range does not include any special delimiter for that component, so 20 // This range does not include any special delimiter for that component, so
20 // the scheme doesn't include the trailing colon, the username and password 21 // the scheme doesn't include the trailing colon, the username and password
21 // don't include the @ and :, the port doesn't include the colon, the query 22 // don't include the @ and :, the port doesn't include the colon, the query
22 // doesn't include the ?, and the ref doesn't include the #. 23 // doesn't include the ?, and the ref doesn't include the #.
23 // 24 //
24 // The exception is that the path *does* include the first /, since that's an 25 // The exception is that the path *does* include the first /, since that's an
25 // integral part of the path. 26 // integral part of the path.
26 // 27 //
27 // If the component is not present at all, begin will be 0 and len will be -1. 28 // If the component is not present at all, begin will be 0 and len will be -1.
28 // If the component is present but empty, the length will be 0 instead. Example: 29 // If the component is present but empty, the length will be 0 instead. Example:
29 // http://foo/search -> query = (0, -1) 30 // http://foo/search -> query = (0, -1)
30 // http://foo/search? -> query = (18, 0) 31 // http://foo/search? -> query = (18, 0)
31 struct PP_UrlComponent_Dev { 32 struct PP_UrlComponent_Dev {
32 int32_t begin; 33 int32_t begin;
33 int32_t len; 34 int32_t len;
34 }; 35 };
36 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_UrlComponent_Dev, 8);
35 37
36 struct PP_UrlComponents_Dev { 38 struct PP_UrlComponents_Dev {
37 struct PP_UrlComponent_Dev scheme; 39 struct PP_UrlComponent_Dev scheme;
38 struct PP_UrlComponent_Dev username; 40 struct PP_UrlComponent_Dev username;
39 struct PP_UrlComponent_Dev password; 41 struct PP_UrlComponent_Dev password;
40 struct PP_UrlComponent_Dev host; 42 struct PP_UrlComponent_Dev host;
41 struct PP_UrlComponent_Dev port; 43 struct PP_UrlComponent_Dev port;
42 struct PP_UrlComponent_Dev path; 44 struct PP_UrlComponent_Dev path;
43 struct PP_UrlComponent_Dev query; 45 struct PP_UrlComponent_Dev query;
44 struct PP_UrlComponent_Dev ref; 46 struct PP_UrlComponent_Dev ref;
45 }; 47 };
48 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_UrlComponents_Dev, 64);
46 49
47 // URL encoding: URLs are supplied to this interface as NULL-terminated 8-bit 50 // URL encoding: URLs are supplied to this interface as NULL-terminated 8-bit
48 // strings. You can pass non-ASCII characters which will be interpreted as 51 // strings. You can pass non-ASCII characters which will be interpreted as
49 // UTF-8. Canonicalized URL strings returned by these functions will be ASCII 52 // UTF-8. Canonicalized URL strings returned by these functions will be ASCII
50 // except for the reference fragment (stuff after the '#') which will be 53 // except for the reference fragment (stuff after the '#') which will be
51 // encoded as UTF-8. 54 // encoded as UTF-8.
52 struct PPB_UrlUtil_Dev { 55 struct PPB_UrlUtil_Dev {
53 // Canonicalizes the given URL string according to the rules of the host 56 // Canonicalizes the given URL string according to the rules of the host
54 // browser. If the URL is invalid or the var is not a string, this will 57 // browser. If the URL is invalid or the var is not a string, this will
55 // return a Null var and the components structure will be unchanged. 58 // return a Null var and the components structure will be unchanged.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 105
103 // Checks whether the document containing the |active| plugin instance can 106 // Checks whether the document containing the |active| plugin instance can
104 // access the document containing the |target| plugin instance according to 107 // access the document containing the |target| plugin instance according to
105 // the security policy of the browser. This includes the same origin policy 108 // the security policy of the browser. This includes the same origin policy
106 // and any cross-origin capabilities enabled by the document. If either of 109 // and any cross-origin capabilities enabled by the document. If either of
107 // the plugin instances are invalid, returns PP_FALSE. 110 // the plugin instances are invalid, returns PP_FALSE.
108 PP_Bool (*DocumentCanAccessDocument)(PP_Instance active, PP_Instance target); 111 PP_Bool (*DocumentCanAccessDocument)(PP_Instance active, PP_Instance target);
109 }; 112 };
110 113
111 #endif // PPAPI_C_DEV_PPB_URL_UTIL_DEV_H_ 114 #endif // PPAPI_C_DEV_PPB_URL_UTIL_DEV_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698