• 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 int32_t Flush(scoped_refptr<TrackedCallback> callback) = 0;
46   virtual void Close() = 0;
47 
48   // Private API.
49   virtual int32_t RequestOSFileHandle(
50       PP_FileHandle* handle,
51       scoped_refptr<TrackedCallback> callback) = 0;
52 };
53 
54 }  // namespace thunk
55 }  // namespace ppapi
56 
57 #endif  // PPAPI_THUNK_PPB_FILE_IO_API_H_
58