Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1140)

Side by Side Diff: storage/browser/fileapi/async_file_util.h

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « storage/browser/fileapi/OWNERS ('k') | storage/browser/fileapi/async_file_util_adapter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_BROWSER_FILEAPI_ASYNC_FILE_UTIL_H_ 5 #ifndef WEBKIT_BROWSER_FILEAPI_ASYNC_FILE_UTIL_H_
6 #define WEBKIT_BROWSER_FILEAPI_ASYNC_FILE_UTIL_H_ 6 #define WEBKIT_BROWSER_FILEAPI_ASYNC_FILE_UTIL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/files/file.h" 12 #include "base/files/file.h"
13 #include "base/files/file_util_proxy.h" 13 #include "base/files/file_util_proxy.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "webkit/browser/fileapi/file_system_operation.h" 15 #include "storage/browser/fileapi/file_system_operation.h"
16 #include "webkit/browser/webkit_storage_browser_export.h" 16 #include "storage/common/storage_export.h"
17 #include "webkit/common/fileapi/directory_entry.h" 17 #include "storage/common/fileapi/directory_entry.h"
18 18
19 namespace base { 19 namespace base {
20 class Time; 20 class Time;
21 } 21 }
22 22
23 namespace webkit_blob { 23 namespace storage {
24 class ShareableFileReference; 24 class ShareableFileReference;
25 } 25 }
26 26
27 namespace fileapi { 27 namespace storage {
28 28
29 class FileSystemOperationContext; 29 class FileSystemOperationContext;
30 class FileSystemURL; 30 class FileSystemURL;
31 31
32 // An interface which provides filesystem-specific file operations for 32 // An interface which provides filesystem-specific file operations for
33 // FileSystemOperationImpl. 33 // FileSystemOperationImpl.
34 // 34 //
35 // Each filesystem which needs to be dispatched from FileSystemOperationImpl 35 // Each filesystem which needs to be dispatched from FileSystemOperationImpl
36 // must implement this interface or a synchronous version of interface: 36 // must implement this interface or a synchronous version of interface:
37 // FileSystemFileUtil. 37 // FileSystemFileUtil.
38 // 38 //
39 // As far as an instance of this class is owned by a FileSystemBackend 39 // As far as an instance of this class is owned by a FileSystemBackend
40 // (which is owned by FileSystemContext), it's guaranteed that this instance's 40 // (which is owned by FileSystemContext), it's guaranteed that this instance's
41 // alive while FileSystemOperationContext given to each operation is kept 41 // alive while FileSystemOperationContext given to each operation is kept
42 // alive. (Note that this instance might be freed on different thread 42 // alive. (Note that this instance might be freed on different thread
43 // from the thread it is created.) 43 // from the thread it is created.)
44 // 44 //
45 // It is NOT valid to give null callback to this class, and implementors 45 // It is NOT valid to give null callback to this class, and implementors
46 // can assume that they don't get any null callbacks. 46 // can assume that they don't get any null callbacks.
47 // 47 //
48 class AsyncFileUtil { 48 class AsyncFileUtil {
49 public: 49 public:
50 typedef base::Callback<void(base::File::Error result)> StatusCallback; 50 typedef base::Callback<void(base::File::Error result)> StatusCallback;
51 51
52 // |on_close_callback| will be called after the |file| is closed in the 52 // |on_close_callback| will be called after the |file| is closed in the
53 // child process. |on_close_callback|.is_null() can be true, if no operation 53 // child process. |on_close_callback|.is_null() can be true, if no operation
54 // is needed on closing the file. 54 // is needed on closing the file.
55 typedef base::Callback< 55 typedef base::Callback<
56 void(base::File file, 56 void(base::File file, const base::Closure& on_close_callback)>
57 const base::Closure& on_close_callback)> CreateOrOpenCallback; 57 CreateOrOpenCallback;
58
59 typedef base::Callback<void(base::File::Error result, bool created)>
60 EnsureFileExistsCallback;
58 61
59 typedef base::Callback< 62 typedef base::Callback<
60 void(base::File::Error result, 63 void(base::File::Error result, const base::File::Info& file_info)>
61 bool created)> EnsureFileExistsCallback; 64 GetFileInfoCallback;
62
63 typedef base::Callback<
64 void(base::File::Error result,
65 const base::File::Info& file_info)> GetFileInfoCallback;
66 65
67 typedef std::vector<DirectoryEntry> EntryList; 66 typedef std::vector<DirectoryEntry> EntryList;
68 typedef base::Callback< 67 typedef base::Callback<
69 void(base::File::Error result, 68 void(base::File::Error result, const EntryList& file_list, bool has_more)>
70 const EntryList& file_list, 69 ReadDirectoryCallback;
71 bool has_more)> ReadDirectoryCallback;
72 70
73 typedef base::Callback< 71 typedef base::Callback<
74 void(base::File::Error result, 72 void(base::File::Error result,
75 const base::File::Info& file_info, 73 const base::File::Info& file_info,
76 const base::FilePath& platform_path, 74 const base::FilePath& platform_path,
77 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref)> 75 const scoped_refptr<storage::ShareableFileReference>& file_ref)>
78 CreateSnapshotFileCallback; 76 CreateSnapshotFileCallback;
79 77
80
81 typedef base::Callback<void(int64 size)> CopyFileProgressCallback; 78 typedef base::Callback<void(int64 size)> CopyFileProgressCallback;
82 79
83 typedef FileSystemOperation::CopyOrMoveOption CopyOrMoveOption; 80 typedef FileSystemOperation::CopyOrMoveOption CopyOrMoveOption;
84 81
85 // Creates an AsyncFileUtil instance which performs file operations on 82 // Creates an AsyncFileUtil instance which performs file operations on
86 // local native file system. The created instance assumes 83 // local native file system. The created instance assumes
87 // FileSystemURL::path() has the target platform path. 84 // FileSystemURL::path() has the target platform path.
88 WEBKIT_STORAGE_BROWSER_EXPORT static AsyncFileUtil* 85 STORAGE_EXPORT static AsyncFileUtil* CreateForLocalFileSystem();
89 CreateForLocalFileSystem();
90 86
91 AsyncFileUtil() {} 87 AsyncFileUtil() {}
92 virtual ~AsyncFileUtil() {} 88 virtual ~AsyncFileUtil() {}
93 89
94 // Creates or opens a file with the given flags. 90 // Creates or opens a file with the given flags.
95 // If File::FLAG_CREATE is set in |file_flags| it always tries to create 91 // If File::FLAG_CREATE is set in |file_flags| it always tries to create
96 // a new file at the given |url| and calls back with 92 // a new file at the given |url| and calls back with
97 // File::FILE_ERROR_FILE_EXISTS if the |url| already exists. 93 // File::FILE_ERROR_FILE_EXISTS if the |url| already exists.
98 // 94 //
99 // FileSystemOperationImpl::OpenFile calls this. 95 // FileSystemOperationImpl::OpenFile calls this.
100 // This is used only by Pepper/NaCl File API. 96 // This is used only by Pepper/NaCl File API.
101 // 97 //
102 virtual void CreateOrOpen( 98 virtual void CreateOrOpen(scoped_ptr<FileSystemOperationContext> context,
103 scoped_ptr<FileSystemOperationContext> context, 99 const FileSystemURL& url,
104 const FileSystemURL& url, 100 int file_flags,
105 int file_flags, 101 const CreateOrOpenCallback& callback) = 0;
106 const CreateOrOpenCallback& callback) = 0;
107 102
108 // Ensures that the given |url| exist. This creates a empty new file 103 // Ensures that the given |url| exist. This creates a empty new file
109 // at |url| if the |url| does not exist. 104 // at |url| if the |url| does not exist.
110 // 105 //
111 // FileSystemOperationImpl::CreateFile calls this. 106 // FileSystemOperationImpl::CreateFile calls this.
112 // 107 //
113 // This reports following error code via |callback|: 108 // This reports following error code via |callback|:
114 // - File::FILE_OK and created==true if a file has not existed and 109 // - File::FILE_OK and created==true if a file has not existed and
115 // is created at |url|. 110 // is created at |url|.
116 // - File::FILE_OK and created==false if the file already exists. 111 // - File::FILE_OK and created==false if the file already exists.
117 // - Other error code (with created=false) if a file hasn't existed yet 112 // - Other error code (with created=false) if a file hasn't existed yet
118 // and there was an error while creating a new file. 113 // and there was an error while creating a new file.
119 // 114 //
120 virtual void EnsureFileExists( 115 virtual void EnsureFileExists(scoped_ptr<FileSystemOperationContext> context,
121 scoped_ptr<FileSystemOperationContext> context, 116 const FileSystemURL& url,
122 const FileSystemURL& url, 117 const EnsureFileExistsCallback& callback) = 0;
123 const EnsureFileExistsCallback& callback) = 0;
124 118
125 // Creates directory at given url. 119 // Creates directory at given url.
126 // 120 //
127 // FileSystemOperationImpl::CreateDirectory calls this. 121 // FileSystemOperationImpl::CreateDirectory calls this.
128 // 122 //
129 // This reports following error code via |callback|: 123 // This reports following error code via |callback|:
130 // - File::FILE_ERROR_NOT_FOUND if the |url|'s parent directory 124 // - File::FILE_ERROR_NOT_FOUND if the |url|'s parent directory
131 // does not exist and |recursive| is false. 125 // does not exist and |recursive| is false.
132 // - File::FILE_ERROR_EXISTS if a directory already exists at |url| 126 // - File::FILE_ERROR_EXISTS if a directory already exists at |url|
133 // and |exclusive| is true. 127 // and |exclusive| is true.
134 // - File::FILE_ERROR_EXISTS if a file already exists at |url| 128 // - File::FILE_ERROR_EXISTS if a file already exists at |url|
135 // (regardless of |exclusive| value). 129 // (regardless of |exclusive| value).
136 // - Other error code if it failed to create a directory. 130 // - Other error code if it failed to create a directory.
137 // 131 //
138 virtual void CreateDirectory( 132 virtual void CreateDirectory(scoped_ptr<FileSystemOperationContext> context,
139 scoped_ptr<FileSystemOperationContext> context, 133 const FileSystemURL& url,
140 const FileSystemURL& url, 134 bool exclusive,
141 bool exclusive, 135 bool recursive,
142 bool recursive, 136 const StatusCallback& callback) = 0;
143 const StatusCallback& callback) = 0;
144 137
145 // Retrieves the information about a file. 138 // Retrieves the information about a file.
146 // 139 //
147 // FileSystemOperationImpl::GetMetadata calls this. 140 // FileSystemOperationImpl::GetMetadata calls this.
148 // 141 //
149 // This reports following error code via |callback|: 142 // This reports following error code via |callback|:
150 // - File::FILE_ERROR_NOT_FOUND if the file doesn't exist. 143 // - File::FILE_ERROR_NOT_FOUND if the file doesn't exist.
151 // - Other error code if there was an error while retrieving the file info. 144 // - Other error code if there was an error while retrieving the file info.
152 // 145 //
153 virtual void GetFileInfo( 146 virtual void GetFileInfo(scoped_ptr<FileSystemOperationContext> context,
154 scoped_ptr<FileSystemOperationContext> context, 147 const FileSystemURL& url,
155 const FileSystemURL& url, 148 const GetFileInfoCallback& callback) = 0;
156 const GetFileInfoCallback& callback) = 0;
157 149
158 // Reads contents of a directory at |path|. 150 // Reads contents of a directory at |path|.
159 // 151 //
160 // FileSystemOperationImpl::ReadDirectory calls this. 152 // FileSystemOperationImpl::ReadDirectory calls this.
161 // 153 //
162 // Note that the |name| field of each entry in |file_list| 154 // Note that the |name| field of each entry in |file_list|
163 // returned by |callback| should have a base file name 155 // returned by |callback| should have a base file name
164 // of the entry relative to the directory, but not an absolute path. 156 // of the entry relative to the directory, but not an absolute path.
165 // 157 //
166 // (E.g. if ReadDirectory is called for a directory 158 // (E.g. if ReadDirectory is called for a directory
167 // 'path/to/dir' and the directory has entries 'a' and 'b', 159 // 'path/to/dir' and the directory has entries 'a' and 'b',
168 // the returned |file_list| should include entries whose names 160 // the returned |file_list| should include entries whose names
169 // are 'a' and 'b', but not '/path/to/dir/a' and '/path/to/dir/b'.) 161 // are 'a' and 'b', but not '/path/to/dir/a' and '/path/to/dir/b'.)
170 // 162 //
171 // This reports following error code via |callback|: 163 // This reports following error code via |callback|:
172 // - File::FILE_ERROR_NOT_FOUND if the target directory doesn't exist. 164 // - File::FILE_ERROR_NOT_FOUND if the target directory doesn't exist.
173 // - File::FILE_ERROR_NOT_A_DIRECTORY if an entry exists at |url| but 165 // - File::FILE_ERROR_NOT_A_DIRECTORY if an entry exists at |url| but
174 // is a file (not a directory). 166 // is a file (not a directory).
175 // 167 //
176 virtual void ReadDirectory( 168 virtual void ReadDirectory(scoped_ptr<FileSystemOperationContext> context,
177 scoped_ptr<FileSystemOperationContext> context, 169 const FileSystemURL& url,
178 const FileSystemURL& url, 170 const ReadDirectoryCallback& callback) = 0;
179 const ReadDirectoryCallback& callback) = 0;
180 171
181 // Modifies timestamps of a file or directory at |url| with 172 // Modifies timestamps of a file or directory at |url| with
182 // |last_access_time| and |last_modified_time|. The function DOES NOT 173 // |last_access_time| and |last_modified_time|. The function DOES NOT
183 // create a file unlike 'touch' command on Linux. 174 // create a file unlike 'touch' command on Linux.
184 // 175 //
185 // FileSystemOperationImpl::TouchFile calls this. 176 // FileSystemOperationImpl::TouchFile calls this.
186 // This is used only by Pepper/NaCl File API. 177 // This is used only by Pepper/NaCl File API.
187 // 178 //
188 virtual void Touch( 179 virtual void Touch(scoped_ptr<FileSystemOperationContext> context,
189 scoped_ptr<FileSystemOperationContext> context, 180 const FileSystemURL& url,
190 const FileSystemURL& url, 181 const base::Time& last_access_time,
191 const base::Time& last_access_time, 182 const base::Time& last_modified_time,
192 const base::Time& last_modified_time, 183 const StatusCallback& callback) = 0;
193 const StatusCallback& callback) = 0;
194 184
195 // Truncates a file at |path| to |length|. If |length| is larger than 185 // Truncates a file at |path| to |length|. If |length| is larger than
196 // the original file size, the file will be extended, and the extended 186 // the original file size, the file will be extended, and the extended
197 // part is filled with null bytes. 187 // part is filled with null bytes.
198 // 188 //
199 // FileSystemOperationImpl::Truncate calls this. 189 // FileSystemOperationImpl::Truncate calls this.
200 // 190 //
201 // This reports following error code via |callback|: 191 // This reports following error code via |callback|:
202 // - File::FILE_ERROR_NOT_FOUND if the file doesn't exist. 192 // - File::FILE_ERROR_NOT_FOUND if the file doesn't exist.
203 // 193 //
204 virtual void Truncate( 194 virtual void Truncate(scoped_ptr<FileSystemOperationContext> context,
205 scoped_ptr<FileSystemOperationContext> context, 195 const FileSystemURL& url,
206 const FileSystemURL& url, 196 int64 length,
207 int64 length, 197 const StatusCallback& callback) = 0;
208 const StatusCallback& callback) = 0;
209 198
210 // Copies a file from |src_url| to |dest_url|. 199 // Copies a file from |src_url| to |dest_url|.
211 // This must be called for files that belong to the same filesystem 200 // This must be called for files that belong to the same filesystem
212 // (i.e. type() and origin() of the |src_url| and |dest_url| must match). 201 // (i.e. type() and origin() of the |src_url| and |dest_url| must match).
213 // |progress_callback| is a callback to report the progress update. 202 // |progress_callback| is a callback to report the progress update.
214 // See file_system_operations.h for details. This should be called on the 203 // See file_system_operations.h for details. This should be called on the
215 // same thread as where the method's called (IO thread). Calling this 204 // same thread as where the method's called (IO thread). Calling this
216 // is optional. It is recommended to use this callback for heavier operations 205 // is optional. It is recommended to use this callback for heavier operations
217 // (such as file network downloading), so that, e.g., clients (UIs) can 206 // (such as file network downloading), so that, e.g., clients (UIs) can
218 // update its state to show progress to users. This may be a null callback. 207 // update its state to show progress to users. This may be a null callback.
219 // 208 //
220 // FileSystemOperationImpl::Copy calls this for same-filesystem copy case. 209 // FileSystemOperationImpl::Copy calls this for same-filesystem copy case.
221 // 210 //
222 // This reports following error code via |callback|: 211 // This reports following error code via |callback|:
223 // - File::FILE_ERROR_NOT_FOUND if |src_url| 212 // - File::FILE_ERROR_NOT_FOUND if |src_url|
224 // or the parent directory of |dest_url| does not exist. 213 // or the parent directory of |dest_url| does not exist.
225 // - File::FILE_ERROR_NOT_A_FILE if |src_url| exists but is not a file. 214 // - File::FILE_ERROR_NOT_A_FILE if |src_url| exists but is not a file.
226 // - File::FILE_ERROR_INVALID_OPERATION if |dest_url| exists and 215 // - File::FILE_ERROR_INVALID_OPERATION if |dest_url| exists and
227 // is not a file. 216 // is not a file.
228 // - File::FILE_ERROR_FAILED if |dest_url| does not exist and 217 // - File::FILE_ERROR_FAILED if |dest_url| does not exist and
229 // its parent path is a file. 218 // its parent path is a file.
230 // 219 //
231 virtual void CopyFileLocal( 220 virtual void CopyFileLocal(scoped_ptr<FileSystemOperationContext> context,
232 scoped_ptr<FileSystemOperationContext> context, 221 const FileSystemURL& src_url,
233 const FileSystemURL& src_url, 222 const FileSystemURL& dest_url,
234 const FileSystemURL& dest_url, 223 CopyOrMoveOption option,
235 CopyOrMoveOption option, 224 const CopyFileProgressCallback& progress_callback,
236 const CopyFileProgressCallback& progress_callback, 225 const StatusCallback& callback) = 0;
237 const StatusCallback& callback) = 0;
238 226
239 // Moves a local file from |src_url| to |dest_url|. 227 // Moves a local file from |src_url| to |dest_url|.
240 // This must be called for files that belong to the same filesystem 228 // This must be called for files that belong to the same filesystem
241 // (i.e. type() and origin() of the |src_url| and |dest_url| must match). 229 // (i.e. type() and origin() of the |src_url| and |dest_url| must match).
242 // 230 //
243 // FileSystemOperationImpl::Move calls this for same-filesystem move case. 231 // FileSystemOperationImpl::Move calls this for same-filesystem move case.
244 // 232 //
245 // This reports following error code via |callback|: 233 // This reports following error code via |callback|:
246 // - File::FILE_ERROR_NOT_FOUND if |src_url| 234 // - File::FILE_ERROR_NOT_FOUND if |src_url|
247 // or the parent directory of |dest_url| does not exist. 235 // or the parent directory of |dest_url| does not exist.
248 // - File::FILE_ERROR_NOT_A_FILE if |src_url| exists but is not a file. 236 // - File::FILE_ERROR_NOT_A_FILE if |src_url| exists but is not a file.
249 // - File::FILE_ERROR_INVALID_OPERATION if |dest_url| exists and 237 // - File::FILE_ERROR_INVALID_OPERATION if |dest_url| exists and
250 // is not a file. 238 // is not a file.
251 // - File::FILE_ERROR_FAILED if |dest_url| does not exist and 239 // - File::FILE_ERROR_FAILED if |dest_url| does not exist and
252 // its parent path is a file. 240 // its parent path is a file.
253 // 241 //
254 virtual void MoveFileLocal( 242 virtual void MoveFileLocal(scoped_ptr<FileSystemOperationContext> context,
255 scoped_ptr<FileSystemOperationContext> context, 243 const FileSystemURL& src_url,
256 const FileSystemURL& src_url, 244 const FileSystemURL& dest_url,
257 const FileSystemURL& dest_url, 245 CopyOrMoveOption option,
258 CopyOrMoveOption option, 246 const StatusCallback& callback) = 0;
259 const StatusCallback& callback) = 0;
260 247
261 // Copies in a single file from a different filesystem. 248 // Copies in a single file from a different filesystem.
262 // 249 //
263 // FileSystemOperationImpl::Copy or Move calls this for cross-filesystem 250 // FileSystemOperationImpl::Copy or Move calls this for cross-filesystem
264 // cases. 251 // cases.
265 // 252 //
266 // This reports following error code via |callback|: 253 // This reports following error code via |callback|:
267 // - File::FILE_ERROR_NOT_FOUND if |src_file_path| 254 // - File::FILE_ERROR_NOT_FOUND if |src_file_path|
268 // or the parent directory of |dest_url| does not exist. 255 // or the parent directory of |dest_url| does not exist.
269 // - File::FILE_ERROR_INVALID_OPERATION if |dest_url| exists and 256 // - File::FILE_ERROR_INVALID_OPERATION if |dest_url| exists and
270 // is not a file. 257 // is not a file.
271 // - File::FILE_ERROR_FAILED if |dest_url| does not exist and 258 // - File::FILE_ERROR_FAILED if |dest_url| does not exist and
272 // its parent path is a file. 259 // its parent path is a file.
273 // 260 //
274 virtual void CopyInForeignFile( 261 virtual void CopyInForeignFile(scoped_ptr<FileSystemOperationContext> context,
275 scoped_ptr<FileSystemOperationContext> context, 262 const base::FilePath& src_file_path,
276 const base::FilePath& src_file_path, 263 const FileSystemURL& dest_url,
277 const FileSystemURL& dest_url, 264 const StatusCallback& callback) = 0;
278 const StatusCallback& callback) = 0;
279 265
280 // Deletes a single file. 266 // Deletes a single file.
281 // 267 //
282 // FileSystemOperationImpl::RemoveFile calls this. 268 // FileSystemOperationImpl::RemoveFile calls this.
283 // 269 //
284 // This reports following error code via |callback|: 270 // This reports following error code via |callback|:
285 // - File::FILE_ERROR_NOT_FOUND if |url| does not exist. 271 // - File::FILE_ERROR_NOT_FOUND if |url| does not exist.
286 // - File::FILE_ERROR_NOT_A_FILE if |url| is not a file. 272 // - File::FILE_ERROR_NOT_A_FILE if |url| is not a file.
287 // 273 //
288 virtual void DeleteFile( 274 virtual void DeleteFile(scoped_ptr<FileSystemOperationContext> context,
289 scoped_ptr<FileSystemOperationContext> context, 275 const FileSystemURL& url,
290 const FileSystemURL& url, 276 const StatusCallback& callback) = 0;
291 const StatusCallback& callback) = 0;
292 277
293 // Removes a single empty directory. 278 // Removes a single empty directory.
294 // 279 //
295 // FileSystemOperationImpl::RemoveDirectory calls this. 280 // FileSystemOperationImpl::RemoveDirectory calls this.
296 // 281 //
297 // This reports following error code via |callback|: 282 // This reports following error code via |callback|:
298 // - File::FILE_ERROR_NOT_FOUND if |url| does not exist. 283 // - File::FILE_ERROR_NOT_FOUND if |url| does not exist.
299 // - File::FILE_ERROR_NOT_A_DIRECTORY if |url| is not a directory. 284 // - File::FILE_ERROR_NOT_A_DIRECTORY if |url| is not a directory.
300 // - File::FILE_ERROR_NOT_EMPTY if |url| is not empty. 285 // - File::FILE_ERROR_NOT_EMPTY if |url| is not empty.
301 // 286 //
302 virtual void DeleteDirectory( 287 virtual void DeleteDirectory(scoped_ptr<FileSystemOperationContext> context,
303 scoped_ptr<FileSystemOperationContext> context, 288 const FileSystemURL& url,
304 const FileSystemURL& url, 289 const StatusCallback& callback) = 0;
305 const StatusCallback& callback) = 0;
306 290
307 // Removes a single file or a single directory with its contents 291 // Removes a single file or a single directory with its contents
308 // (i.e. files/subdirectories under the directory). 292 // (i.e. files/subdirectories under the directory).
309 // 293 //
310 // FileSystemOperationImpl::Remove calls this. 294 // FileSystemOperationImpl::Remove calls this.
311 // On some platforms, such as Chrome OS Drive File System, recursive file 295 // On some platforms, such as Chrome OS Drive File System, recursive file
312 // deletion can be implemented more efficiently than calling DeleteFile() and 296 // deletion can be implemented more efficiently than calling DeleteFile() and
313 // DeleteDirectory() for each files/directories. 297 // DeleteDirectory() for each files/directories.
314 // This method is optional, so if not supported, 298 // This method is optional, so if not supported,
315 // File::FILE_ERROR_INVALID_OPERATION should be returned via |callback|. 299 // File::FILE_ERROR_INVALID_OPERATION should be returned via |callback|.
316 // 300 //
317 // This reports following error code via |callback|: 301 // This reports following error code via |callback|:
318 // - File::FILE_ERROR_NOT_FOUND if |url| does not exist. 302 // - File::FILE_ERROR_NOT_FOUND if |url| does not exist.
319 // - File::FILE_ERROR_INVALID_OPERATION if this operation is not supported. 303 // - File::FILE_ERROR_INVALID_OPERATION if this operation is not supported.
320 virtual void DeleteRecursively( 304 virtual void DeleteRecursively(scoped_ptr<FileSystemOperationContext> context,
321 scoped_ptr<FileSystemOperationContext> context, 305 const FileSystemURL& url,
322 const FileSystemURL& url, 306 const StatusCallback& callback) = 0;
323 const StatusCallback& callback) = 0;
324 307
325 // Creates a local snapshot file for a given |url| and returns the 308 // Creates a local snapshot file for a given |url| and returns the
326 // metadata and platform path of the snapshot file via |callback|. 309 // metadata and platform path of the snapshot file via |callback|.
327 // In regular filesystem cases the implementation may simply return 310 // In regular filesystem cases the implementation may simply return
328 // the metadata of the file itself (as well as GetMetadata does), 311 // the metadata of the file itself (as well as GetMetadata does),
329 // while in non-regular filesystem case the backend may create a 312 // while in non-regular filesystem case the backend may create a
330 // temporary snapshot file which holds the file data and return 313 // temporary snapshot file which holds the file data and return
331 // the metadata of the temporary file. 314 // the metadata of the temporary file.
332 // 315 //
333 // In the callback, it returns: 316 // In the callback, it returns:
(...skipping 21 matching lines...) Expand all
355 // check the return code. 338 // check the return code.
356 virtual void CreateSnapshotFile( 339 virtual void CreateSnapshotFile(
357 scoped_ptr<FileSystemOperationContext> context, 340 scoped_ptr<FileSystemOperationContext> context,
358 const FileSystemURL& url, 341 const FileSystemURL& url,
359 const CreateSnapshotFileCallback& callback) = 0; 342 const CreateSnapshotFileCallback& callback) = 0;
360 343
361 private: 344 private:
362 DISALLOW_COPY_AND_ASSIGN(AsyncFileUtil); 345 DISALLOW_COPY_AND_ASSIGN(AsyncFileUtil);
363 }; 346 };
364 347
365 } // namespace fileapi 348 } // namespace storage
366 349
367 #endif // WEBKIT_BROWSER_FILEAPI_ASYNC_FILE_UTIL_H_ 350 #endif // WEBKIT_BROWSER_FILEAPI_ASYNC_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « storage/browser/fileapi/OWNERS ('k') | storage/browser/fileapi/async_file_util_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698