OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "webkit/fileapi/file_system_operation.h" | 5 #include "webkit/fileapi/file_system_operation.h" |
6 | 6 |
7 #include "base/time.h" | 7 #include "base/time.h" |
8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
9 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 9 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
10 | 10 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 #ifndef NDEBUG | 111 #ifndef NDEBUG |
112 DCHECK(kOperationNone == pending_operation_); | 112 DCHECK(kOperationNone == pending_operation_); |
113 pending_operation_ = kOperationReadDirectory; | 113 pending_operation_ = kOperationReadDirectory; |
114 #endif | 114 #endif |
115 | 115 |
116 base::FileUtilProxy::ReadDirectory(proxy_, path, | 116 base::FileUtilProxy::ReadDirectory(proxy_, path, |
117 callback_factory_.NewCallback( | 117 callback_factory_.NewCallback( |
118 &FileSystemOperation::DidReadDirectory)); | 118 &FileSystemOperation::DidReadDirectory)); |
119 } | 119 } |
120 | 120 |
121 void FileSystemOperation::Remove(const FilePath& path) { | 121 void FileSystemOperation::Remove(const FilePath& path, bool recursive) { |
122 #ifndef NDEBUG | 122 #ifndef NDEBUG |
123 DCHECK(kOperationNone == pending_operation_); | 123 DCHECK(kOperationNone == pending_operation_); |
124 pending_operation_ = kOperationRemove; | 124 pending_operation_ = kOperationRemove; |
125 #endif | 125 #endif |
126 | 126 |
127 base::FileUtilProxy::Delete(proxy_, path, callback_factory_.NewCallback( | 127 base::FileUtilProxy::Delete(proxy_, path, recursive, |
128 &FileSystemOperation::DidFinishFileOperation)); | 128 callback_factory_.NewCallback( |
| 129 &FileSystemOperation::DidFinishFileOperation)); |
129 } | 130 } |
130 | 131 |
131 void FileSystemOperation::Write( | 132 void FileSystemOperation::Write( |
132 const FilePath& path, | 133 const FilePath& path, |
133 const GURL& blob_url, | 134 const GURL& blob_url, |
134 int64 offset) { | 135 int64 offset) { |
135 #ifndef NDEBUG | 136 #ifndef NDEBUG |
136 DCHECK(kOperationNone == pending_operation_); | 137 DCHECK(kOperationNone == pending_operation_); |
137 pending_operation_ = kOperationWrite; | 138 pending_operation_ = kOperationWrite; |
138 #endif | 139 #endif |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 } | 266 } |
266 | 267 |
267 void FileSystemOperation::DidTouchFile(base::PlatformFileError rv) { | 268 void FileSystemOperation::DidTouchFile(base::PlatformFileError rv) { |
268 if (rv == base::PLATFORM_FILE_OK) | 269 if (rv == base::PLATFORM_FILE_OK) |
269 dispatcher_->DidSucceed(); | 270 dispatcher_->DidSucceed(); |
270 else | 271 else |
271 dispatcher_->DidFail(rv); | 272 dispatcher_->DidFail(rv); |
272 } | 273 } |
273 | 274 |
274 } // namespace fileapi | 275 } // namespace fileapi |
OLD | NEW |