OLD | NEW |
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2012 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 | 5 |
6 /* From ppb_file_ref.idl modified Thu Aug 15 10:50:43 2013. */ | 6 /* From ppb_file_ref.idl modified Wed Jan 8 12:40:12 2014. */ |
7 | 7 |
8 #ifndef PPAPI_C_PPB_FILE_REF_H_ | 8 #ifndef PPAPI_C_PPB_FILE_REF_H_ |
9 #define PPAPI_C_PPB_FILE_REF_H_ | 9 #define PPAPI_C_PPB_FILE_REF_H_ |
10 | 10 |
11 #include "ppapi/c/pp_array_output.h" | 11 #include "ppapi/c/pp_array_output.h" |
12 #include "ppapi/c/pp_bool.h" | 12 #include "ppapi/c/pp_bool.h" |
13 #include "ppapi/c/pp_completion_callback.h" | 13 #include "ppapi/c/pp_completion_callback.h" |
14 #include "ppapi/c/pp_file_info.h" | 14 #include "ppapi/c/pp_file_info.h" |
15 #include "ppapi/c/pp_macros.h" | 15 #include "ppapi/c/pp_macros.h" |
16 #include "ppapi/c/pp_resource.h" | 16 #include "ppapi/c/pp_resource.h" |
17 #include "ppapi/c/pp_stdint.h" | 17 #include "ppapi/c/pp_stdint.h" |
18 #include "ppapi/c/pp_time.h" | 18 #include "ppapi/c/pp_time.h" |
19 #include "ppapi/c/pp_var.h" | 19 #include "ppapi/c/pp_var.h" |
20 | 20 |
21 #define PPB_FILEREF_INTERFACE_1_0 "PPB_FileRef;1.0" | 21 #define PPB_FILEREF_INTERFACE_1_0 "PPB_FileRef;1.0" |
22 #define PPB_FILEREF_INTERFACE_1_1 "PPB_FileRef;1.1" | 22 #define PPB_FILEREF_INTERFACE_1_1 "PPB_FileRef;1.1" |
| 23 #define PPB_FILEREF_INTERFACE_1_2 "PPB_FileRef;1.2" /* dev */ |
23 #define PPB_FILEREF_INTERFACE PPB_FILEREF_INTERFACE_1_1 | 24 #define PPB_FILEREF_INTERFACE PPB_FILEREF_INTERFACE_1_1 |
24 | 25 |
25 /** | 26 /** |
26 * @file | 27 * @file |
27 * This file defines the API to create a file reference or "weak pointer" to a | 28 * This file defines the API to create a file reference or "weak pointer" to a |
28 * file in a file system. | 29 * file in a file system. |
29 */ | 30 */ |
30 | 31 |
31 | 32 |
32 /** | 33 /** |
| 34 * @addtogroup Enums |
| 35 * @{ |
| 36 */ |
| 37 /** |
| 38 * The <code>PP_MakeDirectoryFlags</code> enum contains flags used to control |
| 39 * behavior of <code>PPB_FileRef.MakeDirectory()</code>. |
| 40 */ |
| 41 typedef enum { |
| 42 PP_MAKEDIRECTORYFLAG_NONE = 0 << 0, |
| 43 /** Requests that ancestor directories are created if they do not exist. */ |
| 44 PP_MAKEDIRECTORYFLAG_WITH_ANCESTORS = 1 << 0, |
| 45 /** |
| 46 * Requests that the PPB_FileRef.MakeDirectory() call fails if the directory |
| 47 * already exists. |
| 48 */ |
| 49 PP_MAKEDIRECTORYFLAG_EXCLUSIVE = 1 << 1 |
| 50 } PP_MakeDirectoryFlags; |
| 51 /** |
| 52 * @} |
| 53 */ |
| 54 |
| 55 /** |
33 * @addtogroup Interfaces | 56 * @addtogroup Interfaces |
34 * @{ | 57 * @{ |
35 */ | 58 */ |
36 /** | 59 /** |
37 * The <code>PPB_FileRef</code> struct represents a "weak pointer" to a file in | 60 * The <code>PPB_FileRef</code> struct represents a "weak pointer" to a file in |
38 * a file system. This struct contains a <code>PP_FileSystemType</code> | 61 * a file system. This struct contains a <code>PP_FileSystemType</code> |
39 * identifier and a file path string. | 62 * identifier and a file path string. |
40 */ | 63 */ |
41 struct PPB_FileRef_1_1 { | 64 struct PPB_FileRef_1_2 { /* dev */ |
42 /** | 65 /** |
43 * Create() creates a weak pointer to a file in the given file system. File | 66 * Create() creates a weak pointer to a file in the given file system. File |
44 * paths are POSIX style. | 67 * paths are POSIX style. |
45 * | 68 * |
46 * @param[in] resource A <code>PP_Resource</code> corresponding to a file | 69 * @param[in] resource A <code>PP_Resource</code> corresponding to a file |
47 * system. | 70 * system. |
48 * @param[in] path A path to the file. Must begin with a '/' character. | 71 * @param[in] path A path to the file. Must begin with a '/' character. |
49 * | 72 * |
50 * @return A <code>PP_Resource</code> corresponding to a file reference if | 73 * @return A <code>PP_Resource</code> corresponding to a file reference if |
51 * successful or 0 if the path is malformed. | 74 * successful or 0 if the path is malformed. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 * | 126 * |
104 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file | 127 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file |
105 * reference. | 128 * reference. |
106 * | 129 * |
107 * @return A <code>PP_Resource</code> containing the parent directory of the | 130 * @return A <code>PP_Resource</code> containing the parent directory of the |
108 * file. This function fails if the file system type is | 131 * file. This function fails if the file system type is |
109 * <code>PP_FileSystemType_External</code>. | 132 * <code>PP_FileSystemType_External</code>. |
110 */ | 133 */ |
111 PP_Resource (*GetParent)(PP_Resource file_ref); | 134 PP_Resource (*GetParent)(PP_Resource file_ref); |
112 /** | 135 /** |
113 * MakeDirectory() makes a new directory in the file system as well as any | 136 * MakeDirectory() makes a new directory in the file system according to the |
114 * parent directories if the <code>make_ancestors</code> argument is | 137 * given <code>make_directory_flags</code>, which is a bit-mask of the |
115 * <code>PP_TRUE</code>. It is not valid to make a directory in the external | 138 * <code>PP_MakeDirectoryFlags</code> values. It is not valid to make a |
116 * file system. | 139 * directory in the external file system. |
117 * | 140 * |
118 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file | 141 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file |
119 * reference. | 142 * reference. |
120 * @param[in] make_ancestors A <code>PP_Bool</code> set to | 143 * @param[in] make_directory_flags A bit-mask of the |
121 * <code>PP_TRUE</code> to make ancestor directories or <code>PP_FALSE</code> | 144 * <code>PP_MakeDirectoryFlags</code> values. |
122 * if ancestor directories are not needed. | 145 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 146 * completion of MakeDirectory(). |
123 * | 147 * |
124 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 148 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
125 * Succeeds if the directory already exists. Fails if ancestor directories | |
126 * do not exist and <code>make_ancestors</code> was passed as | |
127 * <code>PP_FALSE</code>. | |
128 */ | 149 */ |
129 int32_t (*MakeDirectory)(PP_Resource directory_ref, | 150 int32_t (*MakeDirectory)(PP_Resource directory_ref, |
130 PP_Bool make_ancestors, | 151 int32_t make_directory_flags, |
131 struct PP_CompletionCallback callback); | 152 struct PP_CompletionCallback callback); |
132 /** | 153 /** |
133 * Touch() Updates time stamps for a file. You must have write access to the | 154 * Touch() Updates time stamps for a file. You must have write access to the |
134 * file if it exists in the external filesystem. | 155 * file if it exists in the external filesystem. |
135 * | 156 * |
136 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file | 157 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file |
137 * reference. | 158 * reference. |
138 * @param[in] last_access_time The last time the file was accessed. | 159 * @param[in] last_access_time The last time the file was accessed. |
139 * @param[in] last_modified_time The last time the file was modified. | 160 * @param[in] last_modified_time The last time the file was modified. |
140 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 161 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 * @param[in] callback A <code>PP_CompletionCallback</code> to run on | 226 * @param[in] callback A <code>PP_CompletionCallback</code> to run on |
206 * completion. | 227 * completion. |
207 * | 228 * |
208 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 229 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
209 */ | 230 */ |
210 int32_t (*ReadDirectoryEntries)(PP_Resource file_ref, | 231 int32_t (*ReadDirectoryEntries)(PP_Resource file_ref, |
211 struct PP_ArrayOutput output, | 232 struct PP_ArrayOutput output, |
212 struct PP_CompletionCallback callback); | 233 struct PP_CompletionCallback callback); |
213 }; | 234 }; |
214 | 235 |
215 typedef struct PPB_FileRef_1_1 PPB_FileRef; | |
216 | |
217 struct PPB_FileRef_1_0 { | 236 struct PPB_FileRef_1_0 { |
218 PP_Resource (*Create)(PP_Resource file_system, const char* path); | 237 PP_Resource (*Create)(PP_Resource file_system, const char* path); |
219 PP_Bool (*IsFileRef)(PP_Resource resource); | 238 PP_Bool (*IsFileRef)(PP_Resource resource); |
220 PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref); | 239 PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref); |
221 struct PP_Var (*GetName)(PP_Resource file_ref); | 240 struct PP_Var (*GetName)(PP_Resource file_ref); |
222 struct PP_Var (*GetPath)(PP_Resource file_ref); | 241 struct PP_Var (*GetPath)(PP_Resource file_ref); |
223 PP_Resource (*GetParent)(PP_Resource file_ref); | 242 PP_Resource (*GetParent)(PP_Resource file_ref); |
224 int32_t (*MakeDirectory)(PP_Resource directory_ref, | 243 int32_t (*MakeDirectory)(PP_Resource directory_ref, |
225 PP_Bool make_ancestors, | 244 PP_Bool make_ancestors, |
226 struct PP_CompletionCallback callback); | 245 struct PP_CompletionCallback callback); |
227 int32_t (*Touch)(PP_Resource file_ref, | 246 int32_t (*Touch)(PP_Resource file_ref, |
228 PP_Time last_access_time, | 247 PP_Time last_access_time, |
229 PP_Time last_modified_time, | 248 PP_Time last_modified_time, |
230 struct PP_CompletionCallback callback); | 249 struct PP_CompletionCallback callback); |
231 int32_t (*Delete)(PP_Resource file_ref, | 250 int32_t (*Delete)(PP_Resource file_ref, |
232 struct PP_CompletionCallback callback); | 251 struct PP_CompletionCallback callback); |
233 int32_t (*Rename)(PP_Resource file_ref, | 252 int32_t (*Rename)(PP_Resource file_ref, |
234 PP_Resource new_file_ref, | 253 PP_Resource new_file_ref, |
235 struct PP_CompletionCallback callback); | 254 struct PP_CompletionCallback callback); |
236 }; | 255 }; |
| 256 |
| 257 struct PPB_FileRef_1_1 { |
| 258 PP_Resource (*Create)(PP_Resource file_system, const char* path); |
| 259 PP_Bool (*IsFileRef)(PP_Resource resource); |
| 260 PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref); |
| 261 struct PP_Var (*GetName)(PP_Resource file_ref); |
| 262 struct PP_Var (*GetPath)(PP_Resource file_ref); |
| 263 PP_Resource (*GetParent)(PP_Resource file_ref); |
| 264 int32_t (*MakeDirectory)(PP_Resource directory_ref, |
| 265 PP_Bool make_ancestors, |
| 266 struct PP_CompletionCallback callback); |
| 267 int32_t (*Touch)(PP_Resource file_ref, |
| 268 PP_Time last_access_time, |
| 269 PP_Time last_modified_time, |
| 270 struct PP_CompletionCallback callback); |
| 271 int32_t (*Delete)(PP_Resource file_ref, |
| 272 struct PP_CompletionCallback callback); |
| 273 int32_t (*Rename)(PP_Resource file_ref, |
| 274 PP_Resource new_file_ref, |
| 275 struct PP_CompletionCallback callback); |
| 276 int32_t (*Query)(PP_Resource file_ref, |
| 277 struct PP_FileInfo* info, |
| 278 struct PP_CompletionCallback callback); |
| 279 int32_t (*ReadDirectoryEntries)(PP_Resource file_ref, |
| 280 struct PP_ArrayOutput output, |
| 281 struct PP_CompletionCallback callback); |
| 282 }; |
| 283 |
| 284 typedef struct PPB_FileRef_1_1 PPB_FileRef; |
237 /** | 285 /** |
238 * @} | 286 * @} |
239 */ | 287 */ |
240 | 288 |
241 #endif /* PPAPI_C_PPB_FILE_REF_H_ */ | 289 #endif /* PPAPI_C_PPB_FILE_REF_H_ */ |
242 | 290 |
OLD | NEW |