• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #ifndef PPAPI_THUNK_PPB_FILE_IO_API_H_
6 #define PPAPI_THUNK_PPB_FILE_IO_API_H_
7 
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"
12 
13 namespace ppapi {
14 
15 class TrackedCallback;
16 
17 namespace thunk {
18 
19 class PPAPI_THUNK_EXPORT PPB_FileIO_API {
20  public:
~PPB_FileIO_API()21   virtual ~PPB_FileIO_API() {}
22 
23   virtual int32_t Open(PP_Resource file_ref,
24                        int32_t open_flags,
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,
32                        char* buffer,
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,
40                         const char* buffer,
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 int64_t GetMaxWrittenOffset() const = 0;
46   virtual int64_t GetAppendModeWriteAmount() const = 0;
47   virtual void SetMaxWrittenOffset(int64_t max_written_offset) = 0;
48   virtual void SetAppendModeWriteAmount(int64_t append_mode_write_amount) = 0;
49   virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) = 0;
50   virtual void Close() = 0;
51 
52   // Private API.
53   virtual int32_t RequestOSFileHandle(
54       PP_FileHandle* handle,
55       scoped_refptr<TrackedCallback> callback) = 0;
56 };
57 
58 }  // namespace thunk
59 }  // namespace ppapi
60 
61 #endif  // PPAPI_THUNK_PPB_FILE_IO_API_H_
62