OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PRIVATE_PPB_FLASH_FILE_H_ | 5 #ifndef PPAPI_C_PRIVATE_PPB_FLASH_FILE_H_ |
6 #define PPAPI_C_PRIVATE_PPB_FLASH_FILE_H_ | 6 #define PPAPI_C_PRIVATE_PPB_FLASH_FILE_H_ |
7 | 7 |
8 #ifdef _WIN32 | 8 #ifdef _WIN32 |
9 #include <windows.h> | 9 #include <windows.h> |
10 #endif | 10 #endif |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 struct PP_DirContents_Dev { | 32 struct PP_DirContents_Dev { |
33 int32_t count; | 33 int32_t count; |
34 struct PP_DirEntry_Dev* entries; | 34 struct PP_DirEntry_Dev* entries; |
35 }; | 35 }; |
36 | 36 |
37 // PPB_Flash_File_ModuleLocal -------------------------------------------------- | 37 // PPB_Flash_File_ModuleLocal -------------------------------------------------- |
38 | 38 |
39 #define PPB_FLASH_FILE_MODULELOCAL_INTERFACE "PPB_Flash_File_ModuleLocal;1" | 39 #define PPB_FLASH_FILE_MODULELOCAL_INTERFACE "PPB_Flash_File_ModuleLocal;1" |
40 | 40 |
| 41 // This interface provides (for Flash) synchronous access to module-local files. |
| 42 // Module-local file paths are '/'-separated UTF-8 strings, relative to a |
| 43 // module-specific root. |
41 struct PPB_Flash_File_ModuleLocal { | 44 struct PPB_Flash_File_ModuleLocal { |
42 // Opens a module-local file, returning a file descriptor (posix) or a HANDLE | 45 // Opens a file, returning a file descriptor (posix) or a HANDLE (win32) into |
43 // (win32) into file. Module-local file paths (here and below) are | 46 // file. The return value is the ppapi error, PP_OK if success, one of the |
44 // '/'-separated UTF-8 strings, relative to a module-specific root. The return | 47 // PP_ERROR_* in case of failure. |
45 // value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in case | |
46 // of failure. | |
47 int32_t (*OpenFile)(PP_Instance instance, | 48 int32_t (*OpenFile)(PP_Instance instance, |
48 const char* path, | 49 const char* path, |
49 int32_t mode, | 50 int32_t mode, |
50 PP_FileHandle* file); | 51 PP_FileHandle* file); |
51 | 52 |
52 // Renames a module-local file. The return value is the ppapi error, PP_OK if | 53 // Renames a file. The return value is the ppapi error, PP_OK if success, one |
53 // success, one of the PP_ERROR_* in case of failure. | 54 // of the PP_ERROR_* in case of failure. |
54 int32_t (*RenameFile)(PP_Instance instance, | 55 int32_t (*RenameFile)(PP_Instance instance, |
55 const char* path_from, | 56 const char* path_from, |
56 const char* path_to); | 57 const char* path_to); |
57 | 58 |
58 // Deletes a module-local file or directory. If recursive is set and the path | 59 // Deletes a file or directory. If recursive is set and the path points to a |
59 // points to a directory, deletes all the contents of the directory. The | 60 // directory, deletes all the contents of the directory. The return value is |
60 // return value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in | 61 // the ppapi error, PP_OK if success, one of the PP_ERROR_* in case of |
61 // case of failure. | 62 // failure. |
62 int32_t (*DeleteFileOrDir)(PP_Instance instance, | 63 int32_t (*DeleteFileOrDir)(PP_Instance instance, |
63 const char* path, | 64 const char* path, |
64 PP_Bool recursive); | 65 PP_Bool recursive); |
65 | 66 |
66 // Creates a module-local directory. The return value is the ppapi error, | 67 // Creates a directory. The return value is the ppapi error, PP_OK if success, |
67 // PP_OK if success, one of the PP_ERROR_* in case of failure. | 68 // one of the PP_ERROR_* in case of failure. |
68 int32_t (*CreateDir)(PP_Instance instance, const char* path); | 69 int32_t (*CreateDir)(PP_Instance instance, const char* path); |
69 | 70 |
70 // Queries information about a module-local file. The return value is the | 71 // Queries information about a file. The return value is the ppapi error, |
71 // ppapi error, PP_OK if success, one of the PP_ERROR_* in case of failure. | 72 // PP_OK if success, one of the PP_ERROR_* in case of failure. |
72 int32_t (*QueryFile)(PP_Instance instance, | 73 int32_t (*QueryFile)(PP_Instance instance, |
73 const char* path, | 74 const char* path, |
74 struct PP_FileInfo_Dev* info); | 75 struct PP_FileInfo_Dev* info); |
75 | 76 |
76 // Gets the list of files contained in a module-local directory. The return | 77 // Gets the list of files contained in a directory. The return value is the |
77 // value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in case | 78 // ppapi error, PP_OK if success, one of the PP_ERROR_* in case of failure. If |
78 // of failure. If non-NULL, the returned contents should be freed with | 79 // non-NULL, the returned contents should be freed with FreeDirContents. |
79 // FreeDirContents. | |
80 int32_t (*GetDirContents)(PP_Instance instance, | 80 int32_t (*GetDirContents)(PP_Instance instance, |
81 const char* path, | 81 const char* path, |
82 struct PP_DirContents_Dev** contents); | 82 struct PP_DirContents_Dev** contents); |
83 | 83 |
84 // Frees the data allocated by GetDirContents. | 84 // Frees the data allocated by GetDirContents. |
85 void (*FreeDirContents)(PP_Instance instance, | 85 void (*FreeDirContents)(PP_Instance instance, |
86 struct PP_DirContents_Dev* contents); | 86 struct PP_DirContents_Dev* contents); |
87 }; | 87 }; |
88 | 88 |
| 89 // PPB_Flash_File_FileRef ------------------------------------------------------ |
| 90 |
| 91 #define PPB_FLASH_FILE_FILEREF_INTERFACE "PPB_Flash_File_FileRef;1" |
| 92 |
| 93 // This interface provides (for Flash) synchronous access to files whose paths |
| 94 // are given by a Pepper FileRef. Such FileRefs are typically obtained via the |
| 95 // Pepper file chooser. |
| 96 struct PPB_Flash_File_FileRef { |
| 97 // The functions below correspond exactly to the ones in the module-local file |
| 98 // interface (except in taking FileRefs instead of paths, of course). |
| 99 int32_t (*OpenFile)(PP_Resource file_ref_id, |
| 100 int32_t mode, |
| 101 PP_FileHandle* file); |
| 102 int32_t (*RenameFile)(PP_Resource from_file_ref_id, |
| 103 PP_Resource to_file_ref_id); |
| 104 int32_t (*DeleteFileOrDir)(PP_Resource file_ref_id, |
| 105 PP_Bool recursive); |
| 106 int32_t (*CreateDir)(PP_Resource file_ref_id); |
| 107 int32_t (*QueryFile)(PP_Resource file_ref_id, |
| 108 struct PP_FileInfo_Dev* info); |
| 109 int32_t (*GetDirContents)(PP_Resource file_ref_id, |
| 110 struct PP_DirContents_Dev** contents); |
| 111 void (*FreeDirContents)(PP_Instance instance, |
| 112 struct PP_DirContents_Dev* contents); |
| 113 }; |
| 114 |
89 #endif // PPAPI_C_PRIVATE_PPB_FLASH_FILE_H_ | 115 #endif // PPAPI_C_PRIVATE_PPB_FLASH_FILE_H_ |
OLD | NEW |