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_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ |
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ |
7 | 7 |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util_proxy.h" | 9 #include "base/file_util_proxy.h" |
| 10 #include "base/memory/ref_counted.h" |
10 #include "base/platform_file.h" | 11 #include "base/platform_file.h" |
11 #include "webkit/fileapi/file_system_url.h" | 12 #include "webkit/fileapi/file_system_url.h" |
12 #include "webkit/fileapi/fileapi_export.h" | 13 #include "webkit/fileapi/fileapi_export.h" |
13 | 14 |
14 namespace base { | 15 namespace base { |
15 class Time; | 16 class Time; |
16 } | 17 } |
17 | 18 |
| 19 namespace webkit_blob { |
| 20 class ShareableFileReference; |
| 21 } |
| 22 |
18 namespace fileapi { | 23 namespace fileapi { |
19 | 24 |
20 using base::PlatformFile; | 25 using base::PlatformFile; |
21 using base::PlatformFileError; | 26 using base::PlatformFileError; |
22 class FileSystemOperationContext; | 27 class FileSystemOperationContext; |
23 | 28 |
24 // A file utility interface that provides basic file utility methods for | 29 // A file utility interface that provides basic file utility methods for |
25 // FileSystem API. | 30 // FileSystem API. |
26 // | 31 // |
27 // Layering structure of the FileSystemFileUtil was split out. | 32 // Layering structure of the FileSystemFileUtil was split out. |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 virtual PlatformFileError DeleteFile( | 168 virtual PlatformFileError DeleteFile( |
164 FileSystemOperationContext* context, | 169 FileSystemOperationContext* context, |
165 const FileSystemURL& url) = 0; | 170 const FileSystemURL& url) = 0; |
166 | 171 |
167 // Deletes a single empty directory. | 172 // Deletes a single empty directory. |
168 // It assumes the given url points an empty directory. | 173 // It assumes the given url points an empty directory. |
169 virtual PlatformFileError DeleteSingleDirectory( | 174 virtual PlatformFileError DeleteSingleDirectory( |
170 FileSystemOperationContext* context, | 175 FileSystemOperationContext* context, |
171 const FileSystemURL& url) = 0; | 176 const FileSystemURL& url) = 0; |
172 | 177 |
| 178 // Creates a local snapshot file for a given |url| and returns the |
| 179 // metadata and platform path of the snapshot file via |callback|. |
| 180 // In regular filesystem cases the implementation may simply return |
| 181 // the metadata of the file itself (as well as GetMetadata does), |
| 182 // while in non-regular filesystem case the backend may create a |
| 183 // temporary snapshot file which holds the file data and return |
| 184 // the metadata of the temporary file. |
| 185 // |
| 186 // |result| is the return code of the operation. |
| 187 // |file_info| is the metadata of the snapshot file created. |
| 188 // |platform_path| is the path to the snapshot file created. |
| 189 // |
| 190 // The implementation can optionally return a file reference |
| 191 // to let the fileapi backend manage the lifetime of the returned |
| 192 // snapshot file. Otherwise it is ok to return NULL. |
| 193 // Please see the comment for ShareableFileReference for details. |
| 194 virtual scoped_refptr<webkit_blob::ShareableFileReference> |
| 195 CreateSnapshotFile(FileSystemOperationContext* context, |
| 196 const FileSystemURL& url, |
| 197 base::PlatformFileError* result, |
| 198 base::PlatformFileInfo* file_info, |
| 199 FilePath* platform_path) = 0; |
| 200 |
173 protected: | 201 protected: |
174 FileSystemFileUtil() {} | 202 FileSystemFileUtil() {} |
175 | 203 |
176 private: | 204 private: |
177 DISALLOW_COPY_AND_ASSIGN(FileSystemFileUtil); | 205 DISALLOW_COPY_AND_ASSIGN(FileSystemFileUtil); |
178 }; | 206 }; |
179 | 207 |
180 } // namespace fileapi | 208 } // namespace fileapi |
181 | 209 |
182 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ | 210 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ |
OLD | NEW |