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