Chromium Code Reviews| 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 16 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 in the directory specified by |dir_path|. The file | |
| 104 // will be automatically deleted when all 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; |file_name_buffer| is set to the resulting file name | |
| 110 // (NULL-terminated). If failed, neither |file| nor |file_name_buffer| is | |
| 111 // touched. | |
| 112 // If |file_name_buffer| is too small to store the resulting file name plus | |
| 113 // the trailing NULL, the method fails and returns PP_ERROR_NOMEMORY. | |
| 114 int32_t (*CreateTemporaryFile)(PP_Instance instance, | |
|
viettrungluu
2012/06/07 20:17:36
Why don't we just add this to OpenFile()'s functio
yzshen1
2012/06/07 21:42:06
I considered adding this to OpenFile(), but I didn
| |
| 115 const char* dir_path, | |
| 116 PP_FileHandle* file, | |
| 117 char* file_name_buffer, | |
| 118 uint32_t file_name_buffer_size); | |
| 119 }; | |
| 120 | |
| 121 struct PPB_Flash_File_ModuleLocal_2_0 { | |
| 122 bool (*CreateThreadAdapterForInstance)(PP_Instance instance); | |
| 123 void (*ClearThreadAdapterForInstance)(PP_Instance instance); | |
| 124 int32_t (*OpenFile)(PP_Instance instance, | |
| 125 const char* path, | |
| 126 int32_t mode, | |
| 127 PP_FileHandle* file); | |
| 128 int32_t (*RenameFile)(PP_Instance instance, | |
| 129 const char* path_from, | |
| 130 const char* path_to); | |
| 131 int32_t (*DeleteFileOrDir)(PP_Instance instance, | |
| 132 const char* path, | |
| 133 PP_Bool recursive); | |
| 134 int32_t (*CreateDir)(PP_Instance instance, const char* path); | |
| 135 int32_t (*QueryFile)(PP_Instance instance, | |
| 136 const char* path, | |
| 137 struct PP_FileInfo* info); | |
| 138 int32_t (*GetDirContents)(PP_Instance instance, | |
| 139 const char* path, | |
| 140 struct PP_DirContents_Dev** contents); | |
| 141 void (*FreeDirContents)(PP_Instance instance, | |
| 142 struct PP_DirContents_Dev* contents); | |
| 100 }; | 143 }; |
| 101 | 144 |
| 145 typedef struct PPB_Flash_File_ModuleLocal_3_0 PPB_Flash_File_ModuleLocal; | |
| 146 | |
| 102 // PPB_Flash_File_FileRef ------------------------------------------------------ | 147 // PPB_Flash_File_FileRef ------------------------------------------------------ |
| 103 | 148 |
| 104 #define PPB_FLASH_FILE_FILEREF_INTERFACE "PPB_Flash_File_FileRef;2" | 149 #define PPB_FLASH_FILE_FILEREF_INTERFACE "PPB_Flash_File_FileRef;2" |
| 105 | 150 |
| 106 // This interface provides (for Flash) synchronous access to files whose paths | 151 // 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 | 152 // are given by a Pepper FileRef. Such FileRefs are typically obtained via the |
| 108 // Pepper file chooser. | 153 // Pepper file chooser. |
| 109 struct PPB_Flash_File_FileRef { | 154 struct PPB_Flash_File_FileRef { |
| 110 // The functions below correspond exactly to their module-local counterparts | 155 // The functions below correspond exactly to their module-local counterparts |
| 111 // (except in taking FileRefs instead of paths, of course). We omit the | 156 // (except in taking FileRefs instead of paths, of course). We omit the |
| 112 // functionality which we do not provide for FileRefs. | 157 // functionality which we do not provide for FileRefs. |
| 113 int32_t (*OpenFile)(PP_Resource file_ref_id, | 158 int32_t (*OpenFile)(PP_Resource file_ref_id, |
| 114 int32_t mode, | 159 int32_t mode, |
| 115 PP_FileHandle* file); | 160 PP_FileHandle* file); |
| 116 int32_t (*QueryFile)(PP_Resource file_ref_id, | 161 int32_t (*QueryFile)(PP_Resource file_ref_id, |
| 117 struct PP_FileInfo* info); | 162 struct PP_FileInfo* info); |
| 118 }; | 163 }; |
| 119 | 164 |
| 120 #endif // PPAPI_C_PRIVATE_PPB_FLASH_FILE_H_ | 165 #endif // PPAPI_C_PRIVATE_PPB_FLASH_FILE_H_ |
| OLD | NEW |