OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef PPAPI_C_PRIVATE_PPB_FLASH_FILE_H_ |
| 6 #define PPAPI_C_PRIVATE_PPB_FLASH_FILE_H_ |
| 7 |
| 8 #ifdef _WIN32 |
| 9 #include <windows.h> |
| 10 #endif |
| 11 |
| 12 #include "ppapi/c/pp_bool.h" |
| 13 #include "ppapi/c/pp_instance.h" |
| 14 |
| 15 #ifdef _WIN32 |
| 16 typedef HANDLE PP_FileHandle; |
| 17 static const PP_FileHandle PP_kInvalidFileHandle = NULL; |
| 18 #else |
| 19 typedef int PP_FileHandle; |
| 20 static const PP_FileHandle PP_kInvalidFileHandle = -1; |
| 21 #endif |
| 22 |
| 23 struct PP_CompletionCallback; |
| 24 struct PP_FontDescription_Dev; |
| 25 struct PP_FileInfo_Dev; |
| 26 |
| 27 struct PP_DirEntry_Dev { |
| 28 const char* name; |
| 29 PP_Bool is_dir; |
| 30 }; |
| 31 |
| 32 struct PP_DirContents_Dev { |
| 33 int32_t count; |
| 34 struct PP_DirEntry_Dev* entries; |
| 35 }; |
| 36 |
| 37 // PPB_Flash_File_ModuleLocal -------------------------------------------------- |
| 38 |
| 39 #define PPB_FLASH_FILE_MODULELOCAL_INTERFACE "PPB_Flash_File_ModuleLocal;1" |
| 40 |
| 41 struct PPB_Flash_File_ModuleLocal { |
| 42 // Opens a module-local file, returning a file descriptor (posix) or a HANDLE |
| 43 // (win32) into file. Module-local file paths (here and below) are |
| 44 // '/'-separated UTF-8 strings, relative to a module-specific root. The return |
| 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 const char* path, |
| 49 int32_t mode, |
| 50 PP_FileHandle* file); |
| 51 |
| 52 // Renames a module-local file. The return value is the ppapi error, PP_OK if |
| 53 // success, one of the PP_ERROR_* in case of failure. |
| 54 int32_t (*RenameFile)(PP_Instance instance, |
| 55 const char* path_from, |
| 56 const char* path_to); |
| 57 |
| 58 // Deletes a module-local file or directory. If recursive is set and the path |
| 59 // points to a directory, deletes all the contents of the directory. The |
| 60 // return value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in |
| 61 // case of failure. |
| 62 int32_t (*DeleteFileOrDir)(PP_Instance instance, |
| 63 const char* path, |
| 64 PP_Bool recursive); |
| 65 |
| 66 // Creates a module-local directory. The return value is the ppapi error, |
| 67 // PP_OK if success, one of the PP_ERROR_* in case of failure. |
| 68 int32_t (*CreateDir)(PP_Instance instance, const char* path); |
| 69 |
| 70 // Queries information about a module-local file. The return value is the |
| 71 // ppapi error, PP_OK if success, one of the PP_ERROR_* in case of failure. |
| 72 int32_t (*QueryFile)(PP_Instance instance, |
| 73 const char* path, |
| 74 struct PP_FileInfo_Dev* info); |
| 75 |
| 76 // Gets the list of files contained in a module-local directory. The return |
| 77 // value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in case |
| 78 // of failure. If non-NULL, the returned contents should be freed with |
| 79 // FreeDirContents. |
| 80 int32_t (*GetDirContents)(PP_Instance instance, |
| 81 const char* path, |
| 82 struct PP_DirContents_Dev** contents); |
| 83 |
| 84 // Frees the data allocated by GetDirContents. |
| 85 void (*FreeDirContents)(PP_Instance instance, |
| 86 struct PP_DirContents_Dev* contents); |
| 87 }; |
| 88 |
| 89 #endif // PPAPI_C_PRIVATE_PPB_FLASH_FILE_H_ |
OLD | NEW |