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

Unified Diff: webkit/fileapi/file_system_operation.h

Issue 4054003: FileSystem code cleanup 2nd cut - introduce SandboxedFileSystemOperation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 10 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: webkit/fileapi/file_system_operation.h
diff --git a/webkit/fileapi/file_system_operation.h b/webkit/fileapi/file_system_operation.h
index d76513f37ead22a8934f8477192cb9fce0ae8267..01e2da1853c6dbeba2f55494a71137b6ee7f9b27 100644
--- a/webkit/fileapi/file_system_operation.h
+++ b/webkit/fileapi/file_system_operation.h
@@ -37,49 +37,70 @@ class FileSystemOperation {
public:
FileSystemOperation(FileSystemCallbackDispatcher* dispatcher,
scoped_refptr<base::MessageLoopProxy> proxy);
- ~FileSystemOperation();
+ virtual ~FileSystemOperation();
- void CreateFile(const FilePath& path,
- bool exclusive);
+ virtual void CreateFile(const FilePath& path,
+ bool exclusive);
- void CreateDirectory(const FilePath& path,
- bool exclusive,
- bool recursive);
+ virtual void CreateDirectory(const FilePath& path,
+ bool exclusive,
+ bool recursive);
- void Copy(const FilePath& src_path,
- const FilePath& dest_path);
+ virtual void Copy(const FilePath& src_path,
+ const FilePath& dest_path);
- void Move(const FilePath& src_path,
- const FilePath& dest_path);
+ virtual void Move(const FilePath& src_path,
+ const FilePath& dest_path);
- void DirectoryExists(const FilePath& path);
+ virtual void DirectoryExists(const FilePath& path);
- void FileExists(const FilePath& path);
+ virtual void FileExists(const FilePath& path);
- void GetMetadata(const FilePath& path);
+ virtual void GetMetadata(const FilePath& path);
- void ReadDirectory(const FilePath& path);
+ virtual void ReadDirectory(const FilePath& path);
- void Remove(const FilePath& path, bool recursive);
+ virtual void Remove(const FilePath& path, bool recursive);
- void Write(
+ virtual void Write(
scoped_refptr<URLRequestContext> url_request_context,
const FilePath& path, const GURL& blob_url, int64 offset);
- void Truncate(const FilePath& path, int64 length);
+ virtual void Truncate(const FilePath& path, int64 length);
- void TouchFile(const FilePath& path,
+ virtual void TouchFile(const FilePath& path,
const base::Time& last_access_time,
const base::Time& last_modified_time);
// Try to cancel the current operation [we support cancelling write or
// truncate only]. Report failure for the current operation, then tell the
// passed-in operation to report success.
- void Cancel(FileSystemOperation* cancel_operation);
+ virtual void Cancel(FileSystemOperation* cancel_operation);
protected:
- // Proxy for calling file_util_proxy methods.
- scoped_refptr<base::MessageLoopProxy> proxy_;
+#ifndef NDEBUG
+ enum OperationType {
+ kOperationNone,
+ kOperationCreateFile,
+ kOperationCreateDirectory,
+ kOperationCopy,
+ kOperationMove,
+ kOperationDirectoryExists,
+ kOperationFileExists,
+ kOperationGetMetadata,
+ kOperationReadDirectory,
+ kOperationRemove,
+ kOperationWrite,
+ kOperationTruncate,
+ kOperationTouchFile,
+ kOperationCancel,
+ };
+
+ // A flag to make sure we call operation only once per instance.
+ OperationType pending_operation_;
+#endif
+
+ FileSystemCallbackDispatcher* dispatcher() const { return dispatcher_.get(); }
private:
// Callback for CreateFile for |exclusive|=true cases.
@@ -119,7 +140,11 @@ class FileSystemOperation {
base::PassPlatformFile file,
bool created);
+ // Proxy for calling file_util_proxy methods.
+ scoped_refptr<base::MessageLoopProxy> proxy_;
+
scoped_ptr<FileSystemCallbackDispatcher> dispatcher_;
+
base::ScopedCallbackFactory<FileSystemOperation> callback_factory_;
// These are all used only by Write().
@@ -128,28 +153,6 @@ class FileSystemOperation {
scoped_ptr<URLRequest> blob_request_;
FileSystemOperation* cancel_operation_;
-#ifndef NDEBUG
- enum OperationType {
- kOperationNone,
- kOperationCreateFile,
- kOperationCreateDirectory,
- kOperationCopy,
- kOperationMove,
- kOperationDirectoryExists,
- kOperationFileExists,
- kOperationGetMetadata,
- kOperationReadDirectory,
- kOperationRemove,
- kOperationWrite,
- kOperationTruncate,
- kOperationTouchFile,
- kOperationCancel,
- };
-
- // A flag to make sure we call operation only once per instance.
- OperationType pending_operation_;
-#endif
-
DISALLOW_COPY_AND_ASSIGN(FileSystemOperation);
};
« no previous file with comments | « chrome/browser/file_system/file_system_dispatcher_host.cc ('k') | webkit/fileapi/sandboxed_file_system_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698