| 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" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // | 40 // |
| 41 // DESIGN NOTES | 41 // DESIGN NOTES |
| 42 // | 42 // |
| 43 // This class is designed to | 43 // This class is designed to |
| 44 // | 44 // |
| 45 // 1) Serve one-time file system operation per instance. Only one | 45 // 1) Serve one-time file system operation per instance. Only one |
| 46 // method(CreateFile, CreateDirectory, Copy, Move, DirectoryExists, | 46 // method(CreateFile, CreateDirectory, Copy, Move, DirectoryExists, |
| 47 // GetMetadata, ReadDirectory and Remove) may be called during the | 47 // GetMetadata, ReadDirectory and Remove) may be called during the |
| 48 // lifetime of this object and it should be called no more than once. | 48 // lifetime of this object and it should be called no more than once. |
| 49 // | 49 // |
| 50 // 2) Be self-destructed, or get deleted via base::Owned() after the | 50 // 2) Deliver the results of operations to the client via the callback function |
| 51 // operation finishes and completion callback is called. | |
| 52 // | |
| 53 // 3) Deliver the results of operations to the client via the callback function | |
| 54 // passed as the last parameter of the method. | 51 // passed as the last parameter of the method. |
| 55 // | 52 // |
| 53 // Note that it is valid to delete an operation while it is running. |
| 54 // The callback will NOT be fired if the operation is deleted before |
| 55 // it gets called. |
| 56 class FileSystemOperation { | 56 class FileSystemOperation { |
| 57 public: | 57 public: |
| 58 virtual ~FileSystemOperation() {} | 58 virtual ~FileSystemOperation() {} |
| 59 | 59 |
| 60 // Used for CreateFile(), etc. |result| is the return code of the operation. | 60 // Used for CreateFile(), etc. |result| is the return code of the operation. |
| 61 typedef base::Callback<void(base::PlatformFileError result)> StatusCallback; | 61 typedef base::Callback<void(base::PlatformFileError result)> StatusCallback; |
| 62 | 62 |
| 63 // Used for GetMetadata(). |result| is the return code of the operation, | 63 // Used for GetMetadata(). |result| is the return code of the operation, |
| 64 // |file_info| is the obtained file info, and |platform_path| is the path | 64 // |file_info| is the obtained file info, and |platform_path| is the path |
| 65 // of the file. | 65 // of the file. |
| (...skipping 203 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 |