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_PLUGINS_PPAPI_PPB_FILE_IO_IMPL_H_ |
6 #define WEBKIT_GLUE_PLUGINS_PEPPER_FILE_IO_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_FILE_IO_IMPL_H_ |
7 | 7 |
| 8 #include "base/basictypes.h" |
8 #include "base/file_path.h" | 9 #include "base/file_path.h" |
9 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
10 #include "base/scoped_callback_factory.h" | 11 #include "base/scoped_callback_factory.h" |
11 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
12 #include "ppapi/c/dev/pp_file_info_dev.h" | 13 #include "ppapi/c/dev/pp_file_info_dev.h" |
13 #include "ppapi/c/pp_completion_callback.h" | 14 #include "ppapi/c/pp_completion_callback.h" |
14 #include "ppapi/c/pp_time.h" | 15 #include "ppapi/c/pp_time.h" |
15 #include "webkit/glue/plugins/pepper_plugin_delegate.h" | 16 #include "webkit/plugins/ppapi/plugin_delegate.h" |
16 #include "webkit/glue/plugins/pepper_resource.h" | 17 #include "webkit/plugins/ppapi/resource.h" |
17 | 18 |
18 struct PP_CompletionCallback; | 19 struct PP_CompletionCallback; |
19 struct PPB_FileIO_Dev; | 20 struct PPB_FileIO_Dev; |
20 struct PPB_FileIOTrusted_Dev; | 21 struct PPB_FileIOTrusted_Dev; |
21 | 22 |
22 namespace pepper { | 23 namespace webkit { |
| 24 namespace ppapi { |
23 | 25 |
24 class PluginModule; | 26 class PluginModule; |
| 27 class PPB_FileRef_Impl; |
25 | 28 |
26 class FileIO : public Resource { | 29 class PPB_FileIO_Impl : public Resource { |
27 public: | 30 public: |
28 explicit FileIO(PluginModule* module); | 31 explicit PPB_FileIO_Impl(PluginModule* module); |
29 virtual ~FileIO(); | 32 virtual ~PPB_FileIO_Impl(); |
30 | 33 |
31 // Returns a pointer to the interface implementing PPB_FileIO that is exposed | 34 // Returns a pointer to the interface implementing PPB_FileIO that is exposed |
32 // to the plugin. | 35 // to the plugin. |
33 static const PPB_FileIO_Dev* GetInterface(); | 36 static const PPB_FileIO_Dev* GetInterface(); |
34 | 37 |
35 // Returns a pointer to the interface implementing PPB_FileIOTrusted that is | 38 // Returns a pointer to the interface implementing PPB_FileIOTrusted that is |
36 // exposed to the plugin. | 39 // exposed to the plugin. |
37 static const PPB_FileIOTrusted_Dev* GetTrustedInterface(); | 40 static const PPB_FileIOTrusted_Dev* GetTrustedInterface(); |
38 | 41 |
39 // Resource overrides. | 42 // Resource overrides. |
40 virtual FileIO* AsFileIO(); | 43 virtual PPB_FileIO_Impl* AsPPB_FileIO_Impl(); |
41 | 44 |
42 // PPB_FileIO implementation. | 45 // PPB_FileIO implementation. |
43 int32_t Open(FileRef* file_ref, | 46 int32_t Open(PPB_FileRef_Impl* file_ref, |
44 int32_t open_flags, | 47 int32_t open_flags, |
45 PP_CompletionCallback callback); | 48 PP_CompletionCallback callback); |
46 int32_t Query(PP_FileInfo_Dev* info, | 49 int32_t Query(PP_FileInfo_Dev* info, |
47 PP_CompletionCallback callback); | 50 PP_CompletionCallback callback); |
48 int32_t Touch(PP_Time last_access_time, | 51 int32_t Touch(PP_Time last_access_time, |
49 PP_Time last_modified_time, | 52 PP_Time last_modified_time, |
50 PP_CompletionCallback callback); | 53 PP_CompletionCallback callback); |
51 int32_t Read(int64_t offset, | 54 int32_t Read(int64_t offset, |
52 char* buffer, | 55 char* buffer, |
53 int32_t bytes_to_read, | 56 int32_t bytes_to_read, |
(...skipping 19 matching lines...) Expand all Loading... |
73 void StatusCallback(base::PlatformFileError error_code); | 76 void StatusCallback(base::PlatformFileError error_code); |
74 void AsyncOpenFileCallback(base::PlatformFileError error_code, | 77 void AsyncOpenFileCallback(base::PlatformFileError error_code, |
75 base::PlatformFile file); | 78 base::PlatformFile file); |
76 void QueryInfoCallback(base::PlatformFileError error_code, | 79 void QueryInfoCallback(base::PlatformFileError error_code, |
77 const base::PlatformFileInfo& file_info); | 80 const base::PlatformFileInfo& file_info); |
78 void ReadWriteCallback(base::PlatformFileError error_code, | 81 void ReadWriteCallback(base::PlatformFileError error_code, |
79 int bytes_read_or_written); | 82 int bytes_read_or_written); |
80 | 83 |
81 private: | 84 private: |
82 PluginDelegate* delegate_; | 85 PluginDelegate* delegate_; |
83 base::ScopedCallbackFactory<FileIO> callback_factory_; | 86 base::ScopedCallbackFactory<PPB_FileIO_Impl> callback_factory_; |
84 | 87 |
85 base::PlatformFile file_; | 88 base::PlatformFile file_; |
86 PP_FileSystemType_Dev file_system_type_; | 89 PP_FileSystemType_Dev file_system_type_; |
87 | 90 |
88 PP_CompletionCallback callback_; | 91 PP_CompletionCallback callback_; |
89 PP_FileInfo_Dev* info_; | 92 PP_FileInfo_Dev* info_; |
| 93 |
| 94 DISALLOW_COPY_AND_ASSIGN(PPB_FileIO_Impl); |
90 }; | 95 }; |
91 | 96 |
92 } // namespace pepper | 97 } // namespace ppapi |
| 98 } // namespace webkit |
93 | 99 |
94 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_FILE_IO_H_ | 100 #endif // WEBKIT_PLUGINS_PPAPI_PPB_FILE_IO_IMPL_H_ |
OLD | NEW |