| 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_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_H_ |
| 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/platform_file.h" | 12 #include "base/platform_file.h" |
| 13 #include "base/process.h" | 13 #include "base/process.h" |
| 14 #include "webkit/common/fileapi/directory_entry.h" | 14 #include "webkit/common/fileapi/directory_entry.h" |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class Time; | 17 class Time; |
| 18 } // namespace base | 18 } |
| 19 | 19 |
| 20 namespace net { | 20 namespace net { |
| 21 class URLRequestContext; | 21 class URLRequest; |
| 22 } // namespace net | 22 } |
| 23 | 23 |
| 24 namespace webkit_blob { | 24 namespace webkit_blob { |
| 25 class ShareableFileReference; | 25 class ShareableFileReference; |
| 26 } | 26 } |
| 27 | 27 |
| 28 class GURL; | 28 class GURL; |
| 29 | 29 |
| 30 namespace fileapi { | 30 namespace fileapi { |
| 31 | 31 |
| 32 class FileSystemURL; | 32 class FileSystemURL; |
| 33 class FileWriterDelegate; |
| 33 class LocalFileSystemOperation; | 34 class LocalFileSystemOperation; |
| 34 | 35 |
| 35 // The interface class for FileSystemOperation implementations. | 36 // The interface class for FileSystemOperation implementations. |
| 36 // | 37 // |
| 37 // This interface defines file system operations required to implement | 38 // This interface defines file system operations required to implement |
| 38 // "File API: Directories and System" | 39 // "File API: Directories and System" |
| 39 // http://www.w3.org/TR/file-system-api/ | 40 // http://www.w3.org/TR/file-system-api/ |
| 40 // | 41 // |
| 41 // DESIGN NOTES | 42 // DESIGN NOTES |
| 42 // | 43 // |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 165 |
| 165 // Reads contents of a directory at |path|. | 166 // Reads contents of a directory at |path|. |
| 166 virtual void ReadDirectory(const FileSystemURL& path, | 167 virtual void ReadDirectory(const FileSystemURL& path, |
| 167 const ReadDirectoryCallback& callback) = 0; | 168 const ReadDirectoryCallback& callback) = 0; |
| 168 | 169 |
| 169 // Removes a file or directory at |path|. If |recursive| is true, remove | 170 // Removes a file or directory at |path|. If |recursive| is true, remove |
| 170 // all files and directories under the directory at |path| recursively. | 171 // all files and directories under the directory at |path| recursively. |
| 171 virtual void Remove(const FileSystemURL& path, bool recursive, | 172 virtual void Remove(const FileSystemURL& path, bool recursive, |
| 172 const StatusCallback& callback) = 0; | 173 const StatusCallback& callback) = 0; |
| 173 | 174 |
| 174 // Writes contents of |blob_url| to |path| at |offset|. | 175 // Writes the data read from |blob_request| using |writer_delegate|. |
| 175 // |url_request_context| is used to read contents in |blob_url|. | 176 virtual void Write( |
| 176 virtual void Write(const net::URLRequestContext* url_request_context, | 177 const FileSystemURL& url, |
| 177 const FileSystemURL& path, | 178 scoped_ptr<FileWriterDelegate> writer_delegate, |
| 178 const GURL& blob_url, | 179 scoped_ptr<net::URLRequest> blob_request, |
| 179 int64 offset, | 180 const WriteCallback& callback) = 0; |
| 180 const WriteCallback& callback) = 0; | |
| 181 | 181 |
| 182 // Truncates a file at |path| to |length|. If |length| is larger than | 182 // Truncates a file at |path| to |length|. If |length| is larger than |
| 183 // the original file size, the file will be extended, and the extended | 183 // the original file size, the file will be extended, and the extended |
| 184 // part is filled with null bytes. | 184 // part is filled with null bytes. |
| 185 virtual void Truncate(const FileSystemURL& path, int64 length, | 185 virtual void Truncate(const FileSystemURL& path, int64 length, |
| 186 const StatusCallback& callback) = 0; | 186 const StatusCallback& callback) = 0; |
| 187 | 187 |
| 188 // Tries to cancel the current operation [we support cancelling write or | 188 // Tries to cancel the current operation [we support cancelling write or |
| 189 // truncate only]. Reports failure for the current operation, then reports | 189 // truncate only]. Reports failure for the current operation, then reports |
| 190 // success for the cancel operation itself via the |cancel_dispatcher|. | 190 // success for the cancel operation itself via the |cancel_dispatcher|. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 kOperationOpenFile, | 269 kOperationOpenFile, |
| 270 kOperationCloseFile, | 270 kOperationCloseFile, |
| 271 kOperationGetLocalPath, | 271 kOperationGetLocalPath, |
| 272 kOperationCancel, | 272 kOperationCancel, |
| 273 }; | 273 }; |
| 274 }; | 274 }; |
| 275 | 275 |
| 276 } // namespace fileapi | 276 } // namespace fileapi |
| 277 | 277 |
| 278 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_H_ | 278 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_H_ |
| OLD | NEW |