Index: storage/browser/fileapi/async_file_util.h |
diff --git a/webkit/browser/fileapi/async_file_util.h b/storage/browser/fileapi/async_file_util.h |
similarity index 73% |
rename from webkit/browser/fileapi/async_file_util.h |
rename to storage/browser/fileapi/async_file_util.h |
index bde03395c6501aea80177769476323759327b2df..db5502362f7a538820f13bfe5f170c931deb4e9d 100644 |
--- a/webkit/browser/fileapi/async_file_util.h |
+++ b/storage/browser/fileapi/async_file_util.h |
@@ -12,19 +12,19 @@ |
#include "base/files/file.h" |
#include "base/files/file_util_proxy.h" |
#include "base/memory/scoped_ptr.h" |
-#include "webkit/browser/fileapi/file_system_operation.h" |
-#include "webkit/browser/webkit_storage_browser_export.h" |
-#include "webkit/common/fileapi/directory_entry.h" |
+#include "storage/browser/fileapi/file_system_operation.h" |
+#include "storage/common/storage_export.h" |
+#include "storage/common/fileapi/directory_entry.h" |
namespace base { |
class Time; |
} |
-namespace webkit_blob { |
+namespace storage { |
class ShareableFileReference; |
} |
-namespace fileapi { |
+namespace storage { |
class FileSystemOperationContext; |
class FileSystemURL; |
@@ -53,31 +53,28 @@ class AsyncFileUtil { |
// child process. |on_close_callback|.is_null() can be true, if no operation |
// is needed on closing the file. |
typedef base::Callback< |
- void(base::File file, |
- const base::Closure& on_close_callback)> CreateOrOpenCallback; |
+ void(base::File file, const base::Closure& on_close_callback)> |
+ CreateOrOpenCallback; |
- typedef base::Callback< |
- void(base::File::Error result, |
- bool created)> EnsureFileExistsCallback; |
+ typedef base::Callback<void(base::File::Error result, bool created)> |
+ EnsureFileExistsCallback; |
typedef base::Callback< |
- void(base::File::Error result, |
- const base::File::Info& file_info)> GetFileInfoCallback; |
+ void(base::File::Error result, const base::File::Info& file_info)> |
+ GetFileInfoCallback; |
typedef std::vector<DirectoryEntry> EntryList; |
typedef base::Callback< |
- void(base::File::Error result, |
- const EntryList& file_list, |
- bool has_more)> ReadDirectoryCallback; |
+ void(base::File::Error result, const EntryList& file_list, bool has_more)> |
+ ReadDirectoryCallback; |
typedef base::Callback< |
void(base::File::Error result, |
const base::File::Info& file_info, |
const base::FilePath& platform_path, |
- const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref)> |
+ const scoped_refptr<storage::ShareableFileReference>& file_ref)> |
CreateSnapshotFileCallback; |
- |
typedef base::Callback<void(int64 size)> CopyFileProgressCallback; |
typedef FileSystemOperation::CopyOrMoveOption CopyOrMoveOption; |
@@ -85,8 +82,7 @@ class AsyncFileUtil { |
// Creates an AsyncFileUtil instance which performs file operations on |
// local native file system. The created instance assumes |
// FileSystemURL::path() has the target platform path. |
- WEBKIT_STORAGE_BROWSER_EXPORT static AsyncFileUtil* |
- CreateForLocalFileSystem(); |
+ STORAGE_EXPORT static AsyncFileUtil* CreateForLocalFileSystem(); |
AsyncFileUtil() {} |
virtual ~AsyncFileUtil() {} |
@@ -99,11 +95,10 @@ class AsyncFileUtil { |
// FileSystemOperationImpl::OpenFile calls this. |
// This is used only by Pepper/NaCl File API. |
// |
- virtual void CreateOrOpen( |
- scoped_ptr<FileSystemOperationContext> context, |
- const FileSystemURL& url, |
- int file_flags, |
- const CreateOrOpenCallback& callback) = 0; |
+ virtual void CreateOrOpen(scoped_ptr<FileSystemOperationContext> context, |
+ const FileSystemURL& url, |
+ int file_flags, |
+ const CreateOrOpenCallback& callback) = 0; |
// Ensures that the given |url| exist. This creates a empty new file |
// at |url| if the |url| does not exist. |
@@ -117,10 +112,9 @@ class AsyncFileUtil { |
// - Other error code (with created=false) if a file hasn't existed yet |
// and there was an error while creating a new file. |
// |
- virtual void EnsureFileExists( |
- scoped_ptr<FileSystemOperationContext> context, |
- const FileSystemURL& url, |
- const EnsureFileExistsCallback& callback) = 0; |
+ virtual void EnsureFileExists(scoped_ptr<FileSystemOperationContext> context, |
+ const FileSystemURL& url, |
+ const EnsureFileExistsCallback& callback) = 0; |
// Creates directory at given url. |
// |
@@ -135,12 +129,11 @@ class AsyncFileUtil { |
// (regardless of |exclusive| value). |
// - Other error code if it failed to create a directory. |
// |
- virtual void CreateDirectory( |
- scoped_ptr<FileSystemOperationContext> context, |
- const FileSystemURL& url, |
- bool exclusive, |
- bool recursive, |
- const StatusCallback& callback) = 0; |
+ virtual void CreateDirectory(scoped_ptr<FileSystemOperationContext> context, |
+ const FileSystemURL& url, |
+ bool exclusive, |
+ bool recursive, |
+ const StatusCallback& callback) = 0; |
// Retrieves the information about a file. |
// |
@@ -150,10 +143,9 @@ class AsyncFileUtil { |
// - File::FILE_ERROR_NOT_FOUND if the file doesn't exist. |
// - Other error code if there was an error while retrieving the file info. |
// |
- virtual void GetFileInfo( |
- scoped_ptr<FileSystemOperationContext> context, |
- const FileSystemURL& url, |
- const GetFileInfoCallback& callback) = 0; |
+ virtual void GetFileInfo(scoped_ptr<FileSystemOperationContext> context, |
+ const FileSystemURL& url, |
+ const GetFileInfoCallback& callback) = 0; |
// Reads contents of a directory at |path|. |
// |
@@ -173,10 +165,9 @@ class AsyncFileUtil { |
// - File::FILE_ERROR_NOT_A_DIRECTORY if an entry exists at |url| but |
// is a file (not a directory). |
// |
- virtual void ReadDirectory( |
- scoped_ptr<FileSystemOperationContext> context, |
- const FileSystemURL& url, |
- const ReadDirectoryCallback& callback) = 0; |
+ virtual void ReadDirectory(scoped_ptr<FileSystemOperationContext> context, |
+ const FileSystemURL& url, |
+ const ReadDirectoryCallback& callback) = 0; |
// Modifies timestamps of a file or directory at |url| with |
// |last_access_time| and |last_modified_time|. The function DOES NOT |
@@ -185,12 +176,11 @@ class AsyncFileUtil { |
// FileSystemOperationImpl::TouchFile calls this. |
// This is used only by Pepper/NaCl File API. |
// |
- virtual void Touch( |
- scoped_ptr<FileSystemOperationContext> context, |
- const FileSystemURL& url, |
- const base::Time& last_access_time, |
- const base::Time& last_modified_time, |
- const StatusCallback& callback) = 0; |
+ virtual void Touch(scoped_ptr<FileSystemOperationContext> context, |
+ const FileSystemURL& url, |
+ const base::Time& last_access_time, |
+ const base::Time& last_modified_time, |
+ const StatusCallback& callback) = 0; |
// Truncates a file at |path| to |length|. If |length| is larger than |
// the original file size, the file will be extended, and the extended |
@@ -201,11 +191,10 @@ class AsyncFileUtil { |
// This reports following error code via |callback|: |
// - File::FILE_ERROR_NOT_FOUND if the file doesn't exist. |
// |
- virtual void Truncate( |
- scoped_ptr<FileSystemOperationContext> context, |
- const FileSystemURL& url, |
- int64 length, |
- const StatusCallback& callback) = 0; |
+ virtual void Truncate(scoped_ptr<FileSystemOperationContext> context, |
+ const FileSystemURL& url, |
+ int64 length, |
+ const StatusCallback& callback) = 0; |
// Copies a file from |src_url| to |dest_url|. |
// This must be called for files that belong to the same filesystem |
@@ -228,13 +217,12 @@ class AsyncFileUtil { |
// - File::FILE_ERROR_FAILED if |dest_url| does not exist and |
// its parent path is a file. |
// |
- virtual void CopyFileLocal( |
- scoped_ptr<FileSystemOperationContext> context, |
- const FileSystemURL& src_url, |
- const FileSystemURL& dest_url, |
- CopyOrMoveOption option, |
- const CopyFileProgressCallback& progress_callback, |
- const StatusCallback& callback) = 0; |
+ virtual void CopyFileLocal(scoped_ptr<FileSystemOperationContext> context, |
+ const FileSystemURL& src_url, |
+ const FileSystemURL& dest_url, |
+ CopyOrMoveOption option, |
+ const CopyFileProgressCallback& progress_callback, |
+ const StatusCallback& callback) = 0; |
// Moves a local file from |src_url| to |dest_url|. |
// This must be called for files that belong to the same filesystem |
@@ -251,12 +239,11 @@ class AsyncFileUtil { |
// - File::FILE_ERROR_FAILED if |dest_url| does not exist and |
// its parent path is a file. |
// |
- virtual void MoveFileLocal( |
- scoped_ptr<FileSystemOperationContext> context, |
- const FileSystemURL& src_url, |
- const FileSystemURL& dest_url, |
- CopyOrMoveOption option, |
- const StatusCallback& callback) = 0; |
+ virtual void MoveFileLocal(scoped_ptr<FileSystemOperationContext> context, |
+ const FileSystemURL& src_url, |
+ const FileSystemURL& dest_url, |
+ CopyOrMoveOption option, |
+ const StatusCallback& callback) = 0; |
// Copies in a single file from a different filesystem. |
// |
@@ -271,11 +258,10 @@ class AsyncFileUtil { |
// - File::FILE_ERROR_FAILED if |dest_url| does not exist and |
// its parent path is a file. |
// |
- virtual void CopyInForeignFile( |
- scoped_ptr<FileSystemOperationContext> context, |
- const base::FilePath& src_file_path, |
- const FileSystemURL& dest_url, |
- const StatusCallback& callback) = 0; |
+ virtual void CopyInForeignFile(scoped_ptr<FileSystemOperationContext> context, |
+ const base::FilePath& src_file_path, |
+ const FileSystemURL& dest_url, |
+ const StatusCallback& callback) = 0; |
// Deletes a single file. |
// |
@@ -285,10 +271,9 @@ class AsyncFileUtil { |
// - File::FILE_ERROR_NOT_FOUND if |url| does not exist. |
// - File::FILE_ERROR_NOT_A_FILE if |url| is not a file. |
// |
- virtual void DeleteFile( |
- scoped_ptr<FileSystemOperationContext> context, |
- const FileSystemURL& url, |
- const StatusCallback& callback) = 0; |
+ virtual void DeleteFile(scoped_ptr<FileSystemOperationContext> context, |
+ const FileSystemURL& url, |
+ const StatusCallback& callback) = 0; |
// Removes a single empty directory. |
// |
@@ -299,10 +284,9 @@ class AsyncFileUtil { |
// - File::FILE_ERROR_NOT_A_DIRECTORY if |url| is not a directory. |
// - File::FILE_ERROR_NOT_EMPTY if |url| is not empty. |
// |
- virtual void DeleteDirectory( |
- scoped_ptr<FileSystemOperationContext> context, |
- const FileSystemURL& url, |
- const StatusCallback& callback) = 0; |
+ virtual void DeleteDirectory(scoped_ptr<FileSystemOperationContext> context, |
+ const FileSystemURL& url, |
+ const StatusCallback& callback) = 0; |
// Removes a single file or a single directory with its contents |
// (i.e. files/subdirectories under the directory). |
@@ -317,10 +301,9 @@ class AsyncFileUtil { |
// This reports following error code via |callback|: |
// - File::FILE_ERROR_NOT_FOUND if |url| does not exist. |
// - File::FILE_ERROR_INVALID_OPERATION if this operation is not supported. |
- virtual void DeleteRecursively( |
- scoped_ptr<FileSystemOperationContext> context, |
- const FileSystemURL& url, |
- const StatusCallback& callback) = 0; |
+ virtual void DeleteRecursively(scoped_ptr<FileSystemOperationContext> context, |
+ const FileSystemURL& url, |
+ const StatusCallback& callback) = 0; |
// Creates a local snapshot file for a given |url| and returns the |
// metadata and platform path of the snapshot file via |callback|. |
@@ -362,6 +345,6 @@ class AsyncFileUtil { |
DISALLOW_COPY_AND_ASSIGN(AsyncFileUtil); |
}; |
-} // namespace fileapi |
+} // namespace storage |
#endif // WEBKIT_BROWSER_FILEAPI_ASYNC_FILE_UTIL_H_ |