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
3 // found in the LICENSE file.
5 #ifndef PPAPI_C_PRIVATE_PPB_FLASH_FILE_H_
6 #define PPAPI_C_PRIVATE_PPB_FLASH_FILE_H_
8 #include "ppapi/c/pp_bool.h"
9 #include "ppapi/c/pp_instance.h"
10 #include "ppapi/c/pp_resource.h"
11 #include "ppapi/c/private/pp_file_handle.h"
15 struct PP_DirEntry_Dev
{
20 struct PP_DirContents_Dev
{
22 struct PP_DirEntry_Dev
* entries
;
25 // PPB_Flash_File_ModuleLocal --------------------------------------------------
26 #define PPB_FLASH_FILE_MODULELOCAL_INTERFACE_3_0 "PPB_Flash_File_ModuleLocal;3"
27 #define PPB_FLASH_FILE_MODULELOCAL_INTERFACE \
28 PPB_FLASH_FILE_MODULELOCAL_INTERFACE_3_0
30 // This interface provides (for Flash) synchronous access to module-local files.
31 // Module-local file paths are '/'-separated UTF-8 strings, relative to a
32 // module-specific root.
33 struct PPB_Flash_File_ModuleLocal_3_0
{
34 // Deprecated. Returns true.
35 bool (*CreateThreadAdapterForInstance
)(PP_Instance instance
);
36 // Deprecated. Does nothing.
37 void (*ClearThreadAdapterForInstance
)(PP_Instance instance
);
39 // Opens a file, returning a file descriptor (posix) or a HANDLE (win32) into
40 // file. The return value is the ppapi error, PP_OK if success, one of the
41 // PP_ERROR_* in case of failure.
42 int32_t (*OpenFile
)(PP_Instance instance
,
47 // Renames a file. The return value is the ppapi error, PP_OK if success, one
48 // of the PP_ERROR_* in case of failure.
49 int32_t (*RenameFile
)(PP_Instance instance
,
50 const char* path_from
,
53 // Deletes a file or directory. If recursive is set and the path points to a
54 // directory, deletes all the contents of the directory. The return value is
55 // the ppapi error, PP_OK if success, one of the PP_ERROR_* in case of
57 int32_t (*DeleteFileOrDir
)(PP_Instance instance
,
61 // Creates a directory. The return value is the ppapi error, PP_OK if success,
62 // one of the PP_ERROR_* in case of failure.
63 int32_t (*CreateDir
)(PP_Instance instance
, const char* path
);
65 // Queries information about a file. The return value is the ppapi error,
66 // PP_OK if success, one of the PP_ERROR_* in case of failure.
67 int32_t (*QueryFile
)(PP_Instance instance
,
69 struct PP_FileInfo
* info
);
71 // Gets the list of files contained in a directory. The return value is the
72 // ppapi error, PP_OK if success, one of the PP_ERROR_* in case of failure. If
73 // non-NULL, the returned contents should be freed with FreeDirContents.
74 int32_t (*GetDirContents
)(PP_Instance instance
,
76 struct PP_DirContents_Dev
** contents
);
78 // Frees the data allocated by GetDirContents.
79 void (*FreeDirContents
)(PP_Instance instance
,
80 struct PP_DirContents_Dev
* contents
);
82 // Creates a temporary file. The file will be automatically deleted when all
83 // handles to it are closed.
84 // Returns PP_OK if successful, one of the PP_ERROR_* values in case of
87 // If successful, |file| is set to a file descriptor (posix) or a HANDLE
88 // (win32) to the file. If failed, |file| is not touched.
89 int32_t (*CreateTemporaryFile
)(PP_Instance instance
, PP_FileHandle
* file
);
92 typedef struct PPB_Flash_File_ModuleLocal_3_0 PPB_Flash_File_ModuleLocal
;
94 // PPB_Flash_File_FileRef ------------------------------------------------------
96 #define PPB_FLASH_FILE_FILEREF_INTERFACE "PPB_Flash_File_FileRef;2"
98 // This interface provides (for Flash) synchronous access to files whose paths
99 // are given by a Pepper FileRef. Such FileRefs are typically obtained via the
100 // Pepper file chooser.
101 struct PPB_Flash_File_FileRef
{
102 // The functions below correspond exactly to their module-local counterparts
103 // (except in taking FileRefs instead of paths, of course). We omit the
104 // functionality which we do not provide for FileRefs.
105 int32_t (*OpenFile
)(PP_Resource file_ref_id
,
107 PP_FileHandle
* file
);
108 int32_t (*QueryFile
)(PP_Resource file_ref_id
,
109 struct PP_FileInfo
* info
);
112 #endif // PPAPI_C_PRIVATE_PPB_FLASH_FILE_H_