summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-01 22:28:01 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-01 22:28:01 +0000
commitce8096fb4b6d739d8ddf63b3841392d1bb7ef447 (patch)
treec5a223eee8ced80c0fc78f873fd3d9b5f0b47699 /ppapi
parent8f11d754152acfba2086a61b05c66c4f7019eacf (diff)
downloadchromium_src-ce8096fb4b6d739d8ddf63b3841392d1bb7ef447.zip
chromium_src-ce8096fb4b6d739d8ddf63b3841392d1bb7ef447.tar.gz
chromium_src-ce8096fb4b6d739d8ddf63b3841392d1bb7ef447.tar.bz2
Pepper/Flapper: Add an interface to do sync file ops on FileRefs.
Such FileRefs are typically obtained from the Pepper file chooser. The interface corresponds exactly to the one for module-local files. (The implementation is only enabled if Flapper hacks are enabled.) BUG=none TEST=Flapper file uploads work for me Review URL: http://codereview.chromium.org/6592071 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76446 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/c/private/ppb_flash_file.h64
1 files changed, 45 insertions, 19 deletions
diff --git a/ppapi/c/private/ppb_flash_file.h b/ppapi/c/private/ppb_flash_file.h
index 8e1f291..9e2def9 100644
--- a/ppapi/c/private/ppb_flash_file.h
+++ b/ppapi/c/private/ppb_flash_file.h
@@ -38,45 +38,45 @@ struct PP_DirContents_Dev {
#define PPB_FLASH_FILE_MODULELOCAL_INTERFACE "PPB_Flash_File_ModuleLocal;1"
+// This interface provides (for Flash) synchronous access to module-local files.
+// Module-local file paths are '/'-separated UTF-8 strings, relative to a
+// module-specific root.
struct PPB_Flash_File_ModuleLocal {
- // Opens a module-local file, returning a file descriptor (posix) or a HANDLE
- // (win32) into file. Module-local file paths (here and below) are
- // '/'-separated UTF-8 strings, relative to a module-specific root. The return
- // value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in case
- // of failure.
+ // Opens a file, returning a file descriptor (posix) or a HANDLE (win32) into
+ // file. The return value is the ppapi error, PP_OK if success, one of the
+ // PP_ERROR_* in case of failure.
int32_t (*OpenFile)(PP_Instance instance,
const char* path,
int32_t mode,
PP_FileHandle* file);
- // Renames a module-local file. The return value is the ppapi error, PP_OK if
- // success, one of the PP_ERROR_* in case of failure.
+ // Renames a file. The return value is the ppapi error, PP_OK if success, one
+ // of the PP_ERROR_* in case of failure.
int32_t (*RenameFile)(PP_Instance instance,
const char* path_from,
const char* path_to);
- // Deletes a module-local file or directory. If recursive is set and the path
- // points to a directory, deletes all the contents of the directory. The
- // return value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in
- // case of failure.
+ // Deletes a file or directory. If recursive is set and the path points to a
+ // directory, deletes all the contents of the directory. The return value is
+ // the ppapi error, PP_OK if success, one of the PP_ERROR_* in case of
+ // failure.
int32_t (*DeleteFileOrDir)(PP_Instance instance,
const char* path,
PP_Bool recursive);
- // Creates a module-local directory. The return value is the ppapi error,
- // PP_OK if success, one of the PP_ERROR_* in case of failure.
+ // Creates a directory. The return value is the ppapi error, PP_OK if success,
+ // one of the PP_ERROR_* in case of failure.
int32_t (*CreateDir)(PP_Instance instance, const char* path);
- // Queries information about a module-local file. The return value is the
- // ppapi error, PP_OK if success, one of the PP_ERROR_* in case of failure.
+ // Queries information about a file. The return value is the ppapi error,
+ // PP_OK if success, one of the PP_ERROR_* in case of failure.
int32_t (*QueryFile)(PP_Instance instance,
const char* path,
struct PP_FileInfo_Dev* info);
- // Gets the list of files contained in a module-local directory. The return
- // value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in case
- // of failure. If non-NULL, the returned contents should be freed with
- // FreeDirContents.
+ // Gets the list of files contained in a directory. The return value is the
+ // ppapi error, PP_OK if success, one of the PP_ERROR_* in case of failure. If
+ // non-NULL, the returned contents should be freed with FreeDirContents.
int32_t (*GetDirContents)(PP_Instance instance,
const char* path,
struct PP_DirContents_Dev** contents);
@@ -86,4 +86,30 @@ struct PPB_Flash_File_ModuleLocal {
struct PP_DirContents_Dev* contents);
};
+// PPB_Flash_File_FileRef ------------------------------------------------------
+
+#define PPB_FLASH_FILE_FILEREF_INTERFACE "PPB_Flash_File_FileRef;1"
+
+// This interface provides (for Flash) synchronous access to files whose paths
+// are given by a Pepper FileRef. Such FileRefs are typically obtained via the
+// Pepper file chooser.
+struct PPB_Flash_File_FileRef {
+ // The functions below correspond exactly to the ones in the module-local file
+ // interface (except in taking FileRefs instead of paths, of course).
+ int32_t (*OpenFile)(PP_Resource file_ref_id,
+ int32_t mode,
+ PP_FileHandle* file);
+ int32_t (*RenameFile)(PP_Resource from_file_ref_id,
+ PP_Resource to_file_ref_id);
+ int32_t (*DeleteFileOrDir)(PP_Resource file_ref_id,
+ PP_Bool recursive);
+ int32_t (*CreateDir)(PP_Resource file_ref_id);
+ int32_t (*QueryFile)(PP_Resource file_ref_id,
+ struct PP_FileInfo_Dev* info);
+ int32_t (*GetDirContents)(PP_Resource file_ref_id,
+ struct PP_DirContents_Dev** contents);
+ void (*FreeDirContents)(PP_Instance instance,
+ struct PP_DirContents_Dev* contents);
+};
+
#endif // PPAPI_C_PRIVATE_PPB_FLASH_FILE_H_