| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // static | 94 // static |
| 94 bool FileSystemFileUtilProxy::Delete( | 95 bool FileSystemFileUtilProxy::Delete( |
| 95 MessageLoopProxy* message_loop_proxy, | 96 MessageLoopProxy* message_loop_proxy, |
| 96 FileSystemOperationContext* context, | 97 FileSystemOperationContext* context, |
| 97 FileSystemFileUtil* file_util, | 98 FileSystemFileUtil* file_util, |
| 98 const FileSystemPath& path, | 99 const FileSystemPath& path, |
| 99 bool recursive, | 100 bool recursive, |
| 100 const StatusCallback& callback) { | 101 const StatusCallback& callback) { |
| 101 return base::FileUtilProxy::RelayFileTask( | 102 return base::FileUtilProxy::RelayFileTask( |
| 102 message_loop_proxy, FROM_HERE, | 103 message_loop_proxy, FROM_HERE, |
| 103 base::Bind(&FileSystemFileUtil::Delete, base::Unretained(file_util), | 104 Bind(&DeletePath, context, file_util, path, recursive), |
| 104 context, path, recursive), | |
| 105 callback); | 105 callback); |
| 106 } | 106 } |
| 107 | 107 |
| 108 // static | 108 // static |
| 109 bool FileSystemFileUtilProxy::CreateOrOpen( | 109 bool FileSystemFileUtilProxy::CreateOrOpen( |
| 110 MessageLoopProxy* message_loop_proxy, | 110 MessageLoopProxy* message_loop_proxy, |
| 111 FileSystemOperationContext* context, | 111 FileSystemOperationContext* context, |
| 112 FileSystemFileUtil* file_util, | 112 FileSystemFileUtil* file_util, |
| 113 const FileSystemPath& path, | 113 const FileSystemPath& path, |
| 114 int file_flags, | 114 int file_flags, |
| 115 const CreateOrOpenCallback& callback) { | 115 const CreateOrOpenCallback& callback) { |
| 116 return base::FileUtilProxy::RelayCreateOrOpen( | 116 return base::FileUtilProxy::RelayCreateOrOpen( |
| 117 message_loop_proxy, | 117 message_loop_proxy, |
| 118 base::Bind(&FileSystemFileUtil::CreateOrOpen, base::Unretained(file_util), | 118 Bind(&FileSystemFileUtil::CreateOrOpen, Unretained(file_util), |
| 119 context, path, file_flags), | 119 context, path, file_flags), |
| 120 base::Bind(&FileSystemFileUtil::Close, base::Unretained(file_util), | 120 Bind(&FileSystemFileUtil::Close, Unretained(file_util), |
| 121 context), | 121 context), |
| 122 callback); | 122 callback); |
| 123 } | 123 } |
| 124 | 124 |
| 125 // static | 125 // static |
| 126 bool FileSystemFileUtilProxy::Copy( | 126 bool FileSystemFileUtilProxy::Copy( |
| 127 MessageLoopProxy* message_loop_proxy, | 127 MessageLoopProxy* message_loop_proxy, |
| 128 FileSystemOperationContext* context, | 128 FileSystemOperationContext* context, |
| 129 FileSystemFileUtil* src_util, | 129 FileSystemFileUtil* src_util, |
| 130 FileSystemFileUtil* dest_util, | 130 FileSystemFileUtil* dest_util, |
| 131 const FileSystemPath& src_path, | 131 const FileSystemPath& src_path, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 bool FileSystemFileUtilProxy::CreateDirectory( | 180 bool FileSystemFileUtilProxy::CreateDirectory( |
| 181 MessageLoopProxy* message_loop_proxy, | 181 MessageLoopProxy* message_loop_proxy, |
| 182 FileSystemOperationContext* context, | 182 FileSystemOperationContext* context, |
| 183 FileSystemFileUtil* file_util, | 183 FileSystemFileUtil* file_util, |
| 184 const FileSystemPath& path, | 184 const FileSystemPath& path, |
| 185 bool exclusive, | 185 bool exclusive, |
| 186 bool recursive, | 186 bool recursive, |
| 187 const StatusCallback& callback) { | 187 const StatusCallback& callback) { |
| 188 return base::FileUtilProxy::RelayFileTask( | 188 return base::FileUtilProxy::RelayFileTask( |
| 189 message_loop_proxy, FROM_HERE, | 189 message_loop_proxy, FROM_HERE, |
| 190 base::Bind(&FileSystemFileUtil::CreateDirectory, | 190 Bind(&FileSystemFileUtil::CreateDirectory, Unretained(file_util), |
| 191 base::Unretained(file_util), | 191 context, path, exclusive, recursive), |
| 192 context, path, exclusive, recursive), | |
| 193 callback); | 192 callback); |
| 194 } | 193 } |
| 195 | 194 |
| 196 // static | 195 // static |
| 197 bool FileSystemFileUtilProxy::GetFileInfo( | 196 bool FileSystemFileUtilProxy::GetFileInfo( |
| 198 MessageLoopProxy* message_loop_proxy, | 197 MessageLoopProxy* message_loop_proxy, |
| 199 FileSystemOperationContext* context, | 198 FileSystemOperationContext* context, |
| 200 FileSystemFileUtil* file_util, | 199 FileSystemFileUtil* file_util, |
| 201 const FileSystemPath& path, | 200 const FileSystemPath& path, |
| 202 const GetFileInfoCallback& callback) { | 201 const GetFileInfoCallback& callback) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 227 bool FileSystemFileUtilProxy::Touch( | 226 bool FileSystemFileUtilProxy::Touch( |
| 228 MessageLoopProxy* message_loop_proxy, | 227 MessageLoopProxy* message_loop_proxy, |
| 229 FileSystemOperationContext* context, | 228 FileSystemOperationContext* context, |
| 230 FileSystemFileUtil* file_util, | 229 FileSystemFileUtil* file_util, |
| 231 const FileSystemPath& path, | 230 const FileSystemPath& path, |
| 232 const base::Time& last_access_time, | 231 const base::Time& last_access_time, |
| 233 const base::Time& last_modified_time, | 232 const base::Time& last_modified_time, |
| 234 const StatusCallback& callback) { | 233 const StatusCallback& callback) { |
| 235 return base::FileUtilProxy::RelayFileTask( | 234 return base::FileUtilProxy::RelayFileTask( |
| 236 message_loop_proxy, FROM_HERE, | 235 message_loop_proxy, FROM_HERE, |
| 237 base::Bind(&FileSystemFileUtil::Touch, base::Unretained(file_util), | 236 Bind(&FileSystemFileUtil::Touch, Unretained(file_util), |
| 238 context, path, last_access_time, last_modified_time), | 237 context, path, last_access_time, last_modified_time), |
| 239 callback); | 238 callback); |
| 240 } | 239 } |
| 241 | 240 |
| 242 // static | 241 // static |
| 243 bool FileSystemFileUtilProxy::Truncate( | 242 bool FileSystemFileUtilProxy::Truncate( |
| 244 MessageLoopProxy* message_loop_proxy, | 243 MessageLoopProxy* message_loop_proxy, |
| 245 FileSystemOperationContext* context, | 244 FileSystemOperationContext* context, |
| 246 FileSystemFileUtil* file_util, | 245 FileSystemFileUtil* file_util, |
| 247 const FileSystemPath& path, | 246 const FileSystemPath& path, |
| 248 int64 length, | 247 int64 length, |
| 249 const StatusCallback& callback) { | 248 const StatusCallback& callback) { |
| 250 return base::FileUtilProxy::RelayFileTask( | 249 return base::FileUtilProxy::RelayFileTask( |
| 251 message_loop_proxy, FROM_HERE, | 250 message_loop_proxy, FROM_HERE, |
| 252 base::Bind(&FileSystemFileUtil::Truncate, base::Unretained(file_util), | 251 Bind(&FileSystemFileUtil::Truncate, Unretained(file_util), |
| 253 context, path, length), | 252 context, path, length), |
| 254 callback); | 253 callback); |
| 255 } | 254 } |
| 256 | 255 |
| 257 } // namespace fileapi | 256 } // namespace fileapi |
| OLD | NEW |