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_system_file_util.h" | 13 #include "webkit/fileapi/file_system_file_util.h" |
14 #include "webkit/fileapi/file_system_operation.h" | 14 #include "webkit/fileapi/file_system_operation.h" |
15 #include "webkit/fileapi/file_system_operation_context.h" | 15 #include "webkit/fileapi/file_system_operation_context.h" |
16 #include "webkit/fileapi/file_system_url.h" | 16 #include "webkit/fileapi/file_system_url.h" |
17 #include "webkit/fileapi/file_writer_delegate.h" | 17 #include "webkit/fileapi/file_writer_delegate.h" |
18 #include "webkit/quota/quota_types.h" | 18 #include "webkit/quota/quota_types.h" |
19 #include "webkit/storage/webkit_storage_export.h" | 19 #include "webkit/storage/webkit_storage_export.h" |
20 | 20 |
21 namespace chromeos { | 21 namespace chromeos { |
22 class CrosMountPointProvider; | 22 class CrosMountPointProvider; |
23 } | 23 } |
24 | 24 |
| 25 namespace webkit_blob { |
| 26 class BlobDataHandle; |
| 27 } |
| 28 |
25 namespace fileapi { | 29 namespace fileapi { |
26 | 30 |
27 class FileSystemContext; | 31 class FileSystemContext; |
28 | 32 |
29 // FileSystemOperation implementation for local file systems. | 33 // FileSystemOperation implementation for local file systems. |
30 class WEBKIT_STORAGE_EXPORT LocalFileSystemOperation | 34 class WEBKIT_STORAGE_EXPORT LocalFileSystemOperation |
31 : public NON_EXPORTED_BASE(FileSystemOperation) { | 35 : public NON_EXPORTED_BASE(FileSystemOperation) { |
32 public: | 36 public: |
33 virtual ~LocalFileSystemOperation(); | 37 virtual ~LocalFileSystemOperation(); |
34 | 38 |
(...skipping 16 matching lines...) Expand all Loading... |
51 virtual void FileExists(const FileSystemURL& url, | 55 virtual void FileExists(const FileSystemURL& url, |
52 const StatusCallback& callback) OVERRIDE; | 56 const StatusCallback& callback) OVERRIDE; |
53 virtual void GetMetadata(const FileSystemURL& url, | 57 virtual void GetMetadata(const FileSystemURL& url, |
54 const GetMetadataCallback& callback) OVERRIDE; | 58 const GetMetadataCallback& callback) OVERRIDE; |
55 virtual void ReadDirectory(const FileSystemURL& url, | 59 virtual void ReadDirectory(const FileSystemURL& url, |
56 const ReadDirectoryCallback& callback) OVERRIDE; | 60 const ReadDirectoryCallback& callback) OVERRIDE; |
57 virtual void Remove(const FileSystemURL& url, bool recursive, | 61 virtual void Remove(const FileSystemURL& url, bool recursive, |
58 const StatusCallback& callback) OVERRIDE; | 62 const StatusCallback& callback) OVERRIDE; |
59 virtual void Write(const net::URLRequestContext* url_request_context, | 63 virtual void Write(const net::URLRequestContext* url_request_context, |
60 const FileSystemURL& url, | 64 const FileSystemURL& url, |
61 const GURL& blob_url, | 65 scoped_ptr<webkit_blob::BlobDataHandle> blob_handle, |
62 int64 offset, | 66 int64 offset, |
63 const WriteCallback& callback) OVERRIDE; | 67 const WriteCallback& callback) OVERRIDE; |
64 virtual void Truncate(const FileSystemURL& url, int64 length, | 68 virtual void Truncate(const FileSystemURL& url, int64 length, |
65 const StatusCallback& callback) OVERRIDE; | 69 const StatusCallback& callback) OVERRIDE; |
66 virtual void TouchFile(const FileSystemURL& url, | 70 virtual void TouchFile(const FileSystemURL& url, |
67 const base::Time& last_access_time, | 71 const base::Time& last_access_time, |
68 const base::Time& last_modified_time, | 72 const base::Time& last_modified_time, |
69 const StatusCallback& callback) OVERRIDE; | 73 const StatusCallback& callback) OVERRIDE; |
70 virtual void OpenFile(const FileSystemURL& url, | 74 virtual void OpenFile(const FileSystemURL& url, |
71 int file_flags, | 75 int file_flags, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 void DidGetUsageAndQuotaAndRunTask( | 149 void DidGetUsageAndQuotaAndRunTask( |
146 const base::Closure& task, | 150 const base::Closure& task, |
147 const base::Closure& error_callback, | 151 const base::Closure& error_callback, |
148 quota::QuotaStatusCode status, | 152 quota::QuotaStatusCode status, |
149 int64 usage, int64 quota); | 153 int64 usage, int64 quota); |
150 | 154 |
151 // returns a closure which actually perform the write operation. | 155 // returns a closure which actually perform the write operation. |
152 base::Closure GetWriteClosure( | 156 base::Closure GetWriteClosure( |
153 const net::URLRequestContext* url_request_context, | 157 const net::URLRequestContext* url_request_context, |
154 const FileSystemURL& url, | 158 const FileSystemURL& url, |
155 const GURL& blob_url, | 159 scoped_ptr<webkit_blob::BlobDataHandle> blob_handle, |
156 int64 offset, | 160 int64 offset, |
157 const WriteCallback& callback); | 161 const WriteCallback& callback); |
158 void DidFailWrite( | 162 void DidFailWrite( |
159 const WriteCallback& callback, | 163 const WriteCallback& callback, |
160 base::PlatformFileError result); | 164 base::PlatformFileError result); |
161 | 165 |
162 // The 'body' methods that perform the actual work (i.e. posting the | 166 // The 'body' methods that perform the actual work (i.e. posting the |
163 // file task on proxy_) after the quota check. | 167 // file task on proxy_) after the quota check. |
164 void DoCreateFile(const FileSystemURL& url, | 168 void DoCreateFile(const FileSystemURL& url, |
165 const StatusCallback& callback, bool exclusive); | 169 const StatusCallback& callback, bool exclusive); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 // LocalFileSystemOperation instance is usually deleted upon completion but | 278 // LocalFileSystemOperation instance is usually deleted upon completion but |
275 // could be deleted while it has inflight callbacks when Cancel is called. | 279 // could be deleted while it has inflight callbacks when Cancel is called. |
276 base::WeakPtrFactory<LocalFileSystemOperation> weak_factory_; | 280 base::WeakPtrFactory<LocalFileSystemOperation> weak_factory_; |
277 | 281 |
278 DISALLOW_COPY_AND_ASSIGN(LocalFileSystemOperation); | 282 DISALLOW_COPY_AND_ASSIGN(LocalFileSystemOperation); |
279 }; | 283 }; |
280 | 284 |
281 } // namespace fileapi | 285 } // namespace fileapi |
282 | 286 |
283 #endif // WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_OPERATION_H_ | 287 #endif // WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_OPERATION_H_ |
OLD | NEW |