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_PPB_FILE_IO_TRUSTED_H_ |
| 6 #define PPAPI_C_PPB_FILE_IO_TRUSTED_H_ |
| 7 |
| 8 #include "ppapi/c/pp_resource.h" |
| 9 #include "ppapi/c/pp_stdint.h" |
| 10 |
| 11 struct PP_CompletionCallback; |
| 12 |
| 13 #define PPB_FILEIOTRUSTED_INTERFACE_0_3 "PPB_FileIOTrusted(Dev);0.3" |
| 14 #define PPB_FILEIOTRUSTED_INTERFACE PPB_FILEIOTRUSTED_INTERFACE_0_3 |
| 15 |
| 16 // Available only to trusted implementations. |
| 17 struct PPB_FileIOTrusted { |
| 18 // Returns a file descriptor corresponding to the given FileIO object. On |
| 19 // Windows, returns a HANDLE; on all other platforms, returns a POSIX file |
| 20 // descriptor. The FileIO object must have been opened with a successful |
| 21 // call to FileIO::Open. The file descriptor will be closed automatically |
| 22 // when the FileIO object is closed or destroyed. |
| 23 int32_t (*GetOSFileDescriptor)(PP_Resource file_io); |
| 24 |
| 25 // Notifies the browser that underlying file will be modified. This gives |
| 26 // the browser the opportunity to apply quota restrictions and possibly |
| 27 // return an error to indicate that the write is not allowed. |
| 28 int32_t (*WillWrite)(PP_Resource file_io, |
| 29 int64_t offset, |
| 30 int32_t bytes_to_write, |
| 31 struct PP_CompletionCallback callback); |
| 32 |
| 33 // Notifies the browser that underlying file will be modified. This gives |
| 34 // the browser the opportunity to apply quota restrictions and possibly |
| 35 // return an error to indicate that the write is not allowed. |
| 36 int32_t (*WillSetLength)(PP_Resource file_io, |
| 37 int64_t length, |
| 38 struct PP_CompletionCallback callback); |
| 39 |
| 40 // TODO(darin): Maybe unify the above into a single WillChangeFileSize |
| 41 // method? The above methods have the advantage of mapping to PPB_FileIO |
| 42 // Write and SetLength calls. WillChangeFileSize would require the caller to |
| 43 // compute the file size resulting from a Write call, which may be |
| 44 // undesirable. |
| 45 }; |
| 46 |
| 47 #endif /* PPAPI_C_PPB_FILE_IO_TRUSTED_H_ */ |
OLD | NEW |