| 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/local_file_system_operation.h" | 5 #include "webkit/fileapi/local_file_system_operation.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 base::Bind(&LocalFileSystemOperation::DidGetMetadata, | 234 base::Bind(&LocalFileSystemOperation::DidGetMetadata, |
| 235 base::Owned(this), callback)); | 235 base::Owned(this), callback)); |
| 236 } | 236 } |
| 237 | 237 |
| 238 void LocalFileSystemOperation::ReadDirectory( | 238 void LocalFileSystemOperation::ReadDirectory( |
| 239 const FileSystemURL& url, const ReadDirectoryCallback& callback) { | 239 const FileSystemURL& url, const ReadDirectoryCallback& callback) { |
| 240 DCHECK(SetPendingOperationType(kOperationReadDirectory)); | 240 DCHECK(SetPendingOperationType(kOperationReadDirectory)); |
| 241 | 241 |
| 242 base::PlatformFileError result = SetUp(url, OPERATION_MODE_READ); | 242 base::PlatformFileError result = SetUp(url, OPERATION_MODE_READ); |
| 243 if (result != base::PLATFORM_FILE_OK) { | 243 if (result != base::PLATFORM_FILE_OK) { |
| 244 callback.Run(result, std::vector<base::FileUtilProxy::Entry>(), false); | 244 callback.Run(result, std::vector<DirectoryEntry>(), false); |
| 245 delete this; | 245 delete this; |
| 246 return; | 246 return; |
| 247 } | 247 } |
| 248 | 248 |
| 249 async_file_util_->ReadDirectory( | 249 async_file_util_->ReadDirectory( |
| 250 operation_context(), url, | 250 operation_context(), url, |
| 251 base::Bind(&LocalFileSystemOperation::DidReadDirectory, | 251 base::Bind(&LocalFileSystemOperation::DidReadDirectory, |
| 252 base::Owned(this), callback)); | 252 base::Owned(this), callback)); |
| 253 } | 253 } |
| 254 | 254 |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 const GetMetadataCallback& callback, | 779 const GetMetadataCallback& callback, |
| 780 base::PlatformFileError rv, | 780 base::PlatformFileError rv, |
| 781 const base::PlatformFileInfo& file_info, | 781 const base::PlatformFileInfo& file_info, |
| 782 const base::FilePath& platform_path) { | 782 const base::FilePath& platform_path) { |
| 783 callback.Run(rv, file_info, platform_path); | 783 callback.Run(rv, file_info, platform_path); |
| 784 } | 784 } |
| 785 | 785 |
| 786 void LocalFileSystemOperation::DidReadDirectory( | 786 void LocalFileSystemOperation::DidReadDirectory( |
| 787 const ReadDirectoryCallback& callback, | 787 const ReadDirectoryCallback& callback, |
| 788 base::PlatformFileError rv, | 788 base::PlatformFileError rv, |
| 789 const std::vector<base::FileUtilProxy::Entry>& entries, | 789 const std::vector<DirectoryEntry>& entries, |
| 790 bool has_more) { | 790 bool has_more) { |
| 791 callback.Run(rv, entries, has_more); | 791 callback.Run(rv, entries, has_more); |
| 792 } | 792 } |
| 793 | 793 |
| 794 void LocalFileSystemOperation::DidWrite( | 794 void LocalFileSystemOperation::DidWrite( |
| 795 const FileSystemURL& url, | 795 const FileSystemURL& url, |
| 796 base::PlatformFileError rv, | 796 base::PlatformFileError rv, |
| 797 int64 bytes, | 797 int64 bytes, |
| 798 FileWriterDelegate::WriteProgressStatus write_status) { | 798 FileWriterDelegate::WriteProgressStatus write_status) { |
| 799 if (write_callback_.is_null()) { | 799 if (write_callback_.is_null()) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 } | 872 } |
| 873 | 873 |
| 874 bool LocalFileSystemOperation::SetPendingOperationType(OperationType type) { | 874 bool LocalFileSystemOperation::SetPendingOperationType(OperationType type) { |
| 875 if (pending_operation_ != kOperationNone) | 875 if (pending_operation_ != kOperationNone) |
| 876 return false; | 876 return false; |
| 877 pending_operation_ = type; | 877 pending_operation_ = type; |
| 878 return true; | 878 return true; |
| 879 } | 879 } |
| 880 | 880 |
| 881 } // namespace fileapi | 881 } // namespace fileapi |
| OLD | NEW |