From d4edb10981caaa389d94036be4f522925ea3d159 Mon Sep 17 00:00:00 2001 From: "teravest@chromium.org" Date: Tue, 2 Apr 2013 09:10:41 +0000 Subject: Add Query() support to FileRef. This change brings Query() support back to FileRef for in-process and out-of-process plugins. I've added testing for a file that exists and one that doesn't. BUG=170721 Review URL: https://chromiumcodereview.appspot.com/12817009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191805 0039d316-1c4b-4281-b951-d872f2087c98 --- ppapi/c/ppb_file_ref.h | 46 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) (limited to 'ppapi/c') diff --git a/ppapi/c/ppb_file_ref.h b/ppapi/c/ppb_file_ref.h index d359a7b..910fd80 100644 --- a/ppapi/c/ppb_file_ref.h +++ b/ppapi/c/ppb_file_ref.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From ppb_file_ref.idl modified Wed Oct 5 14:06:02 2011. */ +/* From ppb_file_ref.idl modified Thu Mar 7 12:02:53 2013. */ #ifndef PPAPI_C_PPB_FILE_REF_H_ #define PPAPI_C_PPB_FILE_REF_H_ @@ -18,7 +18,8 @@ #include "ppapi/c/pp_var.h" #define PPB_FILEREF_INTERFACE_1_0 "PPB_FileRef;1.0" -#define PPB_FILEREF_INTERFACE PPB_FILEREF_INTERFACE_1_0 +#define PPB_FILEREF_INTERFACE_1_1 "PPB_FileRef;1.1" +#define PPB_FILEREF_INTERFACE PPB_FILEREF_INTERFACE_1_1 /** * @file @@ -36,7 +37,7 @@ * a file system. This struct contains a PP_FileSystemType * identifier and a file path string. */ -struct PPB_FileRef_1_0 { +struct PPB_FileRef_1_1 { /** * Create() creates a weak pointer to a file in the given file system. File * paths are POSIX style. @@ -177,9 +178,46 @@ struct PPB_FileRef_1_0 { int32_t (*Rename)(PP_Resource file_ref, PP_Resource new_file_ref, struct PP_CompletionCallback callback); + /* + * Query() queries info about a file or directory. You must have access to + * read this file or directory if it exists in the external filesystem. + * + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * @param[out] info A pointer to a PP_FileInfo which will be + * populated with information about the file or directory. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Query(). + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*Query)(PP_Resource file_ref, + struct PP_FileInfo* info, + struct PP_CompletionCallback callback); }; -typedef struct PPB_FileRef_1_0 PPB_FileRef; +typedef struct PPB_FileRef_1_1 PPB_FileRef; + +struct PPB_FileRef_1_0 { + PP_Resource (*Create)(PP_Resource file_system, const char* path); + PP_Bool (*IsFileRef)(PP_Resource resource); + PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref); + struct PP_Var (*GetName)(PP_Resource file_ref); + struct PP_Var (*GetPath)(PP_Resource file_ref); + PP_Resource (*GetParent)(PP_Resource file_ref); + int32_t (*MakeDirectory)(PP_Resource directory_ref, + PP_Bool make_ancestors, + struct PP_CompletionCallback callback); + int32_t (*Touch)(PP_Resource file_ref, + PP_Time last_access_time, + PP_Time last_modified_time, + struct PP_CompletionCallback callback); + int32_t (*Delete)(PP_Resource file_ref, + struct PP_CompletionCallback callback); + int32_t (*Rename)(PP_Resource file_ref, + PP_Resource new_file_ref, + struct PP_CompletionCallback callback); +}; /** * @} */ -- cgit v1.1