Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: webkit/fileapi/file_system_operation.h

Issue 6604020: Introduce FileSystemFileUtil and -Proxy to decorate base::file_util in webkit/fileapi. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Modified webkit_fileapi.gypi. Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/fileapi/file_system_file_util_proxy.cc ('k') | webkit/fileapi/file_system_operation.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 unused);
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
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_;
kinuko 2011/03/04 03:15:19 Does this need to be scoped_ptr?
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_
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_file_util_proxy.cc ('k') | webkit/fileapi/file_system_operation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698