| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_DEV_PPB_DIRECTORY_READER_DEV_H_ | 5 #ifndef PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_ |
| 6 #define PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_ | 6 #define PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_ |
| 7 | 7 |
| 8 #include "ppapi/c/pp_bool.h" |
| 8 #include "ppapi/c/dev/pp_file_info_dev.h" | 9 #include "ppapi/c/dev/pp_file_info_dev.h" |
| 9 #include "ppapi/c/pp_module.h" | 10 #include "ppapi/c/pp_module.h" |
| 10 #include "ppapi/c/pp_resource.h" | 11 #include "ppapi/c/pp_resource.h" |
| 11 | 12 |
| 12 struct PP_CompletionCallback; | 13 struct PP_CompletionCallback; |
| 13 | 14 |
| 14 struct PP_DirectoryEntry_Dev { | 15 struct PP_DirectoryEntry_Dev { |
| 15 PP_Resource file_ref; | 16 PP_Resource file_ref; |
| 16 PP_FileType_Dev file_type; | 17 PP_FileType_Dev file_type; |
| 17 }; | 18 }; |
| 18 | 19 |
| 19 #define PPB_DIRECTORYREADER_DEV_INTERFACE "PPB_DirectoryReader(Dev);0.1" | 20 #define PPB_DIRECTORYREADER_DEV_INTERFACE "PPB_DirectoryReader(Dev);0.2" |
| 20 | 21 |
| 21 struct PPB_DirectoryReader_Dev { | 22 struct PPB_DirectoryReader_Dev { |
| 22 // Creates a DirectoryReader for the given directory. Upon success, the | 23 // Creates a DirectoryReader for the given directory. Upon success, the |
| 23 // corresponding directory is classified as "in use" by the resulting | 24 // corresponding directory is classified as "in use" by the resulting |
| 24 // DirectoryReader object until such time as the DirectoryReader object is | 25 // DirectoryReader object until such time as the DirectoryReader object is |
| 25 // destroyed. | 26 // destroyed. |
| 26 PP_Resource (*Create)(PP_Resource directory_ref); | 27 PP_Resource (*Create)(PP_Resource directory_ref); |
| 27 | 28 |
| 28 // Returns true if the given resource is a DirectoryReader. Returns false if | 29 // Returns PP_TRUE if the given resource is a DirectoryReader. Returns |
| 29 // the resource is invalid or some type other than a DirectoryReader. | 30 // PP_FALSE if the resource is invalid or some type other than a |
| 30 bool (*IsDirectoryReader)(PP_Resource resource); | 31 // DirectoryReader. |
| 32 PP_Bool (*IsDirectoryReader)(PP_Resource resource); |
| 31 | 33 |
| 32 // Reads the next entry in the directory. Return PP_OK and sets | 34 // Reads the next entry in the directory. Return PP_OK and sets |
| 33 // entry->file_ref to 0 to indicate reaching the end of the directory. If | 35 // entry->file_ref to 0 to indicate reaching the end of the directory. If |
| 34 // entry->file_ref is non-zero when passed to GetNextEntry, it will be | 36 // entry->file_ref is non-zero when passed to GetNextEntry, it will be |
| 35 // released before the next file_ref is stored. | 37 // released before the next file_ref is stored. |
| 36 // | 38 // |
| 37 // EXAMPLE USAGE: | 39 // EXAMPLE USAGE: |
| 38 // | 40 // |
| 39 // PP_Resource reader = reader_funcs->Create(dir_ref); | 41 // PP_Resource reader = reader_funcs->Create(dir_ref); |
| 40 // PP_DirectoryEntry entry = {0}; | 42 // PP_DirectoryEntry entry = {0}; |
| 41 // while (reader_funcs->GetNextEntry(reader, &entry, | 43 // while (reader_funcs->GetNextEntry(reader, &entry, |
| 42 // PP_BlockUntilComplete()) == PP_OK) { | 44 // PP_BlockUntilComplete()) == PP_OK) { |
| 43 // ProcessDirectoryEntry(entry); | 45 // ProcessDirectoryEntry(entry); |
| 44 // } | 46 // } |
| 45 // core_funcs->ReleaseResource(reader); | 47 // core_funcs->ReleaseResource(reader); |
| 46 // | 48 // |
| 47 int32_t (*GetNextEntry)(PP_Resource directory_reader, | 49 int32_t (*GetNextEntry)(PP_Resource directory_reader, |
| 48 struct PP_DirectoryEntry_Dev* entry, | 50 struct PP_DirectoryEntry_Dev* entry, |
| 49 struct PP_CompletionCallback callback); | 51 struct PP_CompletionCallback callback); |
| 50 }; | 52 }; |
| 51 | 53 |
| 52 #endif // PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_ | 54 #endif // PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_ |
| OLD | NEW |