| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 13 matching lines...) Expand all Loading... |
| 24 namespace net { | 24 namespace net { |
| 25 class URLRequest; | 25 class URLRequest; |
| 26 class URLRequestContext; | 26 class URLRequestContext; |
| 27 } // namespace net | 27 } // namespace net |
| 28 | 28 |
| 29 class GURL; | 29 class GURL; |
| 30 | 30 |
| 31 namespace fileapi { | 31 namespace fileapi { |
| 32 | 32 |
| 33 class FileSystemCallbackDispatcher; | 33 class FileSystemCallbackDispatcher; |
| 34 class FileSystemFileUtilProxy; |
| 34 class FileSystemContext; | 35 class FileSystemContext; |
| 36 class FileSystemOperationContext; |
| 35 class FileWriterDelegate; | 37 class FileWriterDelegate; |
| 36 | 38 |
| 37 // This class is designed to serve one-time file system operation per instance. | 39 // This class is designed to serve one-time file system operation per instance. |
| 38 // Only one method(CreateFile, CreateDirectory, Copy, Move, DirectoryExists, | 40 // Only one method(CreateFile, CreateDirectory, Copy, Move, DirectoryExists, |
| 39 // GetMetadata, ReadDirectory and Remove) may be called during the lifetime of | 41 // GetMetadata, ReadDirectory and Remove) may be called during the lifetime of |
| 40 // this object and it should be called no more than once. | 42 // this object and it should be called no more than once. |
| 41 // This class is self-destructed and an instance automatically gets deleted | 43 // This class is self-destructed and an instance automatically gets deleted |
| 42 // when its operation is finished. | 44 // when its operation is finished. |
| 43 class FileSystemOperation { | 45 class FileSystemOperation { |
| 44 public: | 46 public: |
| 45 // |dispatcher| will be owned by this class. | 47 // |dispatcher| will be owned by this class. |
| 46 FileSystemOperation(FileSystemCallbackDispatcher* dispatcher, | 48 FileSystemOperation(FileSystemCallbackDispatcher* dispatcher, |
| 47 scoped_refptr<base::MessageLoopProxy> proxy, | 49 scoped_refptr<base::MessageLoopProxy> proxy, |
| 48 FileSystemContext* file_system_context); | 50 FileSystemContext* file_system_context); |
| 49 virtual ~FileSystemOperation(); | 51 virtual ~FileSystemOperation(); |
| 50 | 52 |
| 51 void OpenFileSystem(const GURL& origin_url, | 53 void OpenFileSystem(const GURL& origin_url, |
| 52 fileapi::FileSystemType type, | 54 fileapi::FileSystemType type, |
| 53 bool create); | 55 bool create); |
| 54 void CreateFile(const FilePath& path, | 56 void CreateFile(const FilePath& path, |
| 55 bool exclusive); | 57 bool exclusive); |
| 56 void CreateDirectory(const FilePath& path, | 58 void CreateDirectory(const FilePath& path, |
| 57 bool exclusive, | 59 bool exclusive, |
| 58 bool recursive); | 60 bool); |
| 59 void Copy(const FilePath& src_path, | 61 void Copy(const FilePath& src_path, |
| 60 const FilePath& dest_path); | 62 const FilePath& dest_path); |
| 61 void Move(const FilePath& src_path, | 63 void Move(const FilePath& src_path, |
| 62 const FilePath& dest_path); | 64 const FilePath& dest_path); |
| 63 void DirectoryExists(const FilePath& path); | 65 void DirectoryExists(const FilePath& path); |
| 64 void FileExists(const FilePath& path); | 66 void FileExists(const FilePath& path); |
| 65 void GetMetadata(const FilePath& path); | 67 void GetMetadata(const FilePath& path); |
| 66 void ReadDirectory(const FilePath& path); | 68 void ReadDirectory(const FilePath& path); |
| 67 void Remove(const FilePath& path, bool recursive); | 69 void Remove(const FilePath& path, bool recursive); |
| 68 void Write(scoped_refptr<net::URLRequestContext> url_request_context, | 70 void Write(scoped_refptr<net::URLRequestContext> url_request_context, |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 // A flag to make sure we call operation only once per instance. | 167 // A flag to make sure we call operation only once per instance. |
| 166 OperationType pending_operation_; | 168 OperationType pending_operation_; |
| 167 #endif | 169 #endif |
| 168 | 170 |
| 169 // Proxy for calling file_util_proxy methods. | 171 // Proxy for calling file_util_proxy methods. |
| 170 scoped_refptr<base::MessageLoopProxy> proxy_; | 172 scoped_refptr<base::MessageLoopProxy> proxy_; |
| 171 | 173 |
| 172 scoped_ptr<FileSystemCallbackDispatcher> dispatcher_; | 174 scoped_ptr<FileSystemCallbackDispatcher> dispatcher_; |
| 173 | 175 |
| 174 scoped_refptr<FileSystemContext> file_system_context_; | 176 scoped_refptr<FileSystemContext> file_system_context_; |
| 177 scoped_ptr<FileSystemOperationContext> file_system_operation_context_; |
| 175 | 178 |
| 176 base::ScopedCallbackFactory<FileSystemOperation> callback_factory_; | 179 base::ScopedCallbackFactory<FileSystemOperation> callback_factory_; |
| 177 | 180 |
| 178 // These are all used only by Write(). | 181 // These are all used only by Write(). |
| 179 friend class FileWriterDelegate; | 182 friend class FileWriterDelegate; |
| 180 scoped_ptr<FileWriterDelegate> file_writer_delegate_; | 183 scoped_ptr<FileWriterDelegate> file_writer_delegate_; |
| 181 scoped_ptr<net::URLRequest> blob_request_; | 184 scoped_ptr<net::URLRequest> blob_request_; |
| 182 scoped_ptr<FileSystemOperation> cancel_operation_; | 185 scoped_ptr<FileSystemOperation> cancel_operation_; |
| 183 | 186 |
| 184 DISALLOW_COPY_AND_ASSIGN(FileSystemOperation); | 187 DISALLOW_COPY_AND_ASSIGN(FileSystemOperation); |
| 185 }; | 188 }; |
| 186 | 189 |
| 187 } // namespace fileapi | 190 } // namespace fileapi |
| 188 | 191 |
| 189 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ | 192 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ |
| OLD | NEW |