OLD | NEW |
1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2011 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_PPB_FILE_SYSTEM_H_ | 5 #ifndef PPAPI_C_PPB_FILE_SYSTEM_H_ |
6 #define PPAPI_C_PPB_FILE_SYSTEM_H_ | 6 #define PPAPI_C_PPB_FILE_SYSTEM_H_ |
7 | 7 |
8 #include "ppapi/c/pp_bool.h" | 8 #include "ppapi/c/pp_bool.h" |
9 #include "ppapi/c/pp_file_info.h" | 9 #include "ppapi/c/pp_file_info.h" |
10 #include "ppapi/c/pp_instance.h" | 10 #include "ppapi/c/pp_instance.h" |
11 #include "ppapi/c/pp_resource.h" | 11 #include "ppapi/c/pp_resource.h" |
12 #include "ppapi/c/pp_stdint.h" | 12 #include "ppapi/c/pp_stdint.h" |
13 #include "ppapi/c/pp_time.h" | 13 #include "ppapi/c/pp_time.h" |
14 | 14 |
| 15 /** |
| 16 * @file |
| 17 * This file defines the API to create a file system associated with a file. |
| 18 */ |
| 19 |
15 struct PP_CompletionCallback; | 20 struct PP_CompletionCallback; |
16 | 21 |
17 #define PPB_FILESYSTEM_INTERFACE_0_7 "PPB_FileSystem;0.7" | 22 #define PPB_FILESYSTEM_INTERFACE_0_7 "PPB_FileSystem;0.7" |
18 #define PPB_FILESYSTEM_INTERFACE PPB_FILESYSTEM_INTERFACE_0_7 | 23 #define PPB_FILESYSTEM_INTERFACE PPB_FILESYSTEM_INTERFACE_0_7 |
19 | 24 |
| 25 /** |
| 26 * @addtogroup Structs |
| 27 * @{ |
| 28 */ |
| 29 |
| 30 /** |
| 31 * The <code>PPB_FileSystem</code> struct identifies the file system type |
| 32 * associated with a file. |
| 33 */ |
20 struct PPB_FileSystem { | 34 struct PPB_FileSystem { |
21 /** Creates a filesystem object of the given type. */ | 35 /** Create() creates a file system object of the given type. |
| 36 * |
| 37 * @param[in] instance A <code>PP_Instance</code> indentifying the instance |
| 38 * with the file. |
| 39 * @param[in] type A file system type as defined by |
| 40 * <code>PP_FileSystemType</code> enum. |
| 41 * |
| 42 * @return A <code>PP_Resource</code> corresponding to a file system if |
| 43 * successful. |
| 44 */ |
22 PP_Resource (*Create)(PP_Instance instance, PP_FileSystemType type); | 45 PP_Resource (*Create)(PP_Instance instance, PP_FileSystemType type); |
23 | 46 |
24 /** Returns PP_TRUE if the given resource is a FileSystem. */ | 47 /** |
| 48 * IsFileSystem() determines if the provided resource is a file system. |
| 49 * |
| 50 * @param[in] resource A <code>PP_Resource</code> corresponding to a file |
| 51 * system. |
| 52 * |
| 53 * @return <code>PP_TRUE</code> if the resource is a |
| 54 * <code>PPB_FileSystem</code>, <code>PP_FALSE</code> if the resource is |
| 55 * invalid or some type other than <code>PPB_FileSystem</code>. |
| 56 */ |
25 PP_Bool (*IsFileSystem)(PP_Resource resource); | 57 PP_Bool (*IsFileSystem)(PP_Resource resource); |
26 | 58 |
27 /** | 59 /** |
28 * Opens the file system. A file system must be opened before running any | 60 * Open() opens the file system. A file system must be opened before running |
29 * other operation on it. | 61 * any other operation on it. |
| 62 * |
| 63 * @param[in] file_system A <code>PP_Resource</code> corresponding to a file |
| 64 * system. |
| 65 * @param[in] expected_size The expected size of the file system. |
| 66 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 67 * completion of Open(). |
| 68 * |
| 69 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
30 * | 70 * |
31 * TODO(brettw) clarify whether this must have completed before a file can | 71 * TODO(brettw) clarify whether this must have completed before a file can |
32 * be opened in it. Clarify what it means to be "completed." | 72 * be opened in it. Clarify what it means to be "completed." |
33 */ | 73 */ |
34 int32_t (*Open)(PP_Resource file_system, | 74 int32_t (*Open)(PP_Resource file_system, |
35 int64_t expected_size, | 75 int64_t expected_size, |
36 struct PP_CompletionCallback callback); | 76 struct PP_CompletionCallback callback); |
37 | 77 |
38 /** | 78 /** |
39 * Returns the type of the given file system. | 79 * GetType() returns the type of the provided file system. |
40 * | 80 * |
41 * Returns PP_FILESYSTEMTYPE_INVALID if the given resource is not a valid | 81 * @param[in] file_system A <code>PP_Resource</code> corresponding to a file |
42 * filesystem. It is valid to call this function even before Open completes. | 82 * system. |
| 83 * |
| 84 * @return A <code>PP_FileSystemType</code> with the file system type if |
| 85 * valid or <code>PP_FILESYSTEMTYPE_INVALID</code> if the provided resource |
| 86 * is not a valid file system. It is valid to call this function even before |
| 87 * Open() completes. |
43 */ | 88 */ |
44 PP_FileSystemType (*GetType)(PP_Resource file_system); | 89 PP_FileSystemType (*GetType)(PP_Resource file_system); |
45 }; | 90 }; |
| 91 /** |
| 92 * @} |
| 93 */ |
46 | 94 |
47 #endif /* PPAPI_C_PPB_FILE_SYSTEM_H_ */ | 95 #endif /* PPAPI_C_PPB_FILE_SYSTEM_H_ */ |
OLD | NEW |