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

Side by Side Diff: ppapi/c/ppb_file_ref.h

Issue 113363004: PPAPI: Add new PPB_FileRef.MakeDirectory to support exclusive operation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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) 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 Thu Dec 19 14:47:41 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 * 124 *
124 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 125 * @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 * Succeeds if the directory already exists. Fails if ancestor directories
126 * do not exist and <code>make_ancestors</code> was passed as 127 * do not exist and <code>make_ancestors</code> was passed as
127 * <code>PP_FALSE</code>. 128 * <code>PP_FALSE</code>.
128 */ 129 */
129 int32_t (*MakeDirectory)(PP_Resource directory_ref, 130 int32_t (*MakeDirectory)(PP_Resource directory_ref,
130 PP_Bool make_ancestors, 131 PP_Bool make_ancestors,
131 struct PP_CompletionCallback callback); 132 struct PP_CompletionCallback callback);
132 /** 133 /**
134 * MakeDirectoryExclusive() makes a new directory in the file system as well
135 * as any parent directories if the <code>make_ancestors</code> argument is
136 * <code>PP_TRUE</code>. It is not valid to make a directory in the external
137 * file system.
138 *
139 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
140 * reference.
141 * @param[in] make_ancestors A <code>PP_Bool</code> set to
142 * <code>PP_TRUE</code> to make ancestor directories or <code>PP_FALSE</code>
143 * if ancestor directories are not needed.
144 *
145 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
146 * Fails if the directory already exists or if ancestor directories do not
147 * exist and <code>make_ancestors</code> was passed as <code>PP_FALSE</code>.
148 */
149 int32_t (*MakeDirectoryExclusive)(PP_Resource directory_ref,
150 PP_Bool make_ancestors,
151 struct PP_CompletionCallback callback);
152 /**
133 * Touch() Updates time stamps for a file. You must have write access to the 153 * Touch() Updates time stamps for a file. You must have write access to the
134 * file if it exists in the external filesystem. 154 * file if it exists in the external filesystem.
135 * 155 *
136 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file 156 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
137 * reference. 157 * reference.
138 * @param[in] last_access_time The last time the file was accessed. 158 * @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. 159 * @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 160 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
141 * completion of Touch(). 161 * completion of Touch().
142 * 162 *
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 * @param[in] callback A <code>PP_CompletionCallback</code> to run on 225 * @param[in] callback A <code>PP_CompletionCallback</code> to run on
206 * completion. 226 * completion.
207 * 227 *
208 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 228 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
209 */ 229 */
210 int32_t (*ReadDirectoryEntries)(PP_Resource file_ref, 230 int32_t (*ReadDirectoryEntries)(PP_Resource file_ref,
211 struct PP_ArrayOutput output, 231 struct PP_ArrayOutput output,
212 struct PP_CompletionCallback callback); 232 struct PP_CompletionCallback callback);
213 }; 233 };
214 234
215 typedef struct PPB_FileRef_1_1 PPB_FileRef; 235 typedef struct PPB_FileRef_1_2 PPB_FileRef;
216 236
217 struct PPB_FileRef_1_0 { 237 struct PPB_FileRef_1_0 {
218 PP_Resource (*Create)(PP_Resource file_system, const char* path); 238 PP_Resource (*Create)(PP_Resource file_system, const char* path);
219 PP_Bool (*IsFileRef)(PP_Resource resource); 239 PP_Bool (*IsFileRef)(PP_Resource resource);
220 PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref); 240 PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref);
221 struct PP_Var (*GetName)(PP_Resource file_ref); 241 struct PP_Var (*GetName)(PP_Resource file_ref);
222 struct PP_Var (*GetPath)(PP_Resource file_ref); 242 struct PP_Var (*GetPath)(PP_Resource file_ref);
223 PP_Resource (*GetParent)(PP_Resource file_ref); 243 PP_Resource (*GetParent)(PP_Resource file_ref);
224 int32_t (*MakeDirectory)(PP_Resource directory_ref, 244 int32_t (*MakeDirectory)(PP_Resource directory_ref,
225 PP_Bool make_ancestors, 245 PP_Bool make_ancestors,
226 struct PP_CompletionCallback callback); 246 struct PP_CompletionCallback callback);
227 int32_t (*Touch)(PP_Resource file_ref, 247 int32_t (*Touch)(PP_Resource file_ref,
228 PP_Time last_access_time, 248 PP_Time last_access_time,
229 PP_Time last_modified_time, 249 PP_Time last_modified_time,
230 struct PP_CompletionCallback callback); 250 struct PP_CompletionCallback callback);
231 int32_t (*Delete)(PP_Resource file_ref, 251 int32_t (*Delete)(PP_Resource file_ref,
232 struct PP_CompletionCallback callback); 252 struct PP_CompletionCallback callback);
233 int32_t (*Rename)(PP_Resource file_ref, 253 int32_t (*Rename)(PP_Resource file_ref,
234 PP_Resource new_file_ref, 254 PP_Resource new_file_ref,
235 struct PP_CompletionCallback callback); 255 struct PP_CompletionCallback callback);
236 }; 256 };
257
258 struct PPB_FileRef_1_1 {
259 PP_Resource (*Create)(PP_Resource file_system, const char* path);
260 PP_Bool (*IsFileRef)(PP_Resource resource);
261 PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref);
262 struct PP_Var (*GetName)(PP_Resource file_ref);
263 struct PP_Var (*GetPath)(PP_Resource file_ref);
264 PP_Resource (*GetParent)(PP_Resource file_ref);
265 int32_t (*MakeDirectory)(PP_Resource directory_ref,
266 PP_Bool make_ancestors,
267 struct PP_CompletionCallback callback);
268 int32_t (*Touch)(PP_Resource file_ref,
269 PP_Time last_access_time,
270 PP_Time last_modified_time,
271 struct PP_CompletionCallback callback);
272 int32_t (*Delete)(PP_Resource file_ref,
273 struct PP_CompletionCallback callback);
274 int32_t (*Rename)(PP_Resource file_ref,
275 PP_Resource new_file_ref,
276 struct PP_CompletionCallback callback);
277 int32_t (*Query)(PP_Resource file_ref,
278 struct PP_FileInfo* info,
279 struct PP_CompletionCallback callback);
280 int32_t (*ReadDirectoryEntries)(PP_Resource file_ref,
281 struct PP_ArrayOutput output,
282 struct PP_CompletionCallback callback);
283 };
237 /** 284 /**
238 * @} 285 * @}
239 */ 286 */
240 287
241 #endif /* PPAPI_C_PPB_FILE_REF_H_ */ 288 #endif /* PPAPI_C_PPB_FILE_REF_H_ */
242 289
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698