| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 void DirectoryExists(const FilePath& path); | 54 void DirectoryExists(const FilePath& path); |
| 55 | 55 |
| 56 void FileExists(const FilePath& path); | 56 void FileExists(const FilePath& path); |
| 57 | 57 |
| 58 void GetMetadata(const FilePath& path); | 58 void GetMetadata(const FilePath& path); |
| 59 | 59 |
| 60 void ReadDirectory(const FilePath& path); | 60 void ReadDirectory(const FilePath& path); |
| 61 | 61 |
| 62 void Remove(const FilePath& path); | 62 void Remove(const FilePath& path); |
| 63 | 63 |
| 64 void Write( | 64 void Write(const FilePath& path, const GURL& blob_url, int64 offset); |
| 65 const FilePath& path, const GURL& blob_url, int64 offset); | |
| 66 | 65 |
| 67 void Truncate(const FilePath& path, int64 length); | 66 void Truncate(const FilePath& path, int64 length); |
| 68 | 67 |
| 69 void TouchFile(const FilePath& path, | 68 void TouchFile(const FilePath& path, |
| 70 const base::Time& last_access_time, | 69 const base::Time& last_access_time, |
| 71 const base::Time& last_modified_time); | 70 const base::Time& last_modified_time); |
| 72 | 71 |
| 73 // Used to attempt to cancel the current operation. This currently does | 72 // Try to cancel the current operation [we support cancelling write or |
| 74 // nothing for any operation other than Write(). | 73 // truncate only]. Report failure for the current operation, then tell the |
| 75 void Cancel(); | 74 // passed-in operation to report success. |
| 75 void Cancel(FileSystemOperation* cancel_operation); |
| 76 | 76 |
| 77 protected: | 77 protected: |
| 78 // Proxy for calling file_util_proxy methods. | 78 // Proxy for calling file_util_proxy methods. |
| 79 scoped_refptr<base::MessageLoopProxy> proxy_; | 79 scoped_refptr<base::MessageLoopProxy> proxy_; |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 // Callbacks for above methods. | 82 // Callbacks for above methods. |
| 83 void DidCreateFileExclusive( | 83 void DidCreateFileExclusive( |
| 84 base::PlatformFileError rv, base::PassPlatformFile file, bool created); | 84 base::PlatformFileError rv, base::PassPlatformFile file, bool created); |
| 85 | 85 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 107 base::PlatformFileError rv, | 107 base::PlatformFileError rv, |
| 108 int64 bytes, | 108 int64 bytes, |
| 109 bool complete); | 109 bool complete); |
| 110 | 110 |
| 111 void DidTouchFile(base::PlatformFileError rv); | 111 void DidTouchFile(base::PlatformFileError rv); |
| 112 | 112 |
| 113 scoped_ptr<FileSystemCallbackDispatcher> dispatcher_; | 113 scoped_ptr<FileSystemCallbackDispatcher> dispatcher_; |
| 114 | 114 |
| 115 base::ScopedCallbackFactory<FileSystemOperation> callback_factory_; | 115 base::ScopedCallbackFactory<FileSystemOperation> callback_factory_; |
| 116 | 116 |
| 117 FileSystemOperation* cancel_operation_; |
| 118 |
| 117 #ifndef NDEBUG | 119 #ifndef NDEBUG |
| 120 enum OperationType { |
| 121 kOperationNone, |
| 122 kOperationCreateFile, |
| 123 kOperationCreateDirectory, |
| 124 kOperationCopy, |
| 125 kOperationMove, |
| 126 kOperationDirectoryExists, |
| 127 kOperationFileExists, |
| 128 kOperationGetMetadata, |
| 129 kOperationReadDirectory, |
| 130 kOperationRemove, |
| 131 kOperationWrite, |
| 132 kOperationTruncate, |
| 133 kOperationTouchFile, |
| 134 kOperationCancel, |
| 135 }; |
| 136 |
| 118 // A flag to make sure we call operation only once per instance. | 137 // A flag to make sure we call operation only once per instance. |
| 119 bool operation_pending_; | 138 OperationType pending_operation_; |
| 120 #endif | 139 #endif |
| 121 | 140 |
| 122 DISALLOW_COPY_AND_ASSIGN(FileSystemOperation); | 141 DISALLOW_COPY_AND_ASSIGN(FileSystemOperation); |
| 123 }; | 142 }; |
| 124 | 143 |
| 125 } // namespace fileapi | 144 } // namespace fileapi |
| 126 | 145 |
| 127 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ | 146 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ |
| OLD | NEW |