OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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 WEBKIT_GLUE_PLUGINS_PEPPER_FILE_IO_H_ |
| 6 #define WEBKIT_GLUE_PLUGINS_PEPPER_FILE_IO_H_ |
| 7 |
| 8 #include "third_party/ppapi/c/pp_time.h" |
| 9 #include "webkit/glue/plugins/pepper_resource.h" |
| 10 |
| 11 typedef struct _pp_CompletionCallback PP_CompletionCallback; |
| 12 typedef struct _pp_FileInfo PP_FileInfo; |
| 13 typedef struct _ppb_FileIO PPB_FileIO; |
| 14 typedef struct _ppb_FileIOTrusted PPB_FileIOTrusted; |
| 15 |
| 16 namespace pepper { |
| 17 |
| 18 class PluginModule; |
| 19 |
| 20 class FileIO : public Resource { |
| 21 public: |
| 22 explicit FileIO(PluginModule* module); |
| 23 virtual ~FileIO(); |
| 24 |
| 25 // Returns a pointer to the interface implementing PPB_FileIO that is exposed |
| 26 // to the plugin. |
| 27 static const PPB_FileIO* GetInterface(); |
| 28 |
| 29 // Returns a pointer to the interface implementing PPB_FileIOTrusted that is |
| 30 // exposed to the plugin. |
| 31 static const PPB_FileIOTrusted* GetTrustedInterface(); |
| 32 |
| 33 // Resource overrides. |
| 34 FileIO* AsFileIO() { return this; } |
| 35 |
| 36 // PPB_FileIO implementation. |
| 37 int32_t Open(FileRef* file_ref, |
| 38 int32_t open_flags, |
| 39 PP_CompletionCallback callback); |
| 40 int32_t Query(PP_FileInfo* info, |
| 41 PP_CompletionCallback callback); |
| 42 int32_t Touch(PP_Time last_access_time, |
| 43 PP_Time last_modified_time, |
| 44 PP_CompletionCallback callback); |
| 45 int32_t Read(int64_t offset, |
| 46 char* buffer, |
| 47 int32_t bytes_to_read, |
| 48 PP_CompletionCallback callback); |
| 49 int32_t Write(int64_t offset, |
| 50 const char* buffer, |
| 51 int32_t bytes_to_write, |
| 52 PP_CompletionCallback callback); |
| 53 int32_t SetLength(int64_t length, |
| 54 PP_CompletionCallback callback); |
| 55 int32_t Flush(PP_CompletionCallback callback); |
| 56 void Close(); |
| 57 |
| 58 // PPB_FileIOTrusted implementation. |
| 59 int32_t GetOSFileDescriptor(); |
| 60 int32_t WillWrite(int64_t offset, |
| 61 int32_t bytes_to_write, |
| 62 PP_CompletionCallback callback); |
| 63 int32_t WillSetLength(int64_t length, |
| 64 PP_CompletionCallback callback); |
| 65 }; |
| 66 |
| 67 } // namespace pepper |
| 68 |
| 69 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_FILE_IO_H_ |
OLD | NEW |