Chromium Code Reviews| 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 STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_H_ | 5 #ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_H_ |
| 6 #define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_H_ | 6 #define STORAGE_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" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 | 65 |
| 66 virtual ~FileSystemOperation() {} | 66 virtual ~FileSystemOperation() {} |
| 67 | 67 |
| 68 // Used for CreateFile(), etc. |result| is the return code of the operation. | 68 // Used for CreateFile(), etc. |result| is the return code of the operation. |
| 69 typedef base::Callback<void(base::File::Error result)> StatusCallback; | 69 typedef base::Callback<void(base::File::Error result)> StatusCallback; |
| 70 | 70 |
| 71 // Called when an error had happened during operation. | 71 // Called when an error had happened during operation. |
| 72 // |url| is the url of processed entry. | 72 // |url| is the url of processed entry. |
| 73 // |error| is the error code of the failed operation. | 73 // |error| is the error code of the failed operation. |
| 74 typedef base::Callback<void(const FileSystemURL& url, | 74 typedef base::Callback<void(const FileSystemURL& url, |
| 75 base::File::Error error)> ErrorCallback; | 75 base::File::Error error)> ErrorCallback; |
|
yawano
2015/06/19 06:50:16
@tzik: While I added this in http://crrev.com/1184
| |
| 76 | 76 |
| 77 // Called when an error had happened during copy operation. | |
| 78 // |error| is the error code of the failed copy operation. | |
| 79 // |source_url| is the url of source file. | |
| 80 // |destination_url| is the url of destination file. | |
| 81 // | |
| 82 // An error can be happened during a recursive operation. The urls of children | |
| 83 // files or directories are set to source_url and destination_url. | |
| 84 typedef base::Callback<void(base::File::Error error, | |
| 85 const FileSystemURL& source_url, | |
| 86 const FileSystemURL& destination_url)> | |
| 87 CopyOrMoveErrorCallback; | |
| 88 | |
| 77 // Used for GetMetadata(). |result| is the return code of the operation, | 89 // Used for GetMetadata(). |result| is the return code of the operation, |
| 78 // |file_info| is the obtained file info. | 90 // |file_info| is the obtained file info. |
| 79 typedef base::Callback< | 91 typedef base::Callback< |
| 80 void(base::File::Error result, | 92 void(base::File::Error result, |
| 81 const base::File::Info& file_info)> GetMetadataCallback; | 93 const base::File::Info& file_info)> GetMetadataCallback; |
| 82 | 94 |
| 83 // Used for OpenFile(). |on_close_callback| will be called after the file is | 95 // Used for OpenFile(). |on_close_callback| will be called after the file is |
| 84 // closed in the child process. It can be null, if no operation is needed on | 96 // closed in the child process. It can be null, if no operation is needed on |
| 85 // closing a file. | 97 // closing a file. |
| 86 typedef base::Callback< | 98 typedef base::Callback< |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 bool exclusive, | 256 bool exclusive, |
| 245 bool recursive, | 257 bool recursive, |
| 246 const StatusCallback& callback) = 0; | 258 const StatusCallback& callback) = 0; |
| 247 | 259 |
| 248 // Copies a file or directory from |src_path| to |dest_path|. If | 260 // Copies a file or directory from |src_path| to |dest_path|. If |
| 249 // |src_path| is a directory, the contents of |src_path| are copied to | 261 // |src_path| is a directory, the contents of |src_path| are copied to |
| 250 // |dest_path| recursively. A new file or directory is created at | 262 // |dest_path| recursively. A new file or directory is created at |
| 251 // |dest_path| as needed. | 263 // |dest_path| as needed. |
| 252 // |option| specifies the minor behavior of Copy(). See CopyOrMoveOption's | 264 // |option| specifies the minor behavior of Copy(). See CopyOrMoveOption's |
| 253 // comment for details. | 265 // comment for details. |
| 266 // |continue_with_error| is whether it continues copy operation even when it | |
| 267 // fails to copy one of the files. | |
| 268 // |error_callback| is called when an error had happened during the operation. | |
| 254 // |progress_callback| is periodically called to report the progress | 269 // |progress_callback| is periodically called to report the progress |
| 255 // update. See also the comment of CopyProgressCallback. This callback is | 270 // update. See also the comment of CopyProgressCallback. This callback is |
| 256 // optional. | 271 // optional. |
| 257 // | 272 // |
| 258 // For recursive case this internally creates new FileSystemOperations and | 273 // For recursive case this internally creates new FileSystemOperations and |
| 259 // calls: | 274 // calls: |
| 260 // - ReadDirectory, CopyFileLocal and CreateDirectory | 275 // - ReadDirectory, CopyFileLocal and CreateDirectory |
| 261 // for same-filesystem case, or | 276 // for same-filesystem case, or |
| 262 // - ReadDirectory and CreateSnapshotFile on source filesystem and | 277 // - ReadDirectory and CreateSnapshotFile on source filesystem and |
| 263 // CopyInForeignFile and CreateDirectory on dest filesystem | 278 // CopyInForeignFile and CreateDirectory on dest filesystem |
| 264 // for cross-filesystem case. | 279 // for cross-filesystem case. |
| 265 // | 280 // |
| 266 virtual void Copy(const FileSystemURL& src_path, | 281 virtual void Copy(const FileSystemURL& src_path, |
| 267 const FileSystemURL& dest_path, | 282 const FileSystemURL& dest_path, |
| 268 CopyOrMoveOption option, | 283 CopyOrMoveOption option, |
| 284 const bool continue_with_error, | |
| 285 const CopyOrMoveErrorCallback& error_callback, | |
| 269 const CopyProgressCallback& progress_callback, | 286 const CopyProgressCallback& progress_callback, |
| 270 const StatusCallback& callback) = 0; | 287 const StatusCallback& callback) = 0; |
| 271 | 288 |
| 272 // Moves a file or directory from |src_path| to |dest_path|. A new file | 289 // Moves a file or directory from |src_path| to |dest_path|. A new file |
| 273 // or directory is created at |dest_path| as needed. | 290 // or directory is created at |dest_path| as needed. |
| 274 // |option| specifies the minor behavior of Copy(). See CopyOrMoveOption's | 291 // |option| specifies the minor behavior of Copy(). See CopyOrMoveOption's |
| 275 // comment for details. | 292 // comment for details. |
| 276 // | 293 // |
| 277 // For recursive case this internally creates new FileSystemOperations and | 294 // For recursive case this internally creates new FileSystemOperations and |
| 278 // calls: | 295 // calls: |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 482 kOperationOpenFile, | 499 kOperationOpenFile, |
| 483 kOperationCloseFile, | 500 kOperationCloseFile, |
| 484 kOperationGetLocalPath, | 501 kOperationGetLocalPath, |
| 485 kOperationCancel, | 502 kOperationCancel, |
| 486 }; | 503 }; |
| 487 }; | 504 }; |
| 488 | 505 |
| 489 } // namespace storage | 506 } // namespace storage |
| 490 | 507 |
| 491 #endif // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_H_ | 508 #endif // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_H_ |
| OLD | NEW |