| 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 dev/ppb_directory_reader_dev.idl modified Mon Nov 26 13:52:22 2012. */ | 6 /* From dev/ppb_directory_reader_dev.idl modified Fri Jan 18 13:11:23 2013. */ |
| 7 | 7 |
| 8 #ifndef PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_ | 8 #ifndef PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_ |
| 9 #define PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_ | 9 #define PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_ |
| 10 | 10 |
| 11 #include "ppapi/c/pp_array_output.h" |
| 11 #include "ppapi/c/pp_bool.h" | 12 #include "ppapi/c/pp_bool.h" |
| 12 #include "ppapi/c/pp_completion_callback.h" | 13 #include "ppapi/c/pp_completion_callback.h" |
| 13 #include "ppapi/c/pp_file_info.h" | 14 #include "ppapi/c/pp_file_info.h" |
| 14 #include "ppapi/c/pp_macros.h" | 15 #include "ppapi/c/pp_macros.h" |
| 15 #include "ppapi/c/pp_resource.h" | 16 #include "ppapi/c/pp_resource.h" |
| 16 #include "ppapi/c/pp_stdint.h" | 17 #include "ppapi/c/pp_stdint.h" |
| 17 | 18 |
| 18 #define PPB_DIRECTORYREADER_DEV_INTERFACE_0_5 "PPB_DirectoryReader(Dev);0.5" | 19 #define PPB_DIRECTORYREADER_DEV_INTERFACE_0_5 "PPB_DirectoryReader(Dev);0.5" |
| 19 #define PPB_DIRECTORYREADER_DEV_INTERFACE PPB_DIRECTORYREADER_DEV_INTERFACE_0_5 | 20 #define PPB_DIRECTORYREADER_DEV_INTERFACE_0_6 "PPB_DirectoryReader(Dev);0.6" |
| 21 #define PPB_DIRECTORYREADER_DEV_INTERFACE PPB_DIRECTORYREADER_DEV_INTERFACE_0_6 |
| 20 | 22 |
| 21 /** | 23 /** |
| 22 * @file | 24 * @file |
| 23 * | 25 * |
| 24 * This file defines the <code>PPB_DirectoryReader_Dev</code> interface. | 26 * This file defines the <code>PPB_DirectoryReader_Dev</code> interface. |
| 25 */ | 27 */ |
| 26 | 28 |
| 27 | 29 |
| 28 /** | 30 /** |
| 29 * @addtogroup Structs | 31 * @addtogroup Structs |
| 30 * @{ | 32 * @{ |
| 31 */ | 33 */ |
| 32 struct PP_DirectoryEntry_Dev { | 34 struct PP_DirectoryEntry_Dev { |
| 33 PP_Resource file_ref; | 35 PP_Resource file_ref; |
| 34 PP_FileType file_type; | 36 PP_FileType file_type; |
| 35 }; | 37 }; |
| 36 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DirectoryEntry_Dev, 8); | 38 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DirectoryEntry_Dev, 8); |
| 37 /** | 39 /** |
| 38 * @} | 40 * @} |
| 39 */ | 41 */ |
| 40 | 42 |
| 41 /** | 43 /** |
| 42 * @addtogroup Interfaces | 44 * @addtogroup Interfaces |
| 43 * @{ | 45 * @{ |
| 44 */ | 46 */ |
| 45 struct PPB_DirectoryReader_Dev_0_5 { | 47 struct PPB_DirectoryReader_Dev_0_6 { |
| 46 /* Creates a DirectoryReader for the given directory. Upon success, the | 48 /* Creates a DirectoryReader for the given directory. Upon success, the |
| 47 * corresponding directory is classified as "in use" by the resulting | 49 * corresponding directory is classified as "in use" by the resulting |
| 48 * DirectoryReader object until such time as the DirectoryReader object is | 50 * DirectoryReader object until such time as the DirectoryReader object is |
| 49 * destroyed. */ | 51 * destroyed. */ |
| 50 PP_Resource (*Create)(PP_Resource directory_ref); | 52 PP_Resource (*Create)(PP_Resource directory_ref); |
| 51 /* Returns PP_TRUE if the given resource is a DirectoryReader. Returns | 53 /* Returns PP_TRUE if the given resource is a DirectoryReader. Returns |
| 52 * PP_FALSE if the resource is invalid or some type other than a | 54 * PP_FALSE if the resource is invalid or some type other than a |
| 53 * DirectoryReader. */ | 55 * DirectoryReader. */ |
| 54 PP_Bool (*IsDirectoryReader)(PP_Resource resource); | 56 PP_Bool (*IsDirectoryReader)(PP_Resource resource); |
| 55 /* Reads the next entry in the directory. Returns PP_OK and sets | 57 /* Reads all entries in the directory. |
| 56 * entry->file_ref to 0 to indicate reaching the end of the directory. If | |
| 57 * entry->file_ref is non-zero when passed to GetNextEntry, it will be | |
| 58 * released before the next file_ref is stored. | |
| 59 * | 58 * |
| 60 * EXAMPLE USAGE: | 59 * @param[in] directory_reader A <code>PP_Resource</code> corresponding to a |
| 60 * directory reader resource. |
| 61 * @param[in] output An output array which will receive |
| 62 * <code>PP_DirectoryEntry_Dev</code> objects on success. |
| 63 * @param[in] callback A <code>PP_CompletionCallback</code> to run on |
| 64 * completion. |
| 61 * | 65 * |
| 62 * PP_Resource reader = reader_funcs->Create(dir_ref); | 66 * @return An error code from <code>pp_errors.h</code>. |
| 63 * PP_DirectoryEntry entry = {0}; | |
| 64 * while ((reader_funcs->GetNextEntry(reader, &entry, | |
| 65 * PP_BlockUntilComplete()) == PP_OK) && | |
| 66 * entry->file_ref) { | |
| 67 * ProcessDirectoryEntry(entry); | |
| 68 * } | |
| 69 * core_funcs->ReleaseResource(reader); | |
| 70 */ | 67 */ |
| 68 int32_t (*ReadEntries)(PP_Resource directory_reader, |
| 69 struct PP_ArrayOutput output, |
| 70 struct PP_CompletionCallback callback); |
| 71 }; |
| 72 |
| 73 typedef struct PPB_DirectoryReader_Dev_0_6 PPB_DirectoryReader_Dev; |
| 74 |
| 75 struct PPB_DirectoryReader_Dev_0_5 { |
| 76 PP_Resource (*Create)(PP_Resource directory_ref); |
| 77 PP_Bool (*IsDirectoryReader)(PP_Resource resource); |
| 71 int32_t (*GetNextEntry)(PP_Resource directory_reader, | 78 int32_t (*GetNextEntry)(PP_Resource directory_reader, |
| 72 struct PP_DirectoryEntry_Dev* entry, | 79 struct PP_DirectoryEntry_Dev* entry, |
| 73 struct PP_CompletionCallback callback); | 80 struct PP_CompletionCallback callback); |
| 74 }; | 81 }; |
| 75 | |
| 76 typedef struct PPB_DirectoryReader_Dev_0_5 PPB_DirectoryReader_Dev; | |
| 77 /** | 82 /** |
| 78 * @} | 83 * @} |
| 79 */ | 84 */ |
| 80 | 85 |
| 81 #endif /* PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_ */ | 86 #endif /* PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_ */ |
| 82 | 87 |
| OLD | NEW |