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