| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
| 8 #include "webkit/fileapi/file_system_context.h" | 8 #include "webkit/fileapi/file_system_context.h" |
| 9 #include "webkit/fileapi/file_system_file_util.h" | 9 #include "webkit/fileapi/file_system_file_util.h" |
| 10 #include "webkit/fileapi/file_system_operation_context.h" | 10 #include "webkit/fileapi/file_system_operation_context.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 fileapi::FileSystemFileUtilProxy::GetLocalPathCallback* callback_; | 217 fileapi::FileSystemFileUtilProxy::GetLocalPathCallback* callback_; |
| 218 FilePath virtual_path_; | 218 FilePath virtual_path_; |
| 219 FilePath local_path_; | 219 FilePath local_path_; |
| 220 }; | 220 }; |
| 221 | 221 |
| 222 class RelayGetFileInfo : public MessageLoopRelay { | 222 class RelayGetFileInfo : public MessageLoopRelay { |
| 223 public: | 223 public: |
| 224 RelayGetFileInfo( | 224 RelayGetFileInfo( |
| 225 const fileapi::FileSystemOperationContext& context, | 225 const fileapi::FileSystemOperationContext& context, |
| 226 const FilePath& file_path, | 226 const FilePath& file_path, |
| 227 fileapi::FileSystemFileUtilProxy::GetFileInfoCallback* callback) | 227 const fileapi::FileSystemFileUtilProxy::GetFileInfoCallback& callback) |
| 228 : MessageLoopRelay(context), | 228 : MessageLoopRelay(context), |
| 229 callback_(callback), | 229 callback_(callback), |
| 230 file_path_(file_path) { | 230 file_path_(file_path) { |
| 231 DCHECK(callback); | 231 DCHECK_EQ(false, callback.is_null()); |
| 232 } | 232 } |
| 233 | 233 |
| 234 protected: | 234 protected: |
| 235 virtual void RunWork() { | 235 virtual void RunWork() { |
| 236 set_error_code(file_util()->GetFileInfo( | 236 set_error_code(file_util()->GetFileInfo( |
| 237 context(), file_path_, &file_info_, &platform_path_)); | 237 context(), file_path_, &file_info_, &platform_path_)); |
| 238 } | 238 } |
| 239 | 239 |
| 240 virtual void RunCallback() { | 240 virtual void RunCallback() { |
| 241 callback_->Run(error_code(), file_info_, platform_path_); | 241 callback_.Run(error_code(), file_info_, platform_path_); |
| 242 delete callback_; | |
| 243 } | 242 } |
| 244 | 243 |
| 245 private: | 244 private: |
| 246 fileapi::FileSystemFileUtilProxy::GetFileInfoCallback* callback_; | 245 fileapi::FileSystemFileUtilProxy::GetFileInfoCallback callback_; |
| 247 FilePath file_path_; | 246 FilePath file_path_; |
| 248 base::PlatformFileInfo file_info_; | 247 base::PlatformFileInfo file_info_; |
| 249 FilePath platform_path_; | 248 FilePath platform_path_; |
| 250 }; | 249 }; |
| 251 | 250 |
| 252 class RelayReadDirectory : public MessageLoopRelay { | 251 class RelayReadDirectory : public MessageLoopRelay { |
| 253 public: | 252 public: |
| 254 RelayReadDirectory( | 253 RelayReadDirectory( |
| 255 const fileapi::FileSystemOperationContext& context, | 254 const fileapi::FileSystemOperationContext& context, |
| 256 const FilePath& file_path, | 255 const FilePath& file_path, |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 GetLocalPathCallback* callback) { | 462 GetLocalPathCallback* callback) { |
| 464 return Start(FROM_HERE, message_loop_proxy, | 463 return Start(FROM_HERE, message_loop_proxy, |
| 465 new RelayGetLocalPath(context, virtual_path, callback)); | 464 new RelayGetLocalPath(context, virtual_path, callback)); |
| 466 } | 465 } |
| 467 | 466 |
| 468 // static | 467 // static |
| 469 bool FileSystemFileUtilProxy::GetFileInfo( | 468 bool FileSystemFileUtilProxy::GetFileInfo( |
| 470 const FileSystemOperationContext& context, | 469 const FileSystemOperationContext& context, |
| 471 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 470 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| 472 const FilePath& file_path, | 471 const FilePath& file_path, |
| 473 GetFileInfoCallback* callback) { | 472 const GetFileInfoCallback& callback) { |
| 474 return Start(FROM_HERE, message_loop_proxy, new RelayGetFileInfo(context, | 473 return Start(FROM_HERE, message_loop_proxy, new RelayGetFileInfo(context, |
| 475 file_path, callback)); | 474 file_path, callback)); |
| 476 } | 475 } |
| 477 | 476 |
| 478 // static | 477 // static |
| 479 bool FileSystemFileUtilProxy::ReadDirectory( | 478 bool FileSystemFileUtilProxy::ReadDirectory( |
| 480 const FileSystemOperationContext& context, | 479 const FileSystemOperationContext& context, |
| 481 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 480 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| 482 const FilePath& file_path, | 481 const FilePath& file_path, |
| 483 ReadDirectoryCallback* callback) { | 482 ReadDirectoryCallback* callback) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 const FileSystemOperationContext& context, | 549 const FileSystemOperationContext& context, |
| 551 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 550 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| 552 const FilePath& path, | 551 const FilePath& path, |
| 553 int64 length, | 552 int64 length, |
| 554 StatusCallback* callback) { | 553 StatusCallback* callback) { |
| 555 return Start(FROM_HERE, message_loop_proxy, | 554 return Start(FROM_HERE, message_loop_proxy, |
| 556 new RelayTruncate(context, path, length, callback)); | 555 new RelayTruncate(context, path, length, callback)); |
| 557 } | 556 } |
| 558 | 557 |
| 559 } // namespace fileapi | 558 } // namespace fileapi |
| OLD | NEW |