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