| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ |
| 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // returned operation ID). | 33 // returned operation ID). |
| 34 class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationRunner | 34 class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationRunner |
| 35 : public base::SupportsWeakPtr<FileSystemOperationRunner> { | 35 : public base::SupportsWeakPtr<FileSystemOperationRunner> { |
| 36 public: | 36 public: |
| 37 typedef FileSystemOperation::GetMetadataCallback GetMetadataCallback; | 37 typedef FileSystemOperation::GetMetadataCallback GetMetadataCallback; |
| 38 typedef FileSystemOperation::ReadDirectoryCallback ReadDirectoryCallback; | 38 typedef FileSystemOperation::ReadDirectoryCallback ReadDirectoryCallback; |
| 39 typedef FileSystemOperation::SnapshotFileCallback SnapshotFileCallback; | 39 typedef FileSystemOperation::SnapshotFileCallback SnapshotFileCallback; |
| 40 typedef FileSystemOperation::StatusCallback StatusCallback; | 40 typedef FileSystemOperation::StatusCallback StatusCallback; |
| 41 typedef FileSystemOperation::WriteCallback WriteCallback; | 41 typedef FileSystemOperation::WriteCallback WriteCallback; |
| 42 typedef FileSystemOperation::OpenFileCallback OpenFileCallback; | 42 typedef FileSystemOperation::OpenFileCallback OpenFileCallback; |
| 43 typedef FileSystemOperation::CopyProgressCallback CopyProgressCallback; |
| 44 typedef FileSystemOperation::CopyFileProgressCallback |
| 45 CopyFileProgressCallback; |
| 43 | 46 |
| 44 typedef int OperationID; | 47 typedef int OperationID; |
| 45 | 48 |
| 46 virtual ~FileSystemOperationRunner(); | 49 virtual ~FileSystemOperationRunner(); |
| 47 | 50 |
| 48 // Cancels all inflight operations. | 51 // Cancels all inflight operations. |
| 49 void Shutdown(); | 52 void Shutdown(); |
| 50 | 53 |
| 51 // Creates a file at |url|. If |exclusive| is true, an error is raised | 54 // Creates a file at |url|. If |exclusive| is true, an error is raised |
| 52 // in case a file is already present at the URL. | 55 // in case a file is already present at the URL. |
| 53 OperationID CreateFile(const FileSystemURL& url, | 56 OperationID CreateFile(const FileSystemURL& url, |
| 54 bool exclusive, | 57 bool exclusive, |
| 55 const StatusCallback& callback); | 58 const StatusCallback& callback); |
| 56 | 59 |
| 57 OperationID CreateDirectory(const FileSystemURL& url, | 60 OperationID CreateDirectory(const FileSystemURL& url, |
| 58 bool exclusive, | 61 bool exclusive, |
| 59 bool recursive, | 62 bool recursive, |
| 60 const StatusCallback& callback); | 63 const StatusCallback& callback); |
| 61 | 64 |
| 62 // Copies a file or directory from |src_url| to |dest_url|. If | 65 // Copies a file or directory from |src_url| to |dest_url|. If |
| 63 // |src_url| is a directory, the contents of |src_url| are copied to | 66 // |src_url| is a directory, the contents of |src_url| are copied to |
| 64 // |dest_url| recursively. A new file or directory is created at | 67 // |dest_url| recursively. A new file or directory is created at |
| 65 // |dest_url| as needed. | 68 // |dest_url| as needed. |
| 66 OperationID Copy(const FileSystemURL& src_url, | 69 OperationID Copy(const FileSystemURL& src_url, |
| 67 const FileSystemURL& dest_url, | 70 const FileSystemURL& dest_url, |
| 71 const CopyProgressCallback& progress_callback, |
| 68 const StatusCallback& callback); | 72 const StatusCallback& callback); |
| 69 | 73 |
| 70 // Moves a file or directory from |src_url| to |dest_url|. A new file | 74 // Moves a file or directory from |src_url| to |dest_url|. A new file |
| 71 // or directory is created at |dest_url| as needed. | 75 // or directory is created at |dest_url| as needed. |
| 72 OperationID Move(const FileSystemURL& src_url, | 76 OperationID Move(const FileSystemURL& src_url, |
| 73 const FileSystemURL& dest_url, | 77 const FileSystemURL& dest_url, |
| 74 const StatusCallback& callback); | 78 const StatusCallback& callback); |
| 75 | 79 |
| 76 // Checks if a directory is present at |url|. | 80 // Checks if a directory is present at |url|. |
| 77 OperationID DirectoryExists(const FileSystemURL& url, | 81 OperationID DirectoryExists(const FileSystemURL& url, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 // - PLATFORM_FILE_ERROR_NOT_FOUND if |src_url| | 191 // - PLATFORM_FILE_ERROR_NOT_FOUND if |src_url| |
| 188 // or the parent directory of |dest_url| does not exist. | 192 // or the parent directory of |dest_url| does not exist. |
| 189 // - PLATFORM_FILE_ERROR_NOT_A_FILE if |src_url| exists but is not a file. | 193 // - PLATFORM_FILE_ERROR_NOT_A_FILE if |src_url| exists but is not a file. |
| 190 // - PLATFORM_FILE_ERROR_INVALID_OPERATION if |dest_url| exists and | 194 // - PLATFORM_FILE_ERROR_INVALID_OPERATION if |dest_url| exists and |
| 191 // is not a file. | 195 // is not a file. |
| 192 // - PLATFORM_FILE_ERROR_FAILED if |dest_url| does not exist and | 196 // - PLATFORM_FILE_ERROR_FAILED if |dest_url| does not exist and |
| 193 // its parent path is a file. | 197 // its parent path is a file. |
| 194 // | 198 // |
| 195 OperationID CopyFileLocal(const FileSystemURL& src_url, | 199 OperationID CopyFileLocal(const FileSystemURL& src_url, |
| 196 const FileSystemURL& dest_url, | 200 const FileSystemURL& dest_url, |
| 201 const CopyFileProgressCallback& progress_callback, |
| 197 const StatusCallback& callback); | 202 const StatusCallback& callback); |
| 198 | 203 |
| 199 // Moves a local file from |src_url| to |dest_url|. | 204 // Moves a local file from |src_url| to |dest_url|. |
| 200 // This must be called for files that belong to the same filesystem | 205 // This must be called for files that belong to the same filesystem |
| 201 // (i.e. type() and origin() of the |src_url| and |dest_url| must match). | 206 // (i.e. type() and origin() of the |src_url| and |dest_url| must match). |
| 202 // | 207 // |
| 203 // This returns: | 208 // This returns: |
| 204 // - PLATFORM_FILE_ERROR_NOT_FOUND if |src_url| | 209 // - PLATFORM_FILE_ERROR_NOT_FOUND if |src_url| |
| 205 // or the parent directory of |dest_url| does not exist. | 210 // or the parent directory of |dest_url| does not exist. |
| 206 // - PLATFORM_FILE_ERROR_NOT_A_FILE if |src_url| exists but is not a file. | 211 // - PLATFORM_FILE_ERROR_NOT_A_FILE if |src_url| exists but is not a file. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 294 |
| 290 // Callbacks for stray cancels whose target operation is already finished. | 295 // Callbacks for stray cancels whose target operation is already finished. |
| 291 std::map<OperationID, StatusCallback> stray_cancel_callbacks_; | 296 std::map<OperationID, StatusCallback> stray_cancel_callbacks_; |
| 292 | 297 |
| 293 DISALLOW_COPY_AND_ASSIGN(FileSystemOperationRunner); | 298 DISALLOW_COPY_AND_ASSIGN(FileSystemOperationRunner); |
| 294 }; | 299 }; |
| 295 | 300 |
| 296 } // namespace fileapi | 301 } // namespace fileapi |
| 297 | 302 |
| 298 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ | 303 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ |
| OLD | NEW |