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
3 * found in the LICENSE file.
6 /* From trusted/ppb_file_io_trusted.idl modified Wed Mar 27 14:50:12 2013. */
8 #ifndef PPAPI_C_TRUSTED_PPB_FILE_IO_TRUSTED_H_
9 #define PPAPI_C_TRUSTED_PPB_FILE_IO_TRUSTED_H_
11 #include "ppapi/c/pp_completion_callback.h"
12 #include "ppapi/c/pp_macros.h"
13 #include "ppapi/c/pp_resource.h"
14 #include "ppapi/c/pp_stdint.h"
16 #define PPB_FILEIOTRUSTED_INTERFACE_0_4 "PPB_FileIOTrusted;0.4"
17 #define PPB_FILEIOTRUSTED_INTERFACE PPB_FILEIOTRUSTED_INTERFACE_0_4
22 * This file defines the trusted file IO interface
27 * @addtogroup Interfaces
30 /* Available only to trusted implementations. */
31 struct PPB_FileIOTrusted_0_4
{
33 * Returns a file descriptor corresponding to the given FileIO object. On
34 * Windows, returns a HANDLE; on all other platforms, returns a POSIX file
35 * descriptor. The FileIO object must have been opened with a successful
36 * call to FileIO::Open. The file descriptor will be closed automatically
37 * when the FileIO object is closed or destroyed.
39 * TODO(hamaji): Remove this and use RequestOSFileHandle instead.
41 int32_t (*GetOSFileDescriptor
)(PP_Resource file_io
);
43 * Notifies the browser that underlying file will be modified. This gives
44 * the browser the opportunity to apply quota restrictions and possibly
45 * return an error to indicate that the write is not allowed.
47 int32_t (*WillWrite
)(PP_Resource file_io
,
49 int32_t bytes_to_write
,
50 struct PP_CompletionCallback callback
);
52 * Notifies the browser that underlying file will be modified. This gives
53 * the browser the opportunity to apply quota restrictions and possibly
54 * return an error to indicate that the write is not allowed.
56 * TODO(darin): Maybe unify the above into a single WillChangeFileSize
57 * method? The above methods have the advantage of mapping to PPB_FileIO
58 * Write and SetLength calls. WillChangeFileSize would require the caller to
59 * compute the file size resulting from a Write call, which may be
62 int32_t (*WillSetLength
)(PP_Resource file_io
,
64 struct PP_CompletionCallback callback
);
67 typedef struct PPB_FileIOTrusted_0_4 PPB_FileIOTrusted
;
72 #endif /* PPAPI_C_TRUSTED_PPB_FILE_IO_TRUSTED_H_ */