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 WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ |
| 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/files/file_util_proxy.h" | 10 #include "base/callback.h" |
| 11 #include "base/files/file_path.h" | |
| 11 #include "base/platform_file.h" | 12 #include "base/platform_file.h" |
| 12 #include "base/process.h" | 13 #include "base/process.h" |
| 13 | 14 |
| 14 namespace base { | 15 namespace base { |
| 15 class Time; | 16 class Time; |
| 16 } // namespace base | 17 } // namespace base |
| 17 | 18 |
| 18 namespace net { | 19 namespace net { |
| 19 class URLRequestContext; | 20 class URLRequestContext; |
| 20 } // namespace net | 21 } // namespace net |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 46 // lifetime of this object and it should be called no more than once. | 47 // lifetime of this object and it should be called no more than once. |
| 47 // | 48 // |
| 48 // 2) Be self-destructed, or get deleted via base::Owned() after the | 49 // 2) Be self-destructed, or get deleted via base::Owned() after the |
| 49 // operation finishes and completion callback is called. | 50 // operation finishes and completion callback is called. |
| 50 // | 51 // |
| 51 // 3) Deliver the results of operations to the client via the callback function | 52 // 3) Deliver the results of operations to the client via the callback function |
| 52 // passed as the last parameter of the method. | 53 // passed as the last parameter of the method. |
| 53 // | 54 // |
| 54 class FileSystemOperation { | 55 class FileSystemOperation { |
| 55 public: | 56 public: |
| 57 // Holds metadata for file or directory entry. | |
|
kinuko
2013/05/17 02:04:03
Oops, hiroki, I found this struct is used througho
nhiroki
2013/05/17 06:12:53
Done.
| |
| 58 struct Entry { | |
| 59 base::FilePath::StringType name; | |
| 60 bool is_directory; | |
| 61 int64 size; | |
| 62 base::Time last_modified_time; | |
| 63 }; | |
| 64 | |
| 56 virtual ~FileSystemOperation() {} | 65 virtual ~FileSystemOperation() {} |
| 57 | 66 |
| 58 // Used for CreateFile(), etc. |result| is the return code of the operation. | 67 // Used for CreateFile(), etc. |result| is the return code of the operation. |
| 59 typedef base::Callback<void(base::PlatformFileError result)> StatusCallback; | 68 typedef base::Callback<void(base::PlatformFileError result)> StatusCallback; |
| 60 | 69 |
| 61 // Used for GetMetadata(). |result| is the return code of the operation, | 70 // Used for GetMetadata(). |result| is the return code of the operation, |
| 62 // |file_info| is the obtained file info, and |platform_path| is the path | 71 // |file_info| is the obtained file info, and |platform_path| is the path |
| 63 // of the file. | 72 // of the file. |
| 64 typedef base::Callback< | 73 typedef base::Callback< |
| 65 void(base::PlatformFileError result, | 74 void(base::PlatformFileError result, |
| 66 const base::PlatformFileInfo& file_info, | 75 const base::PlatformFileInfo& file_info, |
| 67 const base::FilePath& platform_path)> GetMetadataCallback; | 76 const base::FilePath& platform_path)> GetMetadataCallback; |
| 68 | 77 |
| 69 // Used for OpenFile(). |result| is the return code of the operation. | 78 // Used for OpenFile(). |result| is the return code of the operation. |
| 70 // |on_close_callback| will be called after the file is closed in the child | 79 // |on_close_callback| will be called after the file is closed in the child |
| 71 // process. | 80 // process. |
| 72 typedef base::Callback< | 81 typedef base::Callback< |
| 73 void(base::PlatformFileError result, | 82 void(base::PlatformFileError result, |
| 74 base::PlatformFile file, | 83 base::PlatformFile file, |
| 75 const base::Closure& on_close_callback, | 84 const base::Closure& on_close_callback, |
| 76 base::ProcessHandle peer_handle)> OpenFileCallback; | 85 base::ProcessHandle peer_handle)> OpenFileCallback; |
| 77 | 86 |
| 78 // Used for ReadDirectoryCallback. | 87 // Used for ReadDirectoryCallback. |
| 79 typedef std::vector<base::FileUtilProxy::Entry> FileEntryList; | 88 typedef std::vector<FileSystemOperation::Entry> FileEntryList; |
| 80 | 89 |
| 81 // Used for ReadDirectory(). |result| is the return code of the operation, | 90 // Used for ReadDirectory(). |result| is the return code of the operation, |
| 82 // |file_list| is the list of files read, and |has_more| is true if some files | 91 // |file_list| is the list of files read, and |has_more| is true if some files |
| 83 // are yet to be read. | 92 // are yet to be read. |
| 84 typedef base::Callback< | 93 typedef base::Callback< |
| 85 void(base::PlatformFileError result, | 94 void(base::PlatformFileError result, |
| 86 const FileEntryList& file_list, | 95 const FileEntryList& file_list, |
| 87 bool has_more)> ReadDirectoryCallback; | 96 bool has_more)> ReadDirectoryCallback; |
| 88 | 97 |
| 89 // Used for CreateSnapshotFile(). (Please see the comment at | 98 // Used for CreateSnapshotFile(). (Please see the comment at |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 267 kOperationOpenFile, | 276 kOperationOpenFile, |
| 268 kOperationCloseFile, | 277 kOperationCloseFile, |
| 269 kOperationGetLocalPath, | 278 kOperationGetLocalPath, |
| 270 kOperationCancel, | 279 kOperationCancel, |
| 271 }; | 280 }; |
| 272 }; | 281 }; |
| 273 | 282 |
| 274 } // namespace fileapi | 283 } // namespace fileapi |
| 275 | 284 |
| 276 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ | 285 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ |
| OLD | NEW |