| 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_LOCAL_FILE_SYSTEM_OPERATION_H_ | 5 #ifndef WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_OPERATION_H_ |
| 6 #define WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_OPERATION_H_ | 6 #define WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_OPERATION_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // Copies in a single file from a different filesystem. | 84 // Copies in a single file from a different filesystem. |
| 85 // | 85 // |
| 86 // This returns: | 86 // This returns: |
| 87 // - PLATFORM_FILE_ERROR_NOT_FOUND if |src_file_path| | 87 // - PLATFORM_FILE_ERROR_NOT_FOUND if |src_file_path| |
| 88 // or the parent directory of |dest_url| does not exist. | 88 // or the parent directory of |dest_url| does not exist. |
| 89 // - PLATFORM_FILE_ERROR_INVALID_OPERATION if |dest_url| exists and | 89 // - PLATFORM_FILE_ERROR_INVALID_OPERATION if |dest_url| exists and |
| 90 // is not a file. | 90 // is not a file. |
| 91 // - PLATFORM_FILE_ERROR_FAILED if |dest_url| does not exist and | 91 // - PLATFORM_FILE_ERROR_FAILED if |dest_url| does not exist and |
| 92 // its parent path is a file. | 92 // its parent path is a file. |
| 93 // | 93 // |
| 94 void CopyInForeignFile(const FilePath& src_local_disk_path, | 94 void CopyInForeignFile(const base::FilePath& src_local_disk_path, |
| 95 const FileSystemURL& dest_url, | 95 const FileSystemURL& dest_url, |
| 96 const StatusCallback& callback); | 96 const StatusCallback& callback); |
| 97 | 97 |
| 98 // Removes a single file. | 98 // Removes a single file. |
| 99 // | 99 // |
| 100 // This returns: | 100 // This returns: |
| 101 // - PLATFORM_FILE_ERROR_NOT_FOUND if |url| does not exist. | 101 // - PLATFORM_FILE_ERROR_NOT_FOUND if |url| does not exist. |
| 102 // - PLATFORM_FILE_ERROR_NOT_A_FILE if |url| is not a file. | 102 // - PLATFORM_FILE_ERROR_NOT_A_FILE if |url| is not a file. |
| 103 // | 103 // |
| 104 void RemoveFile(const FileSystemURL& url, | 104 void RemoveFile(const FileSystemURL& url, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // - PLATFORM_FILE_ERROR_INVALID_OPERATION if |dest_url| exists and | 142 // - PLATFORM_FILE_ERROR_INVALID_OPERATION if |dest_url| exists and |
| 143 // is not a file. | 143 // is not a file. |
| 144 // - PLATFORM_FILE_ERROR_FAILED if |dest_url| does not exist and | 144 // - PLATFORM_FILE_ERROR_FAILED if |dest_url| does not exist and |
| 145 // its parent path is a file. | 145 // its parent path is a file. |
| 146 // | 146 // |
| 147 void MoveFileLocal(const FileSystemURL& src_url, | 147 void MoveFileLocal(const FileSystemURL& src_url, |
| 148 const FileSystemURL& dest_url, | 148 const FileSystemURL& dest_url, |
| 149 const StatusCallback& callback); | 149 const StatusCallback& callback); |
| 150 | 150 |
| 151 // Synchronously gets the platform path for the given |url|. | 151 // Synchronously gets the platform path for the given |url|. |
| 152 void SyncGetPlatformPath(const FileSystemURL& url, FilePath* platform_path); | 152 void SyncGetPlatformPath(const FileSystemURL& url, base::FilePath* platform_pa
th); |
| 153 | 153 |
| 154 private: | 154 private: |
| 155 class ScopedUpdateNotifier; | 155 class ScopedUpdateNotifier; |
| 156 | 156 |
| 157 enum SetUpMode { | 157 enum SetUpMode { |
| 158 SETUP_FOR_READ, | 158 SETUP_FOR_READ, |
| 159 SETUP_FOR_WRITE, | 159 SETUP_FOR_WRITE, |
| 160 SETUP_FOR_CREATE, | 160 SETUP_FOR_CREATE, |
| 161 }; | 161 }; |
| 162 | 162 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 void DoCreateDirectory(const FileSystemURL& url, | 228 void DoCreateDirectory(const FileSystemURL& url, |
| 229 const StatusCallback& callback, | 229 const StatusCallback& callback, |
| 230 bool exclusive, | 230 bool exclusive, |
| 231 bool recursive); | 231 bool recursive); |
| 232 void DoCopyFileLocal(const FileSystemURL& src, | 232 void DoCopyFileLocal(const FileSystemURL& src, |
| 233 const FileSystemURL& dest, | 233 const FileSystemURL& dest, |
| 234 const StatusCallback& callback); | 234 const StatusCallback& callback); |
| 235 void DoMoveFileLocal(const FileSystemURL& src, | 235 void DoMoveFileLocal(const FileSystemURL& src, |
| 236 const FileSystemURL& dest, | 236 const FileSystemURL& dest, |
| 237 const StatusCallback& callback); | 237 const StatusCallback& callback); |
| 238 void DoCopyInForeignFile(const FilePath& src_local_disk_file_path, | 238 void DoCopyInForeignFile(const base::FilePath& src_local_disk_file_path, |
| 239 const FileSystemURL& dest, | 239 const FileSystemURL& dest, |
| 240 const StatusCallback& callback); | 240 const StatusCallback& callback); |
| 241 void DoTruncate(const FileSystemURL& url, | 241 void DoTruncate(const FileSystemURL& url, |
| 242 const StatusCallback& callback, int64 length); | 242 const StatusCallback& callback, int64 length); |
| 243 void DoOpenFile(const FileSystemURL& url, | 243 void DoOpenFile(const FileSystemURL& url, |
| 244 const OpenFileCallback& callback, int file_flags); | 244 const OpenFileCallback& callback, int file_flags); |
| 245 | 245 |
| 246 // Callback for CreateFile for |exclusive|=true cases. | 246 // Callback for CreateFile for |exclusive|=true cases. |
| 247 void DidEnsureFileExistsExclusive(const StatusCallback& callback, | 247 void DidEnsureFileExistsExclusive(const StatusCallback& callback, |
| 248 base::PlatformFileError rv, | 248 base::PlatformFileError rv, |
| 249 bool created); | 249 bool created); |
| 250 | 250 |
| 251 // Callback for CreateFile for |exclusive|=false cases. | 251 // Callback for CreateFile for |exclusive|=false cases. |
| 252 void DidEnsureFileExistsNonExclusive(const StatusCallback& callback, | 252 void DidEnsureFileExistsNonExclusive(const StatusCallback& callback, |
| 253 base::PlatformFileError rv, | 253 base::PlatformFileError rv, |
| 254 bool created); | 254 bool created); |
| 255 | 255 |
| 256 // Generic callback that translates platform errors to WebKit error codes. | 256 // Generic callback that translates platform errors to WebKit error codes. |
| 257 void DidFinishFileOperation(const StatusCallback& callback, | 257 void DidFinishFileOperation(const StatusCallback& callback, |
| 258 base::PlatformFileError rv); | 258 base::PlatformFileError rv); |
| 259 | 259 |
| 260 // Generic callback when we delegated the operation. | 260 // Generic callback when we delegated the operation. |
| 261 void DidFinishDelegatedOperation(const StatusCallback& callback, | 261 void DidFinishDelegatedOperation(const StatusCallback& callback, |
| 262 base::PlatformFileError rv); | 262 base::PlatformFileError rv); |
| 263 | 263 |
| 264 void DidDirectoryExists(const StatusCallback& callback, | 264 void DidDirectoryExists(const StatusCallback& callback, |
| 265 base::PlatformFileError rv, | 265 base::PlatformFileError rv, |
| 266 const base::PlatformFileInfo& file_info, | 266 const base::PlatformFileInfo& file_info, |
| 267 const FilePath& unused); | 267 const base::FilePath& unused); |
| 268 void DidFileExists(const StatusCallback& callback, | 268 void DidFileExists(const StatusCallback& callback, |
| 269 base::PlatformFileError rv, | 269 base::PlatformFileError rv, |
| 270 const base::PlatformFileInfo& file_info, | 270 const base::PlatformFileInfo& file_info, |
| 271 const FilePath& unused); | 271 const base::FilePath& unused); |
| 272 void DidGetMetadata(const GetMetadataCallback& callback, | 272 void DidGetMetadata(const GetMetadataCallback& callback, |
| 273 base::PlatformFileError rv, | 273 base::PlatformFileError rv, |
| 274 const base::PlatformFileInfo& file_info, | 274 const base::PlatformFileInfo& file_info, |
| 275 const FilePath& platform_path); | 275 const base::FilePath& platform_path); |
| 276 void DidReadDirectory(const ReadDirectoryCallback& callback, | 276 void DidReadDirectory(const ReadDirectoryCallback& callback, |
| 277 base::PlatformFileError rv, | 277 base::PlatformFileError rv, |
| 278 const std::vector<base::FileUtilProxy::Entry>& entries, | 278 const std::vector<base::FileUtilProxy::Entry>& entries, |
| 279 bool has_more); | 279 bool has_more); |
| 280 void DidWrite(const FileSystemURL& url, | 280 void DidWrite(const FileSystemURL& url, |
| 281 base::PlatformFileError rv, | 281 base::PlatformFileError rv, |
| 282 int64 bytes, | 282 int64 bytes, |
| 283 FileWriterDelegate::WriteProgressStatus write_status); | 283 FileWriterDelegate::WriteProgressStatus write_status); |
| 284 void DidTouchFile(const StatusCallback& callback, | 284 void DidTouchFile(const StatusCallback& callback, |
| 285 base::PlatformFileError rv); | 285 base::PlatformFileError rv); |
| 286 void DidOpenFile(const OpenFileCallback& callback, | 286 void DidOpenFile(const OpenFileCallback& callback, |
| 287 base::PlatformFileError rv, | 287 base::PlatformFileError rv, |
| 288 base::PassPlatformFile file, | 288 base::PassPlatformFile file, |
| 289 bool created); | 289 bool created); |
| 290 void DidCreateSnapshotFile( | 290 void DidCreateSnapshotFile( |
| 291 const SnapshotFileCallback& callback, | 291 const SnapshotFileCallback& callback, |
| 292 base::PlatformFileError rv, | 292 base::PlatformFileError rv, |
| 293 const base::PlatformFileInfo& file_info, | 293 const base::PlatformFileInfo& file_info, |
| 294 const FilePath& platform_path, | 294 const base::FilePath& platform_path, |
| 295 SnapshotFilePolicy snapshot_policy); | 295 SnapshotFilePolicy snapshot_policy); |
| 296 | 296 |
| 297 // Checks the validity of a given |url| and populates |file_util| for |mode|. | 297 // Checks the validity of a given |url| and populates |file_util| for |mode|. |
| 298 base::PlatformFileError SetUp( | 298 base::PlatformFileError SetUp( |
| 299 const FileSystemURL& url, | 299 const FileSystemURL& url, |
| 300 SetUpMode mode); | 300 SetUpMode mode); |
| 301 | 301 |
| 302 // Used only for internal assertions. | 302 // Used only for internal assertions. |
| 303 // Returns false if there's another inflight pending operation. | 303 // Returns false if there's another inflight pending operation. |
| 304 bool SetPendingOperationType(OperationType type); | 304 bool SetPendingOperationType(OperationType type); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 // LocalFileSystemOperation instance is usually deleted upon completion but | 356 // LocalFileSystemOperation instance is usually deleted upon completion but |
| 357 // could be deleted while it has inflight callbacks when Cancel is called. | 357 // could be deleted while it has inflight callbacks when Cancel is called. |
| 358 base::WeakPtrFactory<LocalFileSystemOperation> weak_factory_; | 358 base::WeakPtrFactory<LocalFileSystemOperation> weak_factory_; |
| 359 | 359 |
| 360 DISALLOW_COPY_AND_ASSIGN(LocalFileSystemOperation); | 360 DISALLOW_COPY_AND_ASSIGN(LocalFileSystemOperation); |
| 361 }; | 361 }; |
| 362 | 362 |
| 363 } // namespace fileapi | 363 } // namespace fileapi |
| 364 | 364 |
| 365 #endif // WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_OPERATION_H_ | 365 #endif // WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_OPERATION_H_ |
| OLD | NEW |