OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ |
6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/id_map.h" | 11 #include "base/id_map.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "webkit/browser/blob/blob_data_handle.h" |
14 #include "webkit/browser/fileapi/file_system_operation.h" | 15 #include "webkit/browser/fileapi/file_system_operation.h" |
15 #include "webkit/browser/fileapi/file_system_url.h" | 16 #include "webkit/browser/fileapi/file_system_url.h" |
16 #include "webkit/browser/webkit_storage_browser_export.h" | 17 #include "webkit/browser/webkit_storage_browser_export.h" |
17 | 18 |
18 namespace net { | 19 namespace net { |
19 class URLRequestContext; | 20 class URLRequestContext; |
20 } | 21 } |
21 | 22 |
22 namespace fileapi { | 23 namespace fileapi { |
23 | 24 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // Reads contents of a directory at |url|. | 89 // Reads contents of a directory at |url|. |
89 OperationID ReadDirectory(const FileSystemURL& url, | 90 OperationID ReadDirectory(const FileSystemURL& url, |
90 const ReadDirectoryCallback& callback); | 91 const ReadDirectoryCallback& callback); |
91 | 92 |
92 // Removes a file or directory at |url|. If |recursive| is true, remove | 93 // Removes a file or directory at |url|. If |recursive| is true, remove |
93 // all files and directories under the directory at |url| recursively. | 94 // all files and directories under the directory at |url| recursively. |
94 OperationID Remove(const FileSystemURL& url, bool recursive, | 95 OperationID Remove(const FileSystemURL& url, bool recursive, |
95 const StatusCallback& callback); | 96 const StatusCallback& callback); |
96 | 97 |
97 // Writes contents of |blob_url| to |url| at |offset|. | 98 // Writes contents of |blob_url| to |url| at |offset|. |
98 // |url_request_context| is used to read contents in |blob_url|. | 99 // |url_request_context| is used to read contents in |blob|. |
99 OperationID Write(const net::URLRequestContext* url_request_context, | 100 OperationID Write(const net::URLRequestContext* url_request_context, |
100 const FileSystemURL& url, | 101 const FileSystemURL& url, |
101 const GURL& blob_url, | 102 scoped_ptr<webkit_blob::BlobDataHandle> blob, |
102 int64 offset, | 103 int64 offset, |
103 const WriteCallback& callback); | 104 const WriteCallback& callback); |
104 | 105 |
105 // Truncates a file at |url| to |length|. If |length| is larger than | 106 // Truncates a file at |url| to |length|. If |length| is larger than |
106 // the original file size, the file will be extended, and the extended | 107 // the original file size, the file will be extended, and the extended |
107 // part is filled with null bytes. | 108 // part is filled with null bytes. |
108 OperationID Truncate(const FileSystemURL& url, int64 length, | 109 OperationID Truncate(const FileSystemURL& url, int64 length, |
109 const StatusCallback& callback); | 110 const StatusCallback& callback); |
110 | 111 |
111 // Tries to cancel the operation |id| [we support cancelling write or | 112 // Tries to cancel the operation |id| [we support cancelling write or |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 | 290 |
290 // Callbacks for stray cancels whose target operation is already finished. | 291 // Callbacks for stray cancels whose target operation is already finished. |
291 std::map<OperationID, StatusCallback> stray_cancel_callbacks_; | 292 std::map<OperationID, StatusCallback> stray_cancel_callbacks_; |
292 | 293 |
293 DISALLOW_COPY_AND_ASSIGN(FileSystemOperationRunner); | 294 DISALLOW_COPY_AND_ASSIGN(FileSystemOperationRunner); |
294 }; | 295 }; |
295 | 296 |
296 } // namespace fileapi | 297 } // namespace fileapi |
297 | 298 |
298 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ | 299 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ |
OLD | NEW |