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