| 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_CALLBACKS_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_FILE_CALLBACKS_H_ |
| 6 #define WEBKIT_GLUE_PLUGINS_PEPPER_FILE_CALLBACKS_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_FILE_CALLBACKS_H_ |
| 7 | 7 |
| 8 #include "base/platform_file.h" | 8 #include "base/platform_file.h" |
| 9 #include "base/weak_ptr.h" | 9 #include "base/weak_ptr.h" |
| 10 #include "ppapi/c/pp_completion_callback.h" | 10 #include "ppapi/c/pp_completion_callback.h" |
| 11 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 11 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
| 12 | 12 |
| 13 struct PP_FileInfo_Dev; | 13 struct PP_FileInfo_Dev; |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class FilePath; | 16 class FilePath; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace pepper { | 19 namespace webkit { |
| 20 namespace plugins { |
| 21 namespace ppapi { |
| 20 | 22 |
| 21 class DirectoryReader; | 23 class PPB_DirectoryReader_Impl; |
| 22 class FileSystem; | 24 class PPB_FileSystem_Impl; |
| 23 class PluginModule; | 25 class PluginModule; |
| 24 | 26 |
| 25 // Instances of this class are deleted by FileSystemDispatcher. | 27 // Instances of this class are deleted by FileSystemDispatcher. |
| 26 class FileCallbacks : public fileapi::FileSystemCallbackDispatcher { | 28 class FileCallbacks : public fileapi::FileSystemCallbackDispatcher { |
| 27 public: | 29 public: |
| 28 FileCallbacks(const base::WeakPtr<PluginModule>& module, | 30 FileCallbacks(const base::WeakPtr<PluginModule>& module, |
| 29 PP_CompletionCallback callback, | 31 PP_CompletionCallback callback, |
| 30 PP_FileInfo_Dev* info, | 32 PP_FileInfo_Dev* info, |
| 31 scoped_refptr<FileSystem> file_system, | 33 scoped_refptr<PPB_FileSystem_Impl> file_system, |
| 32 scoped_refptr<DirectoryReader> directory_reader); | 34 scoped_refptr<PPB_DirectoryReader_Impl> directory_reader); |
| 33 virtual ~FileCallbacks(); | 35 virtual ~FileCallbacks(); |
| 34 | 36 |
| 35 // FileSystemCallbackDispatcher implementation. | 37 // FileSystemCallbackDispatcher implementation. |
| 36 virtual void DidSucceed(); | 38 virtual void DidSucceed(); |
| 37 virtual void DidReadMetadata(const base::PlatformFileInfo& file_info); | 39 virtual void DidReadMetadata(const base::PlatformFileInfo& file_info); |
| 38 virtual void DidReadDirectory( | 40 virtual void DidReadDirectory( |
| 39 const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more); | 41 const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more); |
| 40 virtual void DidOpenFileSystem(const std::string&, | 42 virtual void DidOpenFileSystem(const std::string&, |
| 41 const FilePath& root_path); | 43 const FilePath& root_path); |
| 42 virtual void DidFail(base::PlatformFileError error_code); | 44 virtual void DidFail(base::PlatformFileError error_code); |
| 43 virtual void DidWrite(int64 bytes, bool complete); | 45 virtual void DidWrite(int64 bytes, bool complete); |
| 44 | 46 |
| 45 private: | 47 private: |
| 46 void RunCallback(base::PlatformFileError error_code); | 48 void RunCallback(base::PlatformFileError error_code); |
| 47 | 49 |
| 48 base::WeakPtr<PluginModule> module_; | 50 base::WeakPtr<PluginModule> module_; |
| 49 PP_CompletionCallback callback_; | 51 PP_CompletionCallback callback_; |
| 50 PP_FileInfo_Dev* info_; | 52 PP_FileInfo_Dev* info_; |
| 51 scoped_refptr<FileSystem> file_system_; | 53 scoped_refptr<PPB_FileSystem_Impl> file_system_; |
| 52 scoped_refptr<DirectoryReader> directory_reader_; | 54 scoped_refptr<PPB_DirectoryReader_Impl> directory_reader_; |
| 53 }; | 55 }; |
| 54 | 56 |
| 55 } // namespace pepper | 57 } // namespace ppapi |
| 58 } // namespace plugins |
| 59 } // namespace webkit |
| 56 | 60 |
| 57 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_FILE_CALLBACKS_H_ | 61 #endif // WEBKIT_PLUGINS_PPAPI_FILE_CALLBACKS_H_ |
| OLD | NEW |