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