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 Fri Dec 20 19:48:33 2013. */ |
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 PPB_FILEREF_INTERFACE_1_1 | 23 #define PPB_FILEREF_INTERFACE_1_2 "PPB_FileRef;1.2" |
| 24 #define PPB_FILEREF_INTERFACE PPB_FILEREF_INTERFACE_1_2 |
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 /** |
33 * @addtogroup Interfaces | 34 * @addtogroup Interfaces |
34 * @{ | 35 * @{ |
35 */ | 36 */ |
36 /** | 37 /** |
37 * The <code>PPB_FileRef</code> struct represents a "weak pointer" to a file in | 38 * 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> | 39 * a file system. This struct contains a <code>PP_FileSystemType</code> |
39 * identifier and a file path string. | 40 * identifier and a file path string. |
40 */ | 41 */ |
41 struct PPB_FileRef_1_1 { | 42 struct PPB_FileRef_1_2 { |
42 /** | 43 /** |
43 * Create() creates a weak pointer to a file in the given file system. File | 44 * Create() creates a weak pointer to a file in the given file system. File |
44 * paths are POSIX style. | 45 * paths are POSIX style. |
45 * | 46 * |
46 * @param[in] resource A <code>PP_Resource</code> corresponding to a file | 47 * @param[in] resource A <code>PP_Resource</code> corresponding to a file |
47 * system. | 48 * system. |
48 * @param[in] path A path to the file. Must begin with a '/' character. | 49 * @param[in] path A path to the file. Must begin with a '/' character. |
49 * | 50 * |
50 * @return A <code>PP_Resource</code> corresponding to a file reference if | 51 * @return A <code>PP_Resource</code> corresponding to a file reference if |
51 * successful or 0 if the path is malformed. | 52 * successful or 0 if the path is malformed. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 */ | 111 */ |
111 PP_Resource (*GetParent)(PP_Resource file_ref); | 112 PP_Resource (*GetParent)(PP_Resource file_ref); |
112 /** | 113 /** |
113 * MakeDirectory() makes a new directory in the file system as well as any | 114 * MakeDirectory() makes a new directory in the file system as well as any |
114 * parent directories if the <code>make_ancestors</code> argument is | 115 * parent directories if the <code>make_ancestors</code> argument is |
115 * <code>PP_TRUE</code>. It is not valid to make a directory in the external | 116 * <code>PP_TRUE</code>. It is not valid to make a directory in the external |
116 * file system. | 117 * file system. |
117 * | 118 * |
118 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file | 119 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file |
119 * reference. | 120 * reference. |
| 121 * @param[in] exclusive A <code>PP_Bool</code> set to <code>PP_TRUE</code> to |
| 122 * fail if the directory already exists. |
120 * @param[in] make_ancestors A <code>PP_Bool</code> set to | 123 * @param[in] make_ancestors A <code>PP_Bool</code> set to |
121 * <code>PP_TRUE</code> to make ancestor directories or <code>PP_FALSE</code> | 124 * <code>PP_TRUE</code> to make ancestor directories or <code>PP_FALSE</code> |
122 * if ancestor directories are not needed. | 125 * if ancestor directories are not needed. |
123 * | 126 * |
124 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 127 * @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 | 128 * Fails if the directory already exists and <code>exclusive</code> was passed |
126 * do not exist and <code>make_ancestors</code> was passed as | 129 * as <code>PP_TRUE</code>. And also fails if ancestor directories do not |
127 * <code>PP_FALSE</code>. | 130 * exist and <code>make_ancestors</code> was passed as <code>PP_FALSE</code>. |
128 */ | 131 */ |
129 int32_t (*MakeDirectory)(PP_Resource directory_ref, | 132 int32_t (*MakeDirectory)(PP_Resource directory_ref, |
| 133 PP_Bool exclusive, |
130 PP_Bool make_ancestors, | 134 PP_Bool make_ancestors, |
131 struct PP_CompletionCallback callback); | 135 struct PP_CompletionCallback callback); |
132 /** | 136 /** |
133 * Touch() Updates time stamps for a file. You must have write access to the | 137 * Touch() Updates time stamps for a file. You must have write access to the |
134 * file if it exists in the external filesystem. | 138 * file if it exists in the external filesystem. |
135 * | 139 * |
136 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file | 140 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file |
137 * reference. | 141 * reference. |
138 * @param[in] last_access_time The last time the file was accessed. | 142 * @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. | 143 * @param[in] last_modified_time The last time the file was modified. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 * @param[in] callback A <code>PP_CompletionCallback</code> to run on | 209 * @param[in] callback A <code>PP_CompletionCallback</code> to run on |
206 * completion. | 210 * completion. |
207 * | 211 * |
208 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 212 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
209 */ | 213 */ |
210 int32_t (*ReadDirectoryEntries)(PP_Resource file_ref, | 214 int32_t (*ReadDirectoryEntries)(PP_Resource file_ref, |
211 struct PP_ArrayOutput output, | 215 struct PP_ArrayOutput output, |
212 struct PP_CompletionCallback callback); | 216 struct PP_CompletionCallback callback); |
213 }; | 217 }; |
214 | 218 |
215 typedef struct PPB_FileRef_1_1 PPB_FileRef; | 219 typedef struct PPB_FileRef_1_2 PPB_FileRef; |
216 | 220 |
217 struct PPB_FileRef_1_0 { | 221 struct PPB_FileRef_1_0 { |
218 PP_Resource (*Create)(PP_Resource file_system, const char* path); | 222 PP_Resource (*Create)(PP_Resource file_system, const char* path); |
219 PP_Bool (*IsFileRef)(PP_Resource resource); | 223 PP_Bool (*IsFileRef)(PP_Resource resource); |
220 PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref); | 224 PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref); |
221 struct PP_Var (*GetName)(PP_Resource file_ref); | 225 struct PP_Var (*GetName)(PP_Resource file_ref); |
222 struct PP_Var (*GetPath)(PP_Resource file_ref); | 226 struct PP_Var (*GetPath)(PP_Resource file_ref); |
223 PP_Resource (*GetParent)(PP_Resource file_ref); | 227 PP_Resource (*GetParent)(PP_Resource file_ref); |
224 int32_t (*MakeDirectory)(PP_Resource directory_ref, | 228 int32_t (*MakeDirectory)(PP_Resource directory_ref, |
225 PP_Bool make_ancestors, | 229 PP_Bool make_ancestors, |
226 struct PP_CompletionCallback callback); | 230 struct PP_CompletionCallback callback); |
227 int32_t (*Touch)(PP_Resource file_ref, | 231 int32_t (*Touch)(PP_Resource file_ref, |
228 PP_Time last_access_time, | 232 PP_Time last_access_time, |
229 PP_Time last_modified_time, | 233 PP_Time last_modified_time, |
230 struct PP_CompletionCallback callback); | 234 struct PP_CompletionCallback callback); |
231 int32_t (*Delete)(PP_Resource file_ref, | 235 int32_t (*Delete)(PP_Resource file_ref, |
232 struct PP_CompletionCallback callback); | 236 struct PP_CompletionCallback callback); |
233 int32_t (*Rename)(PP_Resource file_ref, | 237 int32_t (*Rename)(PP_Resource file_ref, |
234 PP_Resource new_file_ref, | 238 PP_Resource new_file_ref, |
235 struct PP_CompletionCallback callback); | 239 struct PP_CompletionCallback callback); |
236 }; | 240 }; |
| 241 |
| 242 struct PPB_FileRef_1_1 { |
| 243 PP_Resource (*Create)(PP_Resource file_system, const char* path); |
| 244 PP_Bool (*IsFileRef)(PP_Resource resource); |
| 245 PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref); |
| 246 struct PP_Var (*GetName)(PP_Resource file_ref); |
| 247 struct PP_Var (*GetPath)(PP_Resource file_ref); |
| 248 PP_Resource (*GetParent)(PP_Resource file_ref); |
| 249 int32_t (*MakeDirectory)(PP_Resource directory_ref, |
| 250 PP_Bool make_ancestors, |
| 251 struct PP_CompletionCallback callback); |
| 252 int32_t (*Touch)(PP_Resource file_ref, |
| 253 PP_Time last_access_time, |
| 254 PP_Time last_modified_time, |
| 255 struct PP_CompletionCallback callback); |
| 256 int32_t (*Delete)(PP_Resource file_ref, |
| 257 struct PP_CompletionCallback callback); |
| 258 int32_t (*Rename)(PP_Resource file_ref, |
| 259 PP_Resource new_file_ref, |
| 260 struct PP_CompletionCallback callback); |
| 261 int32_t (*Query)(PP_Resource file_ref, |
| 262 struct PP_FileInfo* info, |
| 263 struct PP_CompletionCallback callback); |
| 264 int32_t (*ReadDirectoryEntries)(PP_Resource file_ref, |
| 265 struct PP_ArrayOutput output, |
| 266 struct PP_CompletionCallback callback); |
| 267 }; |
237 /** | 268 /** |
238 * @} | 269 * @} |
239 */ | 270 */ |
240 | 271 |
241 #endif /* PPAPI_C_PPB_FILE_REF_H_ */ | 272 #endif /* PPAPI_C_PPB_FILE_REF_H_ */ |
242 | 273 |
OLD | NEW |