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