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

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: fix win build Created 6 years, 11 months 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 Tue Jan 7 16:05:42 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>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 FileRef::MakeDirectory() call fails if the directory
47 * already exists.
48 */
49 PP_MAKEDIRECTORYFLAG_EXCLUSIVE = 1 << 1
50 } PP_MakeDirectoryFlags;
51 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_MakeDirectoryFlags, 4);
52 /**
53 * @}
54 */
55
56 /**
33 * @addtogroup Interfaces 57 * @addtogroup Interfaces
34 * @{ 58 * @{
35 */ 59 */
36 /** 60 /**
37 * The <code>PPB_FileRef</code> struct represents a "weak pointer" to a file in 61 * 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> 62 * a file system. This struct contains a <code>PP_FileSystemType</code>
39 * identifier and a file path string. 63 * identifier and a file path string.
40 */ 64 */
41 struct PPB_FileRef_1_1 { 65 struct PPB_FileRef_1_2 { /* dev */
42 /** 66 /**
43 * Create() creates a weak pointer to a file in the given file system. File 67 * Create() creates a weak pointer to a file in the given file system. File
44 * paths are POSIX style. 68 * paths are POSIX style.
45 * 69 *
46 * @param[in] resource A <code>PP_Resource</code> corresponding to a file 70 * @param[in] resource A <code>PP_Resource</code> corresponding to a file
47 * system. 71 * system.
48 * @param[in] path A path to the file. Must begin with a '/' character. 72 * @param[in] path A path to the file. Must begin with a '/' character.
49 * 73 *
50 * @return A <code>PP_Resource</code> corresponding to a file reference if 74 * @return A <code>PP_Resource</code> corresponding to a file reference if
51 * successful or 0 if the path is malformed. 75 * successful or 0 if the path is malformed.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 * 127 *
104 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file 128 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
105 * reference. 129 * reference.
106 * 130 *
107 * @return A <code>PP_Resource</code> containing the parent directory of the 131 * @return A <code>PP_Resource</code> containing the parent directory of the
108 * file. This function fails if the file system type is 132 * file. This function fails if the file system type is
109 * <code>PP_FileSystemType_External</code>. 133 * <code>PP_FileSystemType_External</code>.
110 */ 134 */
111 PP_Resource (*GetParent)(PP_Resource file_ref); 135 PP_Resource (*GetParent)(PP_Resource file_ref);
112 /** 136 /**
113 * MakeDirectory() makes a new directory in the file system as well as any 137 * MakeDirectory() makes a new directory in the file system according to the
114 * parent directories if the <code>make_ancestors</code> argument is 138 * 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 139 * <code>PP_MakeDirectoryFlags</code> values. It is not valid to make a
116 * file system. 140 * directory in the external file system.
117 * 141 *
118 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file 142 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
119 * reference. 143 * reference.
120 * @param[in] make_ancestors A <code>PP_Bool</code> set to 144 * @param[in] make_directory_flags A bit-mask of the
121 * <code>PP_TRUE</code> to make ancestor directories or <code>PP_FALSE</code> 145 * <code>PP_MakeDirectoryFlags</code> values.
122 * if ancestor directories are not needed. 146 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
147 * completion of MakeDirectory().
123 * 148 *
124 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 149 * @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 */ 150 */
129 int32_t (*MakeDirectory)(PP_Resource directory_ref, 151 int32_t (*MakeDirectory)(PP_Resource directory_ref,
130 PP_Bool make_ancestors, 152 int32_t make_directory_flags,
131 struct PP_CompletionCallback callback); 153 struct PP_CompletionCallback callback);
132 /** 154 /**
133 * Touch() Updates time stamps for a file. You must have write access to the 155 * Touch() Updates time stamps for a file. You must have write access to the
134 * file if it exists in the external filesystem. 156 * file if it exists in the external filesystem.
135 * 157 *
136 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file 158 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
137 * reference. 159 * reference.
138 * @param[in] last_access_time The last time the file was accessed. 160 * @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. 161 * @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 162 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 * @param[in] callback A <code>PP_CompletionCallback</code> to run on 227 * @param[in] callback A <code>PP_CompletionCallback</code> to run on
206 * completion. 228 * completion.
207 * 229 *
208 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 230 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
209 */ 231 */
210 int32_t (*ReadDirectoryEntries)(PP_Resource file_ref, 232 int32_t (*ReadDirectoryEntries)(PP_Resource file_ref,
211 struct PP_ArrayOutput output, 233 struct PP_ArrayOutput output,
212 struct PP_CompletionCallback callback); 234 struct PP_CompletionCallback callback);
213 }; 235 };
214 236
215 typedef struct PPB_FileRef_1_1 PPB_FileRef;
216
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 };
284
285 typedef struct PPB_FileRef_1_1 PPB_FileRef;
237 /** 286 /**
238 * @} 287 * @}
239 */ 288 */
240 289
241 #endif /* PPAPI_C_PPB_FILE_REF_H_ */ 290 #endif /* PPAPI_C_PPB_FILE_REF_H_ */
242 291
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698