summaryrefslogtreecommitdiffstats
path: root/webkit/fileapi/file_system_operation.h
diff options
context:
space:
mode:
authorkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-10 00:02:31 +0000
committerkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-10 00:02:31 +0000
commit7257f2bf72f4b9ccec1c94d3d67f9bb2f7dd5e97 (patch)
tree60559748d741157e6a674f1785ceed123208547d /webkit/fileapi/file_system_operation.h
parent21dc604db6a9cf07d5277e755df77629352334af (diff)
downloadchromium_src-7257f2bf72f4b9ccec1c94d3d67f9bb2f7dd5e97.zip
chromium_src-7257f2bf72f4b9ccec1c94d3d67f9bb2f7dd5e97.tar.gz
chromium_src-7257f2bf72f4b9ccec1c94d3d67f9bb2f7dd5e97.tar.bz2
FileSystem code cleanup 2nd cut - introduce SandboxedFileSystemOperation
1. Introduced SandboxedFileSystemOperation. 2. Factored out most of the PathManager/QuotaManager related code from FileSystemDispatcherHost to the SandboxedFileSystemOperation. BUG=60243 TEST=none Review URL: http://codereview.chromium.org/4054003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65598 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/file_system_operation.h')
-rw-r--r--webkit/fileapi/file_system_operation.h89
1 files changed, 46 insertions, 43 deletions
diff --git a/webkit/fileapi/file_system_operation.h b/webkit/fileapi/file_system_operation.h
index d76513f..01e2da1 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);
};