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