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 "googleurl/src/gurl.h" |
15 #include "ppapi/c/pp_array_output.h" | |
15 #include "ppapi/c/pp_completion_callback.h" | 16 #include "ppapi/c/pp_completion_callback.h" |
16 #include "ppapi/c/pp_file_info.h" | 17 #include "ppapi/c/pp_file_info.h" |
17 #include "ppapi/c/pp_resource.h" | 18 #include "ppapi/c/pp_resource.h" |
18 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 19 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
19 | 20 |
20 struct PP_FileInfo; | 21 struct PP_FileInfo; |
21 | 22 |
22 namespace base { | 23 namespace base { |
23 class FilePath; | 24 class FilePath; |
24 } | 25 } |
25 | 26 |
26 namespace ppapi { | 27 namespace ppapi { |
27 class Resource; | 28 class Resource; |
28 class TrackedCallback; | 29 class TrackedCallback; |
30 struct PPB_FileRef_CreateInfo; | |
29 } | 31 } |
30 | 32 |
31 namespace webkit { | 33 namespace webkit { |
32 namespace ppapi { | 34 namespace ppapi { |
33 | 35 |
36 class PPB_FileRef_Impl; | |
37 | |
34 // Instances of this class are deleted by FileSystemDispatcher. | 38 // Instances of this class are deleted by FileSystemDispatcher. |
35 class FileCallbacks : public fileapi::FileSystemCallbackDispatcher { | 39 class FileCallbacks : public fileapi::FileSystemCallbackDispatcher { |
36 public: | 40 public: |
41 // Doesn't take the ownership of members. | |
42 struct ReadEntriesParams { | |
43 PPB_FileRef_Impl* dir_ref; | |
44 std::vector< ::ppapi::PPB_FileRef_CreateInfo>* files; | |
palmer
2013/05/03 00:07:24
extra space
hamaji
2013/05/03 01:10:34
I think we don't use <:: because it's a trigraph :
| |
45 std::vector<PP_FileType>* file_types; | |
46 }; | |
47 | |
37 FileCallbacks(::ppapi::Resource* resource, | 48 FileCallbacks(::ppapi::Resource* resource, |
38 scoped_refptr< ::ppapi::TrackedCallback> callback, | 49 scoped_refptr< ::ppapi::TrackedCallback> callback, |
39 PP_FileInfo* info); | 50 PP_FileInfo* info); |
40 FileCallbacks(::ppapi::Resource* resource, | 51 FileCallbacks(::ppapi::Resource* resource, |
41 scoped_refptr< ::ppapi::TrackedCallback> callback, | 52 scoped_refptr< ::ppapi::TrackedCallback> callback, |
42 PP_FileInfo* info, | 53 PP_FileInfo* info, |
43 PP_FileSystemType file_system_type); | 54 PP_FileSystemType file_system_type); |
55 FileCallbacks(::ppapi::Resource* resource, | |
56 scoped_refptr< ::ppapi::TrackedCallback> callback, | |
palmer
2013/05/03 00:07:24
space
hamaji
2013/05/03 01:10:34
ditto
| |
57 const ReadEntriesParams& params); | |
44 virtual ~FileCallbacks(); | 58 virtual ~FileCallbacks(); |
45 | 59 |
46 // FileSystemCallbackDispatcher implementation. | 60 // FileSystemCallbackDispatcher implementation. |
47 virtual void DidSucceed(); | 61 virtual void DidSucceed(); |
48 virtual void DidReadMetadata( | 62 virtual void DidReadMetadata( |
49 const base::PlatformFileInfo& file_info, | 63 const base::PlatformFileInfo& file_info, |
50 const base::FilePath& unused); | 64 const base::FilePath& unused); |
51 virtual void DidCreateSnapshotFile( | 65 virtual void DidCreateSnapshotFile( |
52 const base::PlatformFileInfo& file_info, | 66 const base::PlatformFileInfo& file_info, |
53 const base::FilePath& path); | 67 const base::FilePath& path); |
54 virtual void DidReadDirectory( | 68 virtual void DidReadDirectory( |
55 const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more); | 69 const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more); |
56 virtual void DidOpenFileSystem(const std::string&, | 70 virtual void DidOpenFileSystem(const std::string&, |
57 const GURL& root_url); | 71 const GURL& root_url); |
58 virtual void DidFail(base::PlatformFileError error_code); | 72 virtual void DidFail(base::PlatformFileError error_code); |
59 virtual void DidWrite(int64 bytes, bool complete); | 73 virtual void DidWrite(int64 bytes, bool complete); |
60 | 74 |
61 scoped_refptr< ::ppapi::TrackedCallback> GetTrackedCallback() const; | 75 scoped_refptr< ::ppapi::TrackedCallback> GetTrackedCallback() const; |
62 | 76 |
63 private: | 77 private: |
64 void RunCallback(base::PlatformFileError error_code); | 78 void RunCallback(base::PlatformFileError error_code); |
65 | 79 |
66 scoped_refptr< ::ppapi::TrackedCallback> callback_; | 80 scoped_refptr< ::ppapi::TrackedCallback> callback_; |
67 PP_FileInfo* info_; | 81 PP_FileInfo* info_; |
68 PP_FileSystemType file_system_type_; | 82 PP_FileSystemType file_system_type_; |
83 PPB_FileRef_Impl* read_entries_dir_ref_; | |
84 std::vector< ::ppapi::PPB_FileRef_CreateInfo>* read_entries_files_; | |
palmer
2013/05/03 00:07:24
space
hamaji
2013/05/03 01:10:34
ditto
| |
85 std::vector<PP_FileType>* read_entries_file_types_; | |
dmichael (off chromium)
2013/05/02 20:39:13
As I noted elsewhere, I think these may need to be
hamaji
2013/05/02 22:45:14
Done. As we've chatted, I also modified Query as w
dmichael (off chromium)
2013/05/02 23:20:43
Nobody actually uses FileRef::Query in-process; we
hamaji
2013/05/02 23:36:33
A good news! Done
| |
69 }; | 86 }; |
70 | 87 |
71 } // namespace ppapi | 88 } // namespace ppapi |
72 } // namespace webkit | 89 } // namespace webkit |
73 | 90 |
74 #endif // WEBKIT_PLUGINS_PPAPI_FILE_CALLBACKS_H_ | 91 #endif // WEBKIT_PLUGINS_PPAPI_FILE_CALLBACKS_H_ |
OLD | NEW |