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