| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_LOCAL_FILE_SYSTEM_OPERATION_H_ | 5 #ifndef WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_OPERATION_H_ |
| 6 #define WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_OPERATION_H_ | 6 #define WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_OPERATION_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
| 13 #include "webkit/fileapi/file_snapshot_policy.h" | 13 #include "webkit/fileapi/file_snapshot_policy.h" |
| 14 #include "webkit/fileapi/file_system_file_util.h" | 14 #include "webkit/fileapi/file_system_file_util.h" |
| 15 #include "webkit/fileapi/file_system_operation.h" | 15 #include "webkit/fileapi/file_system_operation.h" |
| 16 #include "webkit/fileapi/file_system_operation_context.h" | 16 #include "webkit/fileapi/file_system_operation_context.h" |
| 17 #include "webkit/fileapi/file_system_url.h" | 17 #include "webkit/fileapi/file_system_url.h" |
| 18 #include "webkit/fileapi/file_writer_delegate.h" | 18 #include "webkit/fileapi/file_writer_delegate.h" |
| 19 #include "webkit/quota/quota_types.h" | 19 #include "webkit/quota/quota_types.h" |
| 20 #include "webkit/storage/webkit_storage_export.h" | 20 #include "webkit/storage/webkit_storage_export.h" |
| 21 | 21 |
| 22 namespace chromeos { | 22 namespace chromeos { |
| 23 class CrosMountPointProvider; | 23 class CrosMountPointProvider; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace webkit_blob { |
| 27 class BlobDataHandle; |
| 28 } |
| 29 |
| 26 namespace fileapi { | 30 namespace fileapi { |
| 27 | 31 |
| 28 class AsyncFileUtil; | 32 class AsyncFileUtil; |
| 29 class FileSystemContext; | 33 class FileSystemContext; |
| 30 class RecursiveOperationDelegate; | 34 class RecursiveOperationDelegate; |
| 31 | 35 |
| 32 // FileSystemOperation implementation for local file systems. | 36 // FileSystemOperation implementation for local file systems. |
| 33 class WEBKIT_STORAGE_EXPORT LocalFileSystemOperation | 37 class WEBKIT_STORAGE_EXPORT LocalFileSystemOperation |
| 34 : public NON_EXPORTED_BASE(FileSystemOperation) { | 38 : public NON_EXPORTED_BASE(FileSystemOperation) { |
| 35 public: | 39 public: |
| (...skipping 18 matching lines...) Expand all Loading... |
| 54 virtual void FileExists(const FileSystemURL& url, | 58 virtual void FileExists(const FileSystemURL& url, |
| 55 const StatusCallback& callback) OVERRIDE; | 59 const StatusCallback& callback) OVERRIDE; |
| 56 virtual void GetMetadata(const FileSystemURL& url, | 60 virtual void GetMetadata(const FileSystemURL& url, |
| 57 const GetMetadataCallback& callback) OVERRIDE; | 61 const GetMetadataCallback& callback) OVERRIDE; |
| 58 virtual void ReadDirectory(const FileSystemURL& url, | 62 virtual void ReadDirectory(const FileSystemURL& url, |
| 59 const ReadDirectoryCallback& callback) OVERRIDE; | 63 const ReadDirectoryCallback& callback) OVERRIDE; |
| 60 virtual void Remove(const FileSystemURL& url, bool recursive, | 64 virtual void Remove(const FileSystemURL& url, bool recursive, |
| 61 const StatusCallback& callback) OVERRIDE; | 65 const StatusCallback& callback) OVERRIDE; |
| 62 virtual void Write(const net::URLRequestContext* url_request_context, | 66 virtual void Write(const net::URLRequestContext* url_request_context, |
| 63 const FileSystemURL& url, | 67 const FileSystemURL& url, |
| 64 const GURL& blob_url, | 68 scoped_ptr<webkit_blob::BlobDataHandle> blob_handle, |
| 65 int64 offset, | 69 int64 offset, |
| 66 const WriteCallback& callback) OVERRIDE; | 70 const WriteCallback& callback) OVERRIDE; |
| 67 virtual void Truncate(const FileSystemURL& url, int64 length, | 71 virtual void Truncate(const FileSystemURL& url, int64 length, |
| 68 const StatusCallback& callback) OVERRIDE; | 72 const StatusCallback& callback) OVERRIDE; |
| 69 virtual void TouchFile(const FileSystemURL& url, | 73 virtual void TouchFile(const FileSystemURL& url, |
| 70 const base::Time& last_access_time, | 74 const base::Time& last_access_time, |
| 71 const base::Time& last_modified_time, | 75 const base::Time& last_modified_time, |
| 72 const StatusCallback& callback) OVERRIDE; | 76 const StatusCallback& callback) OVERRIDE; |
| 73 virtual void OpenFile(const FileSystemURL& url, | 77 virtual void OpenFile(const FileSystemURL& url, |
| 74 int file_flags, | 78 int file_flags, |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 void DidGetUsageAndQuotaAndRunTask( | 211 void DidGetUsageAndQuotaAndRunTask( |
| 208 const base::Closure& task, | 212 const base::Closure& task, |
| 209 const base::Closure& error_callback, | 213 const base::Closure& error_callback, |
| 210 quota::QuotaStatusCode status, | 214 quota::QuotaStatusCode status, |
| 211 int64 usage, int64 quota); | 215 int64 usage, int64 quota); |
| 212 | 216 |
| 213 // returns a closure which actually perform the write operation. | 217 // returns a closure which actually perform the write operation. |
| 214 base::Closure GetWriteClosure( | 218 base::Closure GetWriteClosure( |
| 215 const net::URLRequestContext* url_request_context, | 219 const net::URLRequestContext* url_request_context, |
| 216 const FileSystemURL& url, | 220 const FileSystemURL& url, |
| 217 const GURL& blob_url, | 221 scoped_ptr<webkit_blob::BlobDataHandle> blob_handle, |
| 218 int64 offset, | 222 int64 offset, |
| 219 const WriteCallback& callback); | 223 const WriteCallback& callback); |
| 220 void DidFailWrite( | 224 void DidFailWrite( |
| 221 const WriteCallback& callback, | 225 const WriteCallback& callback, |
| 222 base::PlatformFileError result); | 226 base::PlatformFileError result); |
| 223 | 227 |
| 224 // The 'body' methods that perform the actual work (i.e. posting the | 228 // The 'body' methods that perform the actual work (i.e. posting the |
| 225 // file task on proxy_) after the quota check. | 229 // file task on proxy_) after the quota check. |
| 226 void DoCreateFile(const FileSystemURL& url, | 230 void DoCreateFile(const FileSystemURL& url, |
| 227 const StatusCallback& callback, bool exclusive); | 231 const StatusCallback& callback, bool exclusive); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 // LocalFileSystemOperation instance is usually deleted upon completion but | 360 // LocalFileSystemOperation instance is usually deleted upon completion but |
| 357 // could be deleted while it has inflight callbacks when Cancel is called. | 361 // could be deleted while it has inflight callbacks when Cancel is called. |
| 358 base::WeakPtrFactory<LocalFileSystemOperation> weak_factory_; | 362 base::WeakPtrFactory<LocalFileSystemOperation> weak_factory_; |
| 359 | 363 |
| 360 DISALLOW_COPY_AND_ASSIGN(LocalFileSystemOperation); | 364 DISALLOW_COPY_AND_ASSIGN(LocalFileSystemOperation); |
| 361 }; | 365 }; |
| 362 | 366 |
| 363 } // namespace fileapi | 367 } // namespace fileapi |
| 364 | 368 |
| 365 #endif // WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_OPERATION_H_ | 369 #endif // WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_OPERATION_H_ |
| OLD | NEW |