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.
5 #ifndef PPAPI_THUNK_PPB_FILE_IO_API_H_
6 #define PPAPI_THUNK_PPB_FILE_IO_API_H_
8 #include "base/memory/ref_counted.h"
9 #include "ppapi/c/ppb_file_io.h"
10 #include "ppapi/c/private/pp_file_handle.h"
11 #include "ppapi/thunk/ppapi_thunk_export.h"
15 class TrackedCallback
;
19 class PPAPI_THUNK_EXPORT PPB_FileIO_API
{
21 virtual ~PPB_FileIO_API() {}
23 virtual int32_t Open(PP_Resource file_ref
,
25 scoped_refptr
<TrackedCallback
> callback
) = 0;
26 virtual int32_t Query(PP_FileInfo
* info
,
27 scoped_refptr
<TrackedCallback
> callback
) = 0;
28 virtual int32_t Touch(PP_Time last_access_time
,
29 PP_Time last_modified_time
,
30 scoped_refptr
<TrackedCallback
> callback
) = 0;
31 virtual int32_t Read(int64_t offset
,
33 int32_t bytes_to_read
,
34 scoped_refptr
<TrackedCallback
> callback
) = 0;
35 virtual int32_t ReadToArray(int64_t offset
,
36 int32_t max_read_length
,
37 PP_ArrayOutput
* buffer
,
38 scoped_refptr
<TrackedCallback
> callback
) = 0;
39 virtual int32_t Write(int64_t offset
,
41 int32_t bytes_to_write
,
42 scoped_refptr
<TrackedCallback
> callback
) = 0;
43 virtual int32_t SetLength(int64_t length
,
44 scoped_refptr
<TrackedCallback
> callback
) = 0;
45 virtual int32_t Flush(scoped_refptr
<TrackedCallback
> callback
) = 0;
46 virtual void Close() = 0;
49 virtual int32_t GetOSFileDescriptor() = 0;
50 virtual int32_t WillWrite(int64_t offset
,
51 int32_t bytes_to_write
,
52 scoped_refptr
<TrackedCallback
> callback
) = 0;
53 virtual int32_t WillSetLength(int64_t length
,
54 scoped_refptr
<TrackedCallback
> callback
) = 0;
57 virtual int32_t RequestOSFileHandle(
58 PP_FileHandle
* handle
,
59 scoped_refptr
<TrackedCallback
> callback
) = 0;
65 #endif // PPAPI_THUNK_PPB_FILE_IO_API_H_