| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 |
| 11 | 11 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 27 const char* name; | 27 const char* name; |
| 28 PP_Bool is_dir; | 28 PP_Bool is_dir; |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 struct PP_DirContents_Dev { | 31 struct PP_DirContents_Dev { |
| 32 int32_t count; | 32 int32_t count; |
| 33 struct PP_DirEntry_Dev* entries; | 33 struct PP_DirEntry_Dev* entries; |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 // PPB_Flash_File_ModuleLocal -------------------------------------------------- | 36 // PPB_Flash_File_ModuleLocal -------------------------------------------------- |
| 37 | 37 #define PPB_FLASH_FILE_MODULELOCAL_INTERFACE_2_0 "PPB_Flash_File_ModuleLocal;2" |
| 38 #define PPB_FLASH_FILE_MODULELOCAL_INTERFACE "PPB_Flash_File_ModuleLocal;2" | 38 #define PPB_FLASH_FILE_MODULELOCAL_INTERFACE_3_0 "PPB_Flash_File_ModuleLocal;3" |
| 39 #define PPB_FLASH_FILE_MODULELOCAL_INTERFACE \ |
| 40 PPB_FLASH_FILE_MODULELOCAL_INTERFACE_3_0 |
| 39 | 41 |
| 40 // This interface provides (for Flash) synchronous access to module-local files. | 42 // This interface provides (for Flash) synchronous access to module-local files. |
| 41 // Module-local file paths are '/'-separated UTF-8 strings, relative to a | 43 // Module-local file paths are '/'-separated UTF-8 strings, relative to a |
| 42 // module-specific root. | 44 // module-specific root. |
| 43 struct PPB_Flash_File_ModuleLocal { | 45 struct PPB_Flash_File_ModuleLocal_3_0 { |
| 44 // Does initialization necessary for proxying this interface on background | 46 // Does initialization necessary for proxying this interface on background |
| 45 // threads. You must always call this function before using any other | 47 // threads. You must always call this function before using any other |
| 46 // function in this interface for a given instance ID. | 48 // function in this interface for a given instance ID. |
| 47 // | 49 // |
| 48 // Returns true if multithreaded access is supported. In this case you can | 50 // Returns true if multithreaded access is supported. In this case you can |
| 49 // use the rest of the functions from background threads. You may not call | 51 // use the rest of the functions from background threads. You may not call |
| 50 // GetInterface or do any other PPAPI operations on background threads at | 52 // GetInterface or do any other PPAPI operations on background threads at |
| 51 // this time. | 53 // this time. |
| 52 bool (*CreateThreadAdapterForInstance)(PP_Instance instance); | 54 bool (*CreateThreadAdapterForInstance)(PP_Instance instance); |
| 53 | 55 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // Gets the list of files contained in a directory. The return value is the | 92 // Gets the list of files contained in a directory. The return value is the |
| 91 // ppapi error, PP_OK if success, one of the PP_ERROR_* in case of failure. If | 93 // ppapi error, PP_OK if success, one of the PP_ERROR_* in case of failure. If |
| 92 // non-NULL, the returned contents should be freed with FreeDirContents. | 94 // non-NULL, the returned contents should be freed with FreeDirContents. |
| 93 int32_t (*GetDirContents)(PP_Instance instance, | 95 int32_t (*GetDirContents)(PP_Instance instance, |
| 94 const char* path, | 96 const char* path, |
| 95 struct PP_DirContents_Dev** contents); | 97 struct PP_DirContents_Dev** contents); |
| 96 | 98 |
| 97 // Frees the data allocated by GetDirContents. | 99 // Frees the data allocated by GetDirContents. |
| 98 void (*FreeDirContents)(PP_Instance instance, | 100 void (*FreeDirContents)(PP_Instance instance, |
| 99 struct PP_DirContents_Dev* contents); | 101 struct PP_DirContents_Dev* contents); |
| 102 |
| 103 // Creates a temporary file. The file will be automatically deleted when all |
| 104 // handles to it are closed. |
| 105 // Returns PP_OK if successful, one of the PP_ERROR_* values in case of |
| 106 // failure. |
| 107 // |
| 108 // If successful, |file| is set to a file descriptor (posix) or a HANDLE |
| 109 // (win32) to the file. If failed, |file| is not touched. |
| 110 int32_t (*CreateTemporaryFile)(PP_Instance instance, PP_FileHandle* file); |
| 111 }; |
| 112 |
| 113 struct PPB_Flash_File_ModuleLocal_2_0 { |
| 114 bool (*CreateThreadAdapterForInstance)(PP_Instance instance); |
| 115 void (*ClearThreadAdapterForInstance)(PP_Instance instance); |
| 116 int32_t (*OpenFile)(PP_Instance instance, |
| 117 const char* path, |
| 118 int32_t mode, |
| 119 PP_FileHandle* file); |
| 120 int32_t (*RenameFile)(PP_Instance instance, |
| 121 const char* path_from, |
| 122 const char* path_to); |
| 123 int32_t (*DeleteFileOrDir)(PP_Instance instance, |
| 124 const char* path, |
| 125 PP_Bool recursive); |
| 126 int32_t (*CreateDir)(PP_Instance instance, const char* path); |
| 127 int32_t (*QueryFile)(PP_Instance instance, |
| 128 const char* path, |
| 129 struct PP_FileInfo* info); |
| 130 int32_t (*GetDirContents)(PP_Instance instance, |
| 131 const char* path, |
| 132 struct PP_DirContents_Dev** contents); |
| 133 void (*FreeDirContents)(PP_Instance instance, |
| 134 struct PP_DirContents_Dev* contents); |
| 100 }; | 135 }; |
| 101 | 136 |
| 137 typedef struct PPB_Flash_File_ModuleLocal_3_0 PPB_Flash_File_ModuleLocal; |
| 138 |
| 102 // PPB_Flash_File_FileRef ------------------------------------------------------ | 139 // PPB_Flash_File_FileRef ------------------------------------------------------ |
| 103 | 140 |
| 104 #define PPB_FLASH_FILE_FILEREF_INTERFACE "PPB_Flash_File_FileRef;2" | 141 #define PPB_FLASH_FILE_FILEREF_INTERFACE "PPB_Flash_File_FileRef;2" |
| 105 | 142 |
| 106 // This interface provides (for Flash) synchronous access to files whose paths | 143 // This interface provides (for Flash) synchronous access to files whose paths |
| 107 // are given by a Pepper FileRef. Such FileRefs are typically obtained via the | 144 // are given by a Pepper FileRef. Such FileRefs are typically obtained via the |
| 108 // Pepper file chooser. | 145 // Pepper file chooser. |
| 109 struct PPB_Flash_File_FileRef { | 146 struct PPB_Flash_File_FileRef { |
| 110 // The functions below correspond exactly to their module-local counterparts | 147 // The functions below correspond exactly to their module-local counterparts |
| 111 // (except in taking FileRefs instead of paths, of course). We omit the | 148 // (except in taking FileRefs instead of paths, of course). We omit the |
| 112 // functionality which we do not provide for FileRefs. | 149 // functionality which we do not provide for FileRefs. |
| 113 int32_t (*OpenFile)(PP_Resource file_ref_id, | 150 int32_t (*OpenFile)(PP_Resource file_ref_id, |
| 114 int32_t mode, | 151 int32_t mode, |
| 115 PP_FileHandle* file); | 152 PP_FileHandle* file); |
| 116 int32_t (*QueryFile)(PP_Resource file_ref_id, | 153 int32_t (*QueryFile)(PP_Resource file_ref_id, |
| 117 struct PP_FileInfo* info); | 154 struct PP_FileInfo* info); |
| 118 }; | 155 }; |
| 119 | 156 |
| 120 #endif // PPAPI_C_PRIVATE_PPB_FLASH_FILE_H_ | 157 #endif // PPAPI_C_PRIVATE_PPB_FLASH_FILE_H_ |
| OLD | NEW |