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