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/bind_helpers.h" | |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
13 #include "base/platform_file.h" | 14 #include "base/platform_file.h" |
14 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
16 #include "ppapi/c/pp_array_output.h" | |
15 #include "ppapi/c/pp_completion_callback.h" | 17 #include "ppapi/c/pp_completion_callback.h" |
16 #include "ppapi/c/pp_file_info.h" | 18 #include "ppapi/c/pp_file_info.h" |
17 #include "ppapi/c/pp_resource.h" | 19 #include "ppapi/c/pp_resource.h" |
18 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 20 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
19 | 21 |
20 struct PP_FileInfo; | 22 struct PP_FileInfo; |
21 | 23 |
22 namespace base { | 24 namespace base { |
23 class FilePath; | 25 class FilePath; |
24 } | 26 } |
25 | 27 |
26 namespace ppapi { | 28 namespace ppapi { |
27 class Resource; | 29 class Resource; |
28 class TrackedCallback; | 30 class TrackedCallback; |
31 struct PPB_FileRef_CreateInfo; | |
29 } | 32 } |
30 | 33 |
31 namespace webkit { | 34 namespace webkit { |
32 namespace ppapi { | 35 namespace ppapi { |
33 | 36 |
37 class PPB_FileRef_Impl; | |
38 | |
34 // Instances of this class are deleted by FileSystemDispatcher. | 39 // Instances of this class are deleted by FileSystemDispatcher. |
35 class FileCallbacks : public fileapi::FileSystemCallbackDispatcher { | 40 class FileCallbacks : public fileapi::FileSystemCallbackDispatcher { |
36 public: | 41 public: |
42 // Don't take the ownership of members. | |
teravest
2013/05/02 17:32:10
s/Don't/Doesn't/ ?
hamaji
2013/05/02 18:49:40
Done.
| |
43 struct ReadEntriesParams { | |
44 PPB_FileRef_Impl* dir_ref; | |
45 std::vector< ::ppapi::PPB_FileRef_CreateInfo>* files; | |
46 std::vector<PP_FileType>* file_types; | |
47 }; | |
48 | |
37 FileCallbacks(::ppapi::Resource* resource, | 49 FileCallbacks(::ppapi::Resource* resource, |
38 scoped_refptr< ::ppapi::TrackedCallback> callback, | 50 scoped_refptr< ::ppapi::TrackedCallback> callback, |
39 PP_FileInfo* info); | 51 PP_FileInfo* info); |
40 FileCallbacks(::ppapi::Resource* resource, | 52 FileCallbacks(::ppapi::Resource* resource, |
41 scoped_refptr< ::ppapi::TrackedCallback> callback, | 53 scoped_refptr< ::ppapi::TrackedCallback> callback, |
42 PP_FileInfo* info, | 54 PP_FileInfo* info, |
43 PP_FileSystemType file_system_type); | 55 PP_FileSystemType file_system_type); |
56 FileCallbacks(::ppapi::Resource* resource, | |
57 scoped_refptr< ::ppapi::TrackedCallback> callback, | |
58 base::internal::OwnedWrapper<ReadEntriesParams> params); | |
dmichael (off chromium)
2013/05/02 19:43:54
Can you just use scoped_ptr and scoped_ptr::Pass?
hamaji
2013/05/02 20:14:49
Yeah, I've modified this code to just pass |params
| |
44 virtual ~FileCallbacks(); | 59 virtual ~FileCallbacks(); |
45 | 60 |
46 // FileSystemCallbackDispatcher implementation. | 61 // FileSystemCallbackDispatcher implementation. |
47 virtual void DidSucceed(); | 62 virtual void DidSucceed(); |
48 virtual void DidReadMetadata( | 63 virtual void DidReadMetadata( |
49 const base::PlatformFileInfo& file_info, | 64 const base::PlatformFileInfo& file_info, |
50 const base::FilePath& unused); | 65 const base::FilePath& unused); |
51 virtual void DidCreateSnapshotFile( | 66 virtual void DidCreateSnapshotFile( |
52 const base::PlatformFileInfo& file_info, | 67 const base::PlatformFileInfo& file_info, |
53 const base::FilePath& path); | 68 const base::FilePath& path); |
54 virtual void DidReadDirectory( | 69 virtual void DidReadDirectory( |
55 const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more); | 70 const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more); |
56 virtual void DidOpenFileSystem(const std::string&, | 71 virtual void DidOpenFileSystem(const std::string&, |
57 const GURL& root_url); | 72 const GURL& root_url); |
58 virtual void DidFail(base::PlatformFileError error_code); | 73 virtual void DidFail(base::PlatformFileError error_code); |
59 virtual void DidWrite(int64 bytes, bool complete); | 74 virtual void DidWrite(int64 bytes, bool complete); |
60 | 75 |
61 scoped_refptr< ::ppapi::TrackedCallback> GetTrackedCallback() const; | 76 scoped_refptr< ::ppapi::TrackedCallback> GetTrackedCallback() const; |
62 | 77 |
63 private: | 78 private: |
64 void RunCallback(base::PlatformFileError error_code); | 79 void RunCallback(base::PlatformFileError error_code); |
65 | 80 |
66 scoped_refptr< ::ppapi::TrackedCallback> callback_; | 81 scoped_refptr< ::ppapi::TrackedCallback> callback_; |
67 PP_FileInfo* info_; | 82 PP_FileInfo* info_; |
68 PP_FileSystemType file_system_type_; | 83 PP_FileSystemType file_system_type_; |
84 base::internal::OwnedWrapper<ReadEntriesParams> read_entries_params_; | |
69 }; | 85 }; |
70 | 86 |
71 } // namespace ppapi | 87 } // namespace ppapi |
72 } // namespace webkit | 88 } // namespace webkit |
73 | 89 |
74 #endif // WEBKIT_PLUGINS_PPAPI_FILE_CALLBACKS_H_ | 90 #endif // WEBKIT_PLUGINS_PPAPI_FILE_CALLBACKS_H_ |
OLD | NEW |