OLD | NEW |
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_FILEAPI_ASYNC_FILE_UTIL_H_ | 5 #ifndef WEBKIT_FILEAPI_ASYNC_FILE_UTIL_H_ |
6 #define WEBKIT_FILEAPI_ASYNC_FILE_UTIL_H_ | 6 #define WEBKIT_FILEAPI_ASYNC_FILE_UTIL_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback_forward.h" | 9 #include "base/callback_forward.h" |
10 #include "base/files/file_util_proxy.h" | 10 #include "base/files/file_util_proxy.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 typedef base::FileUtilProxy::CreateOrOpenCallback CreateOrOpenCallback; | 36 typedef base::FileUtilProxy::CreateOrOpenCallback CreateOrOpenCallback; |
37 | 37 |
38 typedef base::Callback< | 38 typedef base::Callback< |
39 void(base::PlatformFileError result, | 39 void(base::PlatformFileError result, |
40 bool created)> EnsureFileExistsCallback; | 40 bool created)> EnsureFileExistsCallback; |
41 | 41 |
42 typedef base::Callback< | 42 typedef base::Callback< |
43 void(base::PlatformFileError result, | 43 void(base::PlatformFileError result, |
44 const base::PlatformFileInfo& file_info, | 44 const base::PlatformFileInfo& file_info, |
45 const FilePath& platform_path)> GetFileInfoCallback; | 45 const base::FilePath& platform_path)> GetFileInfoCallback; |
46 | 46 |
47 typedef base::FileUtilProxy::Entry Entry; | 47 typedef base::FileUtilProxy::Entry Entry; |
48 typedef std::vector<base::FileUtilProxy::Entry> EntryList; | 48 typedef std::vector<base::FileUtilProxy::Entry> EntryList; |
49 typedef base::Callback< | 49 typedef base::Callback< |
50 void(base::PlatformFileError result, | 50 void(base::PlatformFileError result, |
51 const EntryList& file_list, | 51 const EntryList& file_list, |
52 bool has_more)> ReadDirectoryCallback; | 52 bool has_more)> ReadDirectoryCallback; |
53 | 53 |
54 typedef base::Callback< | 54 typedef base::Callback< |
55 void(base::PlatformFileError result, | 55 void(base::PlatformFileError result, |
56 const base::PlatformFileInfo& file_info, | 56 const base::PlatformFileInfo& file_info, |
57 const FilePath& platform_path, | 57 const base::FilePath& platform_path, |
58 SnapshotFilePolicy policy)> CreateSnapshotFileCallback; | 58 SnapshotFilePolicy policy)> CreateSnapshotFileCallback; |
59 | 59 |
60 AsyncFileUtil() {} | 60 AsyncFileUtil() {} |
61 virtual ~AsyncFileUtil() {} | 61 virtual ~AsyncFileUtil() {} |
62 | 62 |
63 // Creates or opens a file with the given flags. | 63 // Creates or opens a file with the given flags. |
64 // If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to create | 64 // If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to create |
65 // a new file at the given |url| and calls back with | 65 // a new file at the given |url| and calls back with |
66 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |url| already exists. | 66 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |url| already exists. |
67 // | 67 // |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // This reports following error code via |callback|: | 236 // This reports following error code via |callback|: |
237 // - PLATFORM_FILE_ERROR_NOT_FOUND if |src_file_path| | 237 // - PLATFORM_FILE_ERROR_NOT_FOUND if |src_file_path| |
238 // or the parent directory of |dest_url| does not exist. | 238 // or the parent directory of |dest_url| does not exist. |
239 // - PLATFORM_FILE_ERROR_INVALID_OPERATION if |dest_url| exists and | 239 // - PLATFORM_FILE_ERROR_INVALID_OPERATION if |dest_url| exists and |
240 // is not a file. | 240 // is not a file. |
241 // - PLATFORM_FILE_ERROR_FAILED if |dest_url| does not exist and | 241 // - PLATFORM_FILE_ERROR_FAILED if |dest_url| does not exist and |
242 // its parent path is a file. | 242 // its parent path is a file. |
243 // | 243 // |
244 virtual bool CopyInForeignFile( | 244 virtual bool CopyInForeignFile( |
245 FileSystemOperationContext* context, | 245 FileSystemOperationContext* context, |
246 const FilePath& src_file_path, | 246 const base::FilePath& src_file_path, |
247 const FileSystemURL& dest_url, | 247 const FileSystemURL& dest_url, |
248 const StatusCallback& callback) = 0; | 248 const StatusCallback& callback) = 0; |
249 | 249 |
250 // Deletes a single file. | 250 // Deletes a single file. |
251 // | 251 // |
252 // LocalFileSystemOperation::RemoveFile calls this. | 252 // LocalFileSystemOperation::RemoveFile calls this. |
253 // | 253 // |
254 // This returns false if it fails to post an async task. | 254 // This returns false if it fails to post an async task. |
255 // | 255 // |
256 // This reports following error code via |callback|: | 256 // This reports following error code via |callback|: |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 const FileSystemURL& url, | 308 const FileSystemURL& url, |
309 const CreateSnapshotFileCallback& callback) = 0; | 309 const CreateSnapshotFileCallback& callback) = 0; |
310 | 310 |
311 private: | 311 private: |
312 DISALLOW_COPY_AND_ASSIGN(AsyncFileUtil); | 312 DISALLOW_COPY_AND_ASSIGN(AsyncFileUtil); |
313 }; | 313 }; |
314 | 314 |
315 } // namespace fileapi | 315 } // namespace fileapi |
316 | 316 |
317 #endif // WEBKIT_FILEAPI_ASYNC_FILE_UTIL_H_ | 317 #endif // WEBKIT_FILEAPI_ASYNC_FILE_UTIL_H_ |
OLD | NEW |