| 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_IMPL_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_IMPL_H_ |
| 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_IMPL_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_IMPL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 const StatusCallback& callback) OVERRIDE; | 83 const StatusCallback& callback) OVERRIDE; |
| 84 virtual void CopyFileLocal(const FileSystemURL& src_url, | 84 virtual void CopyFileLocal(const FileSystemURL& src_url, |
| 85 const FileSystemURL& dest_url, | 85 const FileSystemURL& dest_url, |
| 86 CopyOrMoveOption option, | 86 CopyOrMoveOption option, |
| 87 const CopyFileProgressCallback& progress_callback, | 87 const CopyFileProgressCallback& progress_callback, |
| 88 const StatusCallback& callback) OVERRIDE; | 88 const StatusCallback& callback) OVERRIDE; |
| 89 virtual void MoveFileLocal(const FileSystemURL& src_url, | 89 virtual void MoveFileLocal(const FileSystemURL& src_url, |
| 90 const FileSystemURL& dest_url, | 90 const FileSystemURL& dest_url, |
| 91 CopyOrMoveOption option, | 91 CopyOrMoveOption option, |
| 92 const StatusCallback& callback) OVERRIDE; | 92 const StatusCallback& callback) OVERRIDE; |
| 93 virtual base::PlatformFileError SyncGetPlatformPath( | 93 virtual base::File::Error SyncGetPlatformPath( |
| 94 const FileSystemURL& url, | 94 const FileSystemURL& url, |
| 95 base::FilePath* platform_path) OVERRIDE; | 95 base::FilePath* platform_path) OVERRIDE; |
| 96 | 96 |
| 97 FileSystemContext* file_system_context() const { | 97 FileSystemContext* file_system_context() const { |
| 98 return file_system_context_.get(); | 98 return file_system_context_.get(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 private: | 101 private: |
| 102 friend class FileSystemOperation; | 102 friend class FileSystemOperation; |
| 103 | 103 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 void DoCopyInForeignFile(const base::FilePath& src_local_disk_file_path, | 144 void DoCopyInForeignFile(const base::FilePath& src_local_disk_file_path, |
| 145 const FileSystemURL& dest, | 145 const FileSystemURL& dest, |
| 146 const StatusCallback& callback); | 146 const StatusCallback& callback); |
| 147 void DoTruncate(const FileSystemURL& url, | 147 void DoTruncate(const FileSystemURL& url, |
| 148 const StatusCallback& callback, int64 length); | 148 const StatusCallback& callback, int64 length); |
| 149 void DoOpenFile(const FileSystemURL& url, | 149 void DoOpenFile(const FileSystemURL& url, |
| 150 const OpenFileCallback& callback, int file_flags); | 150 const OpenFileCallback& callback, int file_flags); |
| 151 | 151 |
| 152 // Callback for CreateFile for |exclusive|=true cases. | 152 // Callback for CreateFile for |exclusive|=true cases. |
| 153 void DidEnsureFileExistsExclusive(const StatusCallback& callback, | 153 void DidEnsureFileExistsExclusive(const StatusCallback& callback, |
| 154 base::PlatformFileError rv, | 154 base::File::Error rv, |
| 155 bool created); | 155 bool created); |
| 156 | 156 |
| 157 // Callback for CreateFile for |exclusive|=false cases. | 157 // Callback for CreateFile for |exclusive|=false cases. |
| 158 void DidEnsureFileExistsNonExclusive(const StatusCallback& callback, | 158 void DidEnsureFileExistsNonExclusive(const StatusCallback& callback, |
| 159 base::PlatformFileError rv, | 159 base::File::Error rv, |
| 160 bool created); | 160 bool created); |
| 161 | 161 |
| 162 void DidFinishOperation(const StatusCallback& callback, | 162 void DidFinishOperation(const StatusCallback& callback, |
| 163 base::PlatformFileError rv); | 163 base::File::Error rv); |
| 164 void DidDirectoryExists(const StatusCallback& callback, | 164 void DidDirectoryExists(const StatusCallback& callback, |
| 165 base::PlatformFileError rv, | 165 base::File::Error rv, |
| 166 const base::PlatformFileInfo& file_info); | 166 const base::File::Info& file_info); |
| 167 void DidFileExists(const StatusCallback& callback, | 167 void DidFileExists(const StatusCallback& callback, |
| 168 base::PlatformFileError rv, | 168 base::File::Error rv, |
| 169 const base::PlatformFileInfo& file_info); | 169 const base::File::Info& file_info); |
| 170 void DidDeleteRecursively(const FileSystemURL& url, | 170 void DidDeleteRecursively(const FileSystemURL& url, |
| 171 const StatusCallback& callback, | 171 const StatusCallback& callback, |
| 172 base::PlatformFileError rv); | 172 base::File::Error rv); |
| 173 void DidWrite(const FileSystemURL& url, | 173 void DidWrite(const FileSystemURL& url, |
| 174 const WriteCallback& callback, | 174 const WriteCallback& callback, |
| 175 base::PlatformFileError rv, | 175 base::File::Error rv, |
| 176 int64 bytes, | 176 int64 bytes, |
| 177 FileWriterDelegate::WriteProgressStatus write_status); | 177 FileWriterDelegate::WriteProgressStatus write_status); |
| 178 void DidOpenFile(const OpenFileCallback& callback, | 178 void DidOpenFile(const OpenFileCallback& callback, |
| 179 base::PlatformFileError rv, | 179 base::File::Error rv, |
| 180 base::PassPlatformFile file, | 180 base::PassPlatformFile file, |
| 181 const base::Closure& on_close_callback); | 181 const base::Closure& on_close_callback); |
| 182 | 182 |
| 183 // Used only for internal assertions. | 183 // Used only for internal assertions. |
| 184 // Returns false if there's another inflight pending operation. | 184 // Returns false if there's another inflight pending operation. |
| 185 bool SetPendingOperationType(OperationType type); | 185 bool SetPendingOperationType(OperationType type); |
| 186 | 186 |
| 187 scoped_refptr<FileSystemContext> file_system_context_; | 187 scoped_refptr<FileSystemContext> file_system_context_; |
| 188 | 188 |
| 189 scoped_ptr<FileSystemOperationContext> operation_context_; | 189 scoped_ptr<FileSystemOperationContext> operation_context_; |
| 190 AsyncFileUtil* async_file_util_; // Not owned. | 190 AsyncFileUtil* async_file_util_; // Not owned. |
| 191 | 191 |
| 192 scoped_ptr<FileWriterDelegate> file_writer_delegate_; | 192 scoped_ptr<FileWriterDelegate> file_writer_delegate_; |
| 193 scoped_ptr<RecursiveOperationDelegate> recursive_operation_delegate_; | 193 scoped_ptr<RecursiveOperationDelegate> recursive_operation_delegate_; |
| 194 | 194 |
| 195 StatusCallback cancel_callback_; | 195 StatusCallback cancel_callback_; |
| 196 | 196 |
| 197 // A flag to make sure we call operation only once per instance. | 197 // A flag to make sure we call operation only once per instance. |
| 198 OperationType pending_operation_; | 198 OperationType pending_operation_; |
| 199 | 199 |
| 200 base::WeakPtrFactory<FileSystemOperationImpl> weak_factory_; | 200 base::WeakPtrFactory<FileSystemOperationImpl> weak_factory_; |
| 201 | 201 |
| 202 DISALLOW_COPY_AND_ASSIGN(FileSystemOperationImpl); | 202 DISALLOW_COPY_AND_ASSIGN(FileSystemOperationImpl); |
| 203 }; | 203 }; |
| 204 | 204 |
| 205 } // namespace fileapi | 205 } // namespace fileapi |
| 206 | 206 |
| 207 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_IMPL_H_ | 207 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_IMPL_H_ |
| OLD | NEW |