| 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 #include "webkit/fileapi/file_system_file_util_proxy.h" | 5 #include "webkit/fileapi/file_system_file_util_proxy.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "webkit/fileapi/cross_file_util_helper.h" | 10 #include "webkit/fileapi/cross_file_util_helper.h" |
| 11 #include "webkit/fileapi/file_system_file_util.h" | 11 #include "webkit/fileapi/file_system_file_util.h" |
| 12 #include "webkit/fileapi/file_system_operation_context.h" | 12 #include "webkit/fileapi/file_system_operation_context.h" |
| 13 #include "webkit/fileapi/file_util_delete_helper.h" |
| 13 | 14 |
| 14 namespace fileapi { | 15 namespace fileapi { |
| 15 | 16 |
| 16 using base::Bind; | 17 using base::Bind; |
| 17 using base::Callback; | 18 using base::Callback; |
| 18 using base::Owned; | 19 using base::Owned; |
| 19 using base::PlatformFileError; | 20 using base::PlatformFileError; |
| 20 using base::Unretained; | 21 using base::Unretained; |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } // namespace | 114 } // namespace |
| 114 | 115 |
| 115 // static | 116 // static |
| 116 bool FileSystemFileUtilProxy::Delete( | 117 bool FileSystemFileUtilProxy::Delete( |
| 117 MessageLoopProxy* message_loop_proxy, | 118 MessageLoopProxy* message_loop_proxy, |
| 118 FileSystemOperationContext* context, | 119 FileSystemOperationContext* context, |
| 119 FileSystemFileUtil* file_util, | 120 FileSystemFileUtil* file_util, |
| 120 const FileSystemPath& path, | 121 const FileSystemPath& path, |
| 121 bool recursive, | 122 bool recursive, |
| 122 const StatusCallback& callback) { | 123 const StatusCallback& callback) { |
| 124 FileUtilDeleteHelper* helper = new FileUtilDeleteHelper(context, file_util); |
| 123 return base::FileUtilProxy::RelayFileTask( | 125 return base::FileUtilProxy::RelayFileTask( |
| 124 message_loop_proxy, FROM_HERE, | 126 message_loop_proxy, FROM_HERE, |
| 125 base::Bind(&FileSystemFileUtil::Delete, base::Unretained(file_util), | 127 Bind(&FileUtilDeleteHelper::DoWork, Owned(helper), path, recursive), |
| 126 context, path, recursive), | |
| 127 callback); | 128 callback); |
| 128 } | 129 } |
| 129 | 130 |
| 130 // static | 131 // static |
| 131 bool FileSystemFileUtilProxy::CreateOrOpen( | 132 bool FileSystemFileUtilProxy::CreateOrOpen( |
| 132 MessageLoopProxy* message_loop_proxy, | 133 MessageLoopProxy* message_loop_proxy, |
| 133 FileSystemOperationContext* context, | 134 FileSystemOperationContext* context, |
| 134 FileSystemFileUtil* file_util, | 135 FileSystemFileUtil* file_util, |
| 135 const FileSystemPath& path, | 136 const FileSystemPath& path, |
| 136 int file_flags, | 137 int file_flags, |
| 137 const CreateOrOpenCallback& callback) { | 138 const CreateOrOpenCallback& callback) { |
| 138 return base::FileUtilProxy::RelayCreateOrOpen( | 139 return base::FileUtilProxy::RelayCreateOrOpen( |
| 139 message_loop_proxy, | 140 message_loop_proxy, |
| 140 base::Bind(&FileSystemFileUtil::CreateOrOpen, base::Unretained(file_util), | 141 Bind(&FileSystemFileUtil::CreateOrOpen, Unretained(file_util), |
| 141 context, path, file_flags), | 142 context, path, file_flags), |
| 142 base::Bind(&FileSystemFileUtil::Close, base::Unretained(file_util), | 143 Bind(&FileSystemFileUtil::Close, Unretained(file_util), |
| 143 context), | 144 context), |
| 144 callback); | 145 callback); |
| 145 } | 146 } |
| 146 | 147 |
| 147 // static | 148 // static |
| 148 bool FileSystemFileUtilProxy::Copy( | 149 bool FileSystemFileUtilProxy::Copy( |
| 149 MessageLoopProxy* message_loop_proxy, | 150 MessageLoopProxy* message_loop_proxy, |
| 150 FileSystemOperationContext* context, | 151 FileSystemOperationContext* context, |
| 151 FileSystemFileUtil* src_util, | 152 FileSystemFileUtil* src_util, |
| 152 FileSystemFileUtil* dest_util, | 153 FileSystemFileUtil* dest_util, |
| 153 const FileSystemPath& src_path, | 154 const FileSystemPath& src_path, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 bool FileSystemFileUtilProxy::CreateDirectory( | 202 bool FileSystemFileUtilProxy::CreateDirectory( |
| 202 MessageLoopProxy* message_loop_proxy, | 203 MessageLoopProxy* message_loop_proxy, |
| 203 FileSystemOperationContext* context, | 204 FileSystemOperationContext* context, |
| 204 FileSystemFileUtil* file_util, | 205 FileSystemFileUtil* file_util, |
| 205 const FileSystemPath& path, | 206 const FileSystemPath& path, |
| 206 bool exclusive, | 207 bool exclusive, |
| 207 bool recursive, | 208 bool recursive, |
| 208 const StatusCallback& callback) { | 209 const StatusCallback& callback) { |
| 209 return base::FileUtilProxy::RelayFileTask( | 210 return base::FileUtilProxy::RelayFileTask( |
| 210 message_loop_proxy, FROM_HERE, | 211 message_loop_proxy, FROM_HERE, |
| 211 base::Bind(&FileSystemFileUtil::CreateDirectory, | 212 Bind(&FileSystemFileUtil::CreateDirectory, Unretained(file_util), |
| 212 base::Unretained(file_util), | 213 context, path, exclusive, recursive), |
| 213 context, path, exclusive, recursive), | |
| 214 callback); | 214 callback); |
| 215 } | 215 } |
| 216 | 216 |
| 217 // static | 217 // static |
| 218 bool FileSystemFileUtilProxy::GetFileInfo( | 218 bool FileSystemFileUtilProxy::GetFileInfo( |
| 219 MessageLoopProxy* message_loop_proxy, | 219 MessageLoopProxy* message_loop_proxy, |
| 220 FileSystemOperationContext* context, | 220 FileSystemOperationContext* context, |
| 221 FileSystemFileUtil* file_util, | 221 FileSystemFileUtil* file_util, |
| 222 const FileSystemPath& path, | 222 const FileSystemPath& path, |
| 223 const GetFileInfoCallback& callback) { | 223 const GetFileInfoCallback& callback) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 248 bool FileSystemFileUtilProxy::Touch( | 248 bool FileSystemFileUtilProxy::Touch( |
| 249 MessageLoopProxy* message_loop_proxy, | 249 MessageLoopProxy* message_loop_proxy, |
| 250 FileSystemOperationContext* context, | 250 FileSystemOperationContext* context, |
| 251 FileSystemFileUtil* file_util, | 251 FileSystemFileUtil* file_util, |
| 252 const FileSystemPath& path, | 252 const FileSystemPath& path, |
| 253 const base::Time& last_access_time, | 253 const base::Time& last_access_time, |
| 254 const base::Time& last_modified_time, | 254 const base::Time& last_modified_time, |
| 255 const StatusCallback& callback) { | 255 const StatusCallback& callback) { |
| 256 return base::FileUtilProxy::RelayFileTask( | 256 return base::FileUtilProxy::RelayFileTask( |
| 257 message_loop_proxy, FROM_HERE, | 257 message_loop_proxy, FROM_HERE, |
| 258 base::Bind(&FileSystemFileUtil::Touch, base::Unretained(file_util), | 258 Bind(&FileSystemFileUtil::Touch, Unretained(file_util), |
| 259 context, path, last_access_time, last_modified_time), | 259 context, path, last_access_time, last_modified_time), |
| 260 callback); | 260 callback); |
| 261 } | 261 } |
| 262 | 262 |
| 263 // static | 263 // static |
| 264 bool FileSystemFileUtilProxy::Truncate( | 264 bool FileSystemFileUtilProxy::Truncate( |
| 265 MessageLoopProxy* message_loop_proxy, | 265 MessageLoopProxy* message_loop_proxy, |
| 266 FileSystemOperationContext* context, | 266 FileSystemOperationContext* context, |
| 267 FileSystemFileUtil* file_util, | 267 FileSystemFileUtil* file_util, |
| 268 const FileSystemPath& path, | 268 const FileSystemPath& path, |
| 269 int64 length, | 269 int64 length, |
| 270 const StatusCallback& callback) { | 270 const StatusCallback& callback) { |
| 271 return base::FileUtilProxy::RelayFileTask( | 271 return base::FileUtilProxy::RelayFileTask( |
| 272 message_loop_proxy, FROM_HERE, | 272 message_loop_proxy, FROM_HERE, |
| 273 base::Bind(&FileSystemFileUtil::Truncate, base::Unretained(file_util), | 273 Bind(&FileSystemFileUtil::Truncate, Unretained(file_util), |
| 274 context, path, length), | 274 context, path, length), |
| 275 callback); | 275 callback); |
| 276 } | 276 } |
| 277 | 277 |
| 278 } // namespace fileapi | 278 } // namespace fileapi |
| OLD | NEW |