diff options
Diffstat (limited to 'webkit/fileapi/syncable/canned_syncable_file_system.h')
-rw-r--r-- | webkit/fileapi/syncable/canned_syncable_file_system.h | 94 |
1 files changed, 50 insertions, 44 deletions
diff --git a/webkit/fileapi/syncable/canned_syncable_file_system.h b/webkit/fileapi/syncable/canned_syncable_file_system.h index e89fba7..d1420d7 100644 --- a/webkit/fileapi/syncable/canned_syncable_file_system.h +++ b/webkit/fileapi/syncable/canned_syncable_file_system.h @@ -26,6 +26,12 @@ class SingleThreadTaskRunner; class Thread; } +namespace fileapi { +class FileSystemContext; +class FileSystemOperation; +class FileSystemURL; +} + namespace net { class URLRequestContext; } @@ -34,10 +40,8 @@ namespace quota { class QuotaManager; } -namespace fileapi { +namespace sync_file_system { -class FileSystemContext; -class FileSystemOperation; class LocalFileSyncContext; // A canned syncable filesystem for testing. @@ -62,7 +66,7 @@ class CannedSyncableFileSystem void TearDown(); // Creates a FileSystemURL for the given (utf8) path string. - FileSystemURL URL(const std::string& path) const; + fileapi::FileSystemURL URL(const std::string& path) const; // Initialize this with given |sync_context| if it hasn't // been initialized. @@ -79,12 +83,12 @@ class CannedSyncableFileSystem void RemoveSyncStatusObserver(LocalFileSyncStatus::Observer* observer); // Accessors. - FileSystemContext* file_system_context() { + fileapi::FileSystemContext* file_system_context() { return file_system_context_.get(); } quota::QuotaManager* quota_manager() { return quota_manager_.get(); } GURL origin() const { return origin_; } - FileSystemType type() const { return type_; } + fileapi::FileSystemType type() const { return type_; } quota::StorageType storage_type() const { return FileSystemTypeToQuotaStorageType(type_); } @@ -93,29 +97,31 @@ class CannedSyncableFileSystem // OpenFileSystem() must have been called before calling any of them. // They create an operation and run it on IO task runner, and the operation // posts a task on file runner. - base::PlatformFileError CreateDirectory(const FileSystemURL& url); - base::PlatformFileError CreateFile(const FileSystemURL& url); - base::PlatformFileError Copy(const FileSystemURL& src_url, - const FileSystemURL& dest_url); - base::PlatformFileError Move(const FileSystemURL& src_url, - const FileSystemURL& dest_url); - base::PlatformFileError TruncateFile(const FileSystemURL& url, int64 size); - base::PlatformFileError TouchFile(const FileSystemURL& url, + base::PlatformFileError CreateDirectory(const fileapi::FileSystemURL& url); + base::PlatformFileError CreateFile(const fileapi::FileSystemURL& url); + base::PlatformFileError Copy(const fileapi::FileSystemURL& src_url, + const fileapi::FileSystemURL& dest_url); + base::PlatformFileError Move(const fileapi::FileSystemURL& src_url, + const fileapi::FileSystemURL& dest_url); + base::PlatformFileError TruncateFile(const fileapi::FileSystemURL& url, + int64 size); + base::PlatformFileError TouchFile(const fileapi::FileSystemURL& url, const base::Time& last_access_time, const base::Time& last_modified_time); - base::PlatformFileError Remove(const FileSystemURL& url, bool recursive); - base::PlatformFileError FileExists(const FileSystemURL& url); - base::PlatformFileError DirectoryExists(const FileSystemURL& url); - base::PlatformFileError VerifyFile(const FileSystemURL& url, + base::PlatformFileError Remove(const fileapi::FileSystemURL& url, + bool recursive); + base::PlatformFileError FileExists(const fileapi::FileSystemURL& url); + base::PlatformFileError DirectoryExists(const fileapi::FileSystemURL& url); + base::PlatformFileError VerifyFile(const fileapi::FileSystemURL& url, const std::string& expected_data); - base::PlatformFileError GetMetadata(const FileSystemURL& url, + base::PlatformFileError GetMetadata(const fileapi::FileSystemURL& url, base::PlatformFileInfo* info, base::FilePath* platform_path); // Returns the # of bytes written (>=0) or an error code (<0). int64 Write(net::URLRequestContext* url_request_context, - const FileSystemURL& url, const GURL& blob_url); - int64 WriteString(const FileSystemURL& url, const std::string& data); + const fileapi::FileSystemURL& url, const GURL& blob_url); + int64 WriteString(const fileapi::FileSystemURL& url, const std::string& data); // Purges the file system local storage. base::PlatformFileError DeleteFileSystem(); @@ -124,15 +130,15 @@ class CannedSyncableFileSystem quota::QuotaStatusCode GetUsageAndQuota(int64* usage, int64* quota); // ChangeTracker related methods. They run on file task runner. - void GetChangedURLsInTracker(FileSystemURLSet* urls); - void ClearChangeForURLInTracker(const FileSystemURL& url); + void GetChangedURLsInTracker(fileapi::FileSystemURLSet* urls); + void ClearChangeForURLInTracker(const fileapi::FileSystemURL& url); // Returns new FileSystemOperation. - FileSystemOperation* NewOperation(); + fileapi::FileSystemOperation* NewOperation(); // LocalFileSyncStatus::Observer overrides. - virtual void OnSyncEnabled(const FileSystemURL& url) OVERRIDE; - virtual void OnWriteEnabled(const FileSystemURL& url) OVERRIDE; + virtual void OnSyncEnabled(const fileapi::FileSystemURL& url) OVERRIDE; + virtual void OnWriteEnabled(const fileapi::FileSystemURL& url) OVERRIDE; // Overrides --enable-sync-directory-operation setting which is disabled // by default in production code but enabled in (and only in) an instance @@ -143,42 +149,42 @@ class CannedSyncableFileSystem // Operation methods body. // They can be also called directly if the caller is already on IO thread. - void DoCreateDirectory(const FileSystemURL& url, + void DoCreateDirectory(const fileapi::FileSystemURL& url, const StatusCallback& callback); - void DoCreateFile(const FileSystemURL& url, + void DoCreateFile(const fileapi::FileSystemURL& url, const StatusCallback& callback); - void DoCopy(const FileSystemURL& src_url, - const FileSystemURL& dest_url, + void DoCopy(const fileapi::FileSystemURL& src_url, + const fileapi::FileSystemURL& dest_url, const StatusCallback& callback); - void DoMove(const FileSystemURL& src_url, - const FileSystemURL& dest_url, + void DoMove(const fileapi::FileSystemURL& src_url, + const fileapi::FileSystemURL& dest_url, const StatusCallback& callback); - void DoTruncateFile(const FileSystemURL& url, + void DoTruncateFile(const fileapi::FileSystemURL& url, int64 size, const StatusCallback& callback); - void DoTouchFile(const FileSystemURL& url, + void DoTouchFile(const fileapi::FileSystemURL& url, const base::Time& last_access_time, const base::Time& last_modified_time, const StatusCallback& callback); - void DoRemove(const FileSystemURL& url, + void DoRemove(const fileapi::FileSystemURL& url, bool recursive, const StatusCallback& callback); - void DoFileExists(const FileSystemURL& url, + void DoFileExists(const fileapi::FileSystemURL& url, const StatusCallback& callback); - void DoDirectoryExists(const FileSystemURL& url, + void DoDirectoryExists(const fileapi::FileSystemURL& url, const StatusCallback& callback); - void DoVerifyFile(const FileSystemURL& url, + void DoVerifyFile(const fileapi::FileSystemURL& url, const std::string& expected_data, const StatusCallback& callback); - void DoGetMetadata(const FileSystemURL& url, + void DoGetMetadata(const fileapi::FileSystemURL& url, base::PlatformFileInfo* info, base::FilePath* platform_path, const StatusCallback& callback); void DoWrite(net::URLRequestContext* url_request_context, - const FileSystemURL& url, + const fileapi::FileSystemURL& url, const GURL& blob_url, const WriteCallback& callback); - void DoWriteString(const FileSystemURL& url, + void DoWriteString(const fileapi::FileSystemURL& url, const std::string& data, const WriteCallback& callback); void DoGetUsageAndQuota(int64* usage, @@ -200,9 +206,9 @@ class CannedSyncableFileSystem const std::string service_name_; scoped_refptr<quota::QuotaManager> quota_manager_; - scoped_refptr<FileSystemContext> file_system_context_; + scoped_refptr<fileapi::FileSystemContext> file_system_context_; const GURL origin_; - const FileSystemType type_; + const fileapi::FileSystemType type_; GURL root_url_; base::PlatformFileError result_; sync_file_system::SyncStatusCode sync_status_; @@ -219,6 +225,6 @@ class CannedSyncableFileSystem DISALLOW_COPY_AND_ASSIGN(CannedSyncableFileSystem); }; -} // namespace fileapi +} // namespace sync_file_system #endif // WEBKIT_FILEAPI_SYNCABLE_CANNED_SYNCABLE_FILE_SYSTEM_H_ |