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_FILEAPI_FILE_SYSTEM_FILE_UTIL_PROXY_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_PROXY_H_ |
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_PROXY_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_PROXY_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/file_util_proxy.h" | 12 #include "base/file_util_proxy.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/platform_file.h" | 14 #include "base/platform_file.h" |
15 #include "base/tracked_objects.h" | 15 #include "base/tracked_objects.h" |
| 16 #include "webkit/fileapi/file_system_file_util.h" |
16 #include "webkit/fileapi/file_system_operation_interface.h" | 17 #include "webkit/fileapi/file_system_operation_interface.h" |
17 | 18 |
18 namespace fileapi { | 19 namespace fileapi { |
19 | 20 |
20 using base::PlatformFile; | 21 using base::PlatformFile; |
21 using base::PlatformFileError; | 22 using base::PlatformFileError; |
22 using base::PlatformFileInfo; | 23 using base::PlatformFileInfo; |
23 | 24 |
24 class FileSystemFileUtil; | 25 class FileSystemFileUtil; |
25 class FileSystemOperationContext; | 26 class FileSystemOperationContext; |
26 class FileSystemURL; | 27 class FileSystemURL; |
27 | 28 |
28 // This class provides asynchronous access to FileSystemFileUtil methods for | 29 // This class provides asynchronous access to FileSystemFileUtil methods for |
29 // FileSystem API operations. This also implements cross-FileUtil copy/move | 30 // FileSystem API operations. This also implements cross-FileUtil copy/move |
30 // operations on top of FileSystemFileUtil methods. | 31 // operations on top of FileSystemFileUtil methods. |
31 class FileSystemFileUtilProxy { | 32 class FileSystemFileUtilProxy { |
32 public: | 33 public: |
33 // Some of the proxy routines are just wrapping around the FileUtilProxy's | 34 // Some of the proxy routines are just wrapping around the FileUtilProxy's |
34 // relay methods, so we use the same types as FileUtilProxy for them. | 35 // relay methods, so we use the same types as FileUtilProxy for them. |
35 typedef base::FileUtilProxy::Entry Entry; | 36 typedef base::FileUtilProxy::Entry Entry; |
36 typedef base::FileUtilProxy::CreateOrOpenCallback CreateOrOpenCallback; | 37 typedef base::FileUtilProxy::CreateOrOpenCallback CreateOrOpenCallback; |
37 | 38 |
38 typedef base::Callback<void(PlatformFileError status)> StatusCallback; | 39 typedef base::Callback<void(PlatformFileError status)> StatusCallback; |
39 typedef base::Callback<void(PlatformFileError status, | 40 typedef base::Callback<void(PlatformFileError status, |
40 bool created)> EnsureFileExistsCallback; | 41 bool created)> EnsureFileExistsCallback; |
41 typedef FileSystemOperationInterface::GetMetadataCallback GetFileInfoCallback; | 42 typedef FileSystemOperationInterface::GetMetadataCallback GetFileInfoCallback; |
42 typedef FileSystemOperationInterface::SnapshotFileCallback | |
43 SnapshotFileCallback; | |
44 typedef FileSystemOperationInterface::ReadDirectoryCallback | 43 typedef FileSystemOperationInterface::ReadDirectoryCallback |
45 ReadDirectoryCallback; | 44 ReadDirectoryCallback; |
46 | 45 |
| 46 typedef base::Callback< |
| 47 void(base::PlatformFileError result, |
| 48 const base::PlatformFileInfo& file_info, |
| 49 const FilePath& platform_path, |
| 50 FileSystemFileUtil::SnapshotFilePolicy snapshot_policy)> |
| 51 SnapshotFileCallback; |
| 52 |
47 // Deletes a file or a directory on the given context's file_task_runner. | 53 // Deletes a file or a directory on the given context's file_task_runner. |
48 // It is an error to delete a non-empty directory with recursive=false. | 54 // It is an error to delete a non-empty directory with recursive=false. |
49 static bool Delete( | 55 static bool Delete( |
50 FileSystemOperationContext* context, | 56 FileSystemOperationContext* context, |
51 FileSystemFileUtil* file_util, | 57 FileSystemFileUtil* file_util, |
52 const FileSystemURL& url, | 58 const FileSystemURL& url, |
53 bool recursive, | 59 bool recursive, |
54 const StatusCallback& callback); | 60 const StatusCallback& callback); |
55 | 61 |
56 // Creates or opens a file with the given flags by calling |file_util|'s | 62 // Creates or opens a file with the given flags by calling |file_util|'s |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 int64 length, | 166 int64 length, |
161 const StatusCallback& callback); | 167 const StatusCallback& callback); |
162 | 168 |
163 private: | 169 private: |
164 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemFileUtilProxy); | 170 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemFileUtilProxy); |
165 }; | 171 }; |
166 | 172 |
167 } // namespace fileapi | 173 } // namespace fileapi |
168 | 174 |
169 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_PROXY_H_ | 175 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_PROXY_H_ |
OLD | NEW |