| 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_FILE_REF_DEV_H_ | 5 #ifndef PPAPI_C_DEV_PPB_FILE_REF_DEV_H_ |
| 6 #define PPAPI_C_DEV_PPB_FILE_REF_DEV_H_ | 6 #define PPAPI_C_DEV_PPB_FILE_REF_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_instance.h" | 10 #include "ppapi/c/pp_instance.h" |
| 10 #include "ppapi/c/pp_resource.h" | 11 #include "ppapi/c/pp_resource.h" |
| 11 #include "ppapi/c/pp_var.h" | 12 #include "ppapi/c/pp_var.h" |
| 12 | 13 |
| 13 #define PPB_FILEREF_DEV_INTERFACE "PPB_FileRef(Dev);0.2" | 14 #define PPB_FILEREF_DEV_INTERFACE "PPB_FileRef(Dev);0.3" |
| 14 | 15 |
| 15 // A FileRef is a "weak pointer" to a file in a file system. It contains a | 16 // A FileRef is a "weak pointer" to a file in a file system. It contains a |
| 16 // PP_FileSystemType identifier and a file path string. | 17 // PP_FileSystemType identifier and a file path string. |
| 17 struct PPB_FileRef_Dev { | 18 struct PPB_FileRef_Dev { |
| 18 // Creates a weak pointer to a file in the given filesystem. File paths are | 19 // Creates a weak pointer to a file in the given filesystem. File paths are |
| 19 // POSIX style. Returns 0 if the path is malformed. | 20 // POSIX style. Returns 0 if the path is malformed. |
| 20 PP_Resource (*Create)(PP_Resource file_system, const char* path); | 21 PP_Resource (*Create)(PP_Resource file_system, const char* path); |
| 21 | 22 |
| 22 // Returns true if the given resource is a FileRef. Returns false if the | 23 // Returns PP_TRUE if the given resource is a FileRef. Returns PP_FALSE if the |
| 23 // resource is invalid or some type other than a FileRef. | 24 // resource is invalid or some type other than a FileRef. |
| 24 bool (*IsFileRef)(PP_Resource resource); | 25 PP_Bool (*IsFileRef)(PP_Resource resource); |
| 25 | 26 |
| 26 // Returns the file system identifier of this file. | 27 // Returns the file system identifier of this file. |
| 27 PP_FileSystemType_Dev (*GetFileSystemType)(PP_Resource file_ref); | 28 PP_FileSystemType_Dev (*GetFileSystemType)(PP_Resource file_ref); |
| 28 | 29 |
| 29 // Returns the name of the file. | 30 // Returns the name of the file. |
| 30 struct PP_Var (*GetName)(PP_Resource file_ref); | 31 struct PP_Var (*GetName)(PP_Resource file_ref); |
| 31 | 32 |
| 32 // Returns the absolute path of the file. This method fails if the file | 33 // Returns the absolute path of the file. This method fails if the file |
| 33 // system type is PP_FileSystemType_External. | 34 // system type is PP_FileSystemType_External. |
| 34 struct PP_Var (*GetPath)(PP_Resource file_ref); | 35 struct PP_Var (*GetPath)(PP_Resource file_ref); |
| 35 | 36 |
| 36 // Returns the parent directory of this file. If file_ref points to the root | 37 // Returns the parent directory of this file. If file_ref points to the root |
| 37 // of the filesystem, then the root is returned. This method fails if the | 38 // of the filesystem, then the root is returned. This method fails if the |
| 38 // file system type is PP_FileSystemType_External. | 39 // file system type is PP_FileSystemType_External. |
| 39 PP_Resource (*GetParent)(PP_Resource file_ref); | 40 PP_Resource (*GetParent)(PP_Resource file_ref); |
| 40 | 41 |
| 41 // Makes a new directory in the filesystem as well as any parent directories | 42 // Makes a new directory in the filesystem as well as any parent directories |
| 42 // if the make_ancestors parameter is true. It is not valid to make a | 43 // if the make_ancestors parameter is PP_TRUE. It is not valid to make a |
| 43 // directory in the external filesystem. Fails if the directory already | 44 // directory in the external filesystem. Fails if the directory already |
| 44 // exists or if ancestor directories do not exist and make_ancestors was not | 45 // exists or if ancestor directories do not exist and make_ancestors was not |
| 45 // passed as true. | 46 // passed as PP_TRUE. |
| 46 int32_t (*MakeDirectory)(PP_Resource directory_ref, | 47 int32_t (*MakeDirectory)(PP_Resource directory_ref, |
| 47 bool make_ancestors, | 48 PP_Bool make_ancestors, |
| 48 struct PP_CompletionCallback callback); | 49 struct PP_CompletionCallback callback); |
| 49 | 50 |
| 50 // Queries info about the file. You must have read access to this file if it | 51 // Queries info about the file. You must have read access to this file if it |
| 51 // exists in the external filesystem. | 52 // exists in the external filesystem. |
| 52 int32_t (*Query)(PP_Resource file_ref, | 53 int32_t (*Query)(PP_Resource file_ref, |
| 53 struct PP_FileInfo_Dev* info, | 54 struct PP_FileInfo_Dev* info, |
| 54 struct PP_CompletionCallback callback); | 55 struct PP_CompletionCallback callback); |
| 55 | 56 |
| 56 // Updates timestamps for a file. You must have write access to the file if | 57 // Updates timestamps for a file. You must have write access to the file if |
| 57 // it exists in the external filesystem. | 58 // it exists in the external filesystem. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 79 #if 0 | 80 #if 0 |
| 80 // Convert a DOM File object to a FileRef object. | 81 // Convert a DOM File object to a FileRef object. |
| 81 PP_Resource (*FromFileObject)(PP_Var file_object); | 82 PP_Resource (*FromFileObject)(PP_Var file_object); |
| 82 | 83 |
| 83 // Convert a FileRef object to a DOM File object. | 84 // Convert a FileRef object to a DOM File object. |
| 84 PP_Var (*ToFileObject)(PP_Resource file_ref); | 85 PP_Var (*ToFileObject)(PP_Resource file_ref); |
| 85 #endif | 86 #endif |
| 86 }; | 87 }; |
| 87 | 88 |
| 88 #endif // PPAPI_C_DEV_PPB_FILE_REF_DEV_H_ | 89 #endif // PPAPI_C_DEV_PPB_FILE_REF_DEV_H_ |
| OLD | NEW |