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 "chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.h" | 5 #include "chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 280 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
281 MTPDeviceTaskHelper* task_helper = | 281 MTPDeviceTaskHelper* task_helper = |
282 GetDeviceTaskHelperForStorage(storage_name, read_only); | 282 GetDeviceTaskHelperForStorage(storage_name, read_only); |
283 if (!task_helper) | 283 if (!task_helper) |
284 return; | 284 return; |
285 task_helper->CloseStorage(); | 285 task_helper->CloseStorage(); |
286 MTPDeviceTaskHelperMapService::GetInstance()->DestroyDeviceTaskHelper( | 286 MTPDeviceTaskHelperMapService::GetInstance()->DestroyDeviceTaskHelper( |
287 storage_name, read_only); | 287 storage_name, read_only); |
288 } | 288 } |
289 | 289 |
290 // Opens |file_path| with |flags|. | 290 // Opens |file_path| with |flags|. Returns the result as a pair. |
291 int OpenFileDescriptor(const char* file_path, const int flags) { | 291 // first is file descriptor. |
| 292 // second is base::File::Error. This value is set as following. |
| 293 // - When it succeeds to open a file descriptor, base::File::FILE_OK is set. |
| 294 // - When |file_path| is a directory, base::File::FILE_ERROR_NOT_A_FILE is set. |
| 295 // - When |file_path| does not exist, base::File::FILE_ERROR_NOT_FOUND is set. |
| 296 // - For other error cases, base::File::FILE_ERROR_FAILED is set. |
| 297 std::pair<int, base::File::Error> OpenFileDescriptor(const char* file_path, |
| 298 const int flags) { |
292 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); | 299 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); |
293 | 300 |
294 return open(file_path, flags); | 301 if (base::DirectoryExists(base::FilePath(file_path))) |
| 302 return std::make_pair(-1, base::File::FILE_ERROR_NOT_A_FILE); |
| 303 int file_descriptor = open(file_path, flags); |
| 304 if (file_descriptor >= 0) |
| 305 return std::make_pair(file_descriptor, base::File::FILE_OK); |
| 306 if (errno == ENOENT) |
| 307 return std::make_pair(file_descriptor, base::File::FILE_ERROR_NOT_FOUND); |
| 308 return std::make_pair(file_descriptor, base::File::FILE_ERROR_FAILED); |
295 } | 309 } |
296 | 310 |
297 // Closes |file_descriptor| on file thread. | 311 // Closes |file_descriptor| on file thread. |
298 void CloseFileDescriptor(const int file_descriptor) { | 312 void CloseFileDescriptor(const int file_descriptor) { |
299 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); | 313 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); |
300 | 314 |
301 IGNORE_EINTR(close(file_descriptor)); | 315 IGNORE_EINTR(close(file_descriptor)); |
302 } | 316 } |
303 | 317 |
304 // Deletes a temporary file |file_path|. | 318 // Deletes a temporary file |file_path|. |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 | 631 |
618 void MTPDeviceDelegateImplLinux::CopyFileFromLocal( | 632 void MTPDeviceDelegateImplLinux::CopyFileFromLocal( |
619 const base::FilePath& source_file_path, | 633 const base::FilePath& source_file_path, |
620 const base::FilePath& device_file_path, | 634 const base::FilePath& device_file_path, |
621 const CopyFileFromLocalSuccessCallback& success_callback, | 635 const CopyFileFromLocalSuccessCallback& success_callback, |
622 const ErrorCallback& error_callback) { | 636 const ErrorCallback& error_callback) { |
623 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 637 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
624 DCHECK(!source_file_path.empty()); | 638 DCHECK(!source_file_path.empty()); |
625 DCHECK(!device_file_path.empty()); | 639 DCHECK(!device_file_path.empty()); |
626 | 640 |
627 content::BrowserThread::PostTaskAndReplyWithResult( | 641 // Get file info of destination file path. |
628 content::BrowserThread::FILE, | 642 const GetFileInfoSuccessCallback success_callback_wrapper = base::Bind( |
629 FROM_HERE, | 643 &MTPDeviceDelegateImplLinux::OnDidGetDestFileInfoToCopyFileFromLocal, |
630 base::Bind(&OpenFileDescriptor, | 644 weak_ptr_factory_.GetWeakPtr(), error_callback); |
631 source_file_path.value().c_str(), | 645 const ErrorCallback error_callback_wrapper = base::Bind( |
632 O_RDONLY), | 646 &MTPDeviceDelegateImplLinux::OnGetDestFileInfoErrorToCopyFileFromLocal, |
633 base::Bind(&MTPDeviceDelegateImplLinux::CopyFileFromLocalInternal, | 647 weak_ptr_factory_.GetWeakPtr(), source_file_path, device_file_path, |
634 weak_ptr_factory_.GetWeakPtr(), | 648 success_callback, error_callback); |
635 device_file_path, | 649 const base::Closure closure = |
636 success_callback, | 650 base::Bind(&MTPDeviceDelegateImplLinux::GetFileInfoInternal, |
637 error_callback)); | 651 weak_ptr_factory_.GetWeakPtr(), device_file_path, |
| 652 success_callback_wrapper, error_callback_wrapper); |
| 653 EnsureInitAndRunTask(PendingTaskInfo( |
| 654 device_file_path, content::BrowserThread::IO, FROM_HERE, closure)); |
638 } | 655 } |
639 | 656 |
640 void MTPDeviceDelegateImplLinux::DeleteFile( | 657 void MTPDeviceDelegateImplLinux::DeleteFile( |
641 const base::FilePath& file_path, | 658 const base::FilePath& file_path, |
642 const DeleteFileSuccessCallback& success_callback, | 659 const DeleteFileSuccessCallback& success_callback, |
643 const ErrorCallback& error_callback) { | 660 const ErrorCallback& error_callback) { |
644 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 661 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
645 DCHECK(!file_path.empty()); | 662 DCHECK(!file_path.empty()); |
646 | 663 |
647 const GetFileInfoSuccessCallback& success_callback_wrapper = | 664 const GetFileInfoSuccessCallback& success_callback_wrapper = |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 const base::FilePath& source_file_path, | 851 const base::FilePath& source_file_path, |
835 const base::FilePath& device_file_path, | 852 const base::FilePath& device_file_path, |
836 const CreateTemporaryFileCallback& create_temporary_file_callback, | 853 const CreateTemporaryFileCallback& create_temporary_file_callback, |
837 const MoveFileLocalSuccessCallback& success_callback, | 854 const MoveFileLocalSuccessCallback& success_callback, |
838 const ErrorCallback& error_callback, | 855 const ErrorCallback& error_callback, |
839 const base::File::Info& source_file_info) { | 856 const base::File::Info& source_file_info) { |
840 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 857 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
841 | 858 |
842 if (source_file_info.is_directory) { | 859 if (source_file_info.is_directory) { |
843 error_callback.Run(base::File::FILE_ERROR_NOT_A_FILE); | 860 error_callback.Run(base::File::FILE_ERROR_NOT_A_FILE); |
844 PendingRequestDone(); | |
845 return; | 861 return; |
846 } | 862 } |
847 | 863 |
848 if (source_file_path.DirName() == device_file_path.DirName()) { | 864 if (source_file_path.DirName() == device_file_path.DirName()) { |
849 // If a file is moved in a same directory, rename the file. | 865 // If a file is moved in a same directory, rename the file. |
850 uint32 file_id; | 866 uint32 file_id; |
851 if (CachedPathToId(source_file_path, &file_id)) { | 867 if (CachedPathToId(source_file_path, &file_id)) { |
852 const MTPDeviceTaskHelper::RenameObjectSuccessCallback | 868 const MTPDeviceTaskHelper::RenameObjectSuccessCallback |
853 success_callback_wrapper = base::Bind( | 869 success_callback_wrapper = base::Bind( |
854 &MTPDeviceDelegateImplLinux::OnDidMoveFileLocalWithRename, | 870 &MTPDeviceDelegateImplLinux::OnDidMoveFileLocalWithRename, |
(...skipping 15 matching lines...) Expand all Loading... |
870 // destination path, and remove source file. | 886 // destination path, and remove source file. |
871 const CopyFileLocalSuccessCallback& success_callback_wrapper = | 887 const CopyFileLocalSuccessCallback& success_callback_wrapper = |
872 base::Bind(&MTPDeviceDelegateImplLinux::DeleteFileInternal, | 888 base::Bind(&MTPDeviceDelegateImplLinux::DeleteFileInternal, |
873 weak_ptr_factory_.GetWeakPtr(), source_file_path, | 889 weak_ptr_factory_.GetWeakPtr(), source_file_path, |
874 success_callback, error_callback, source_file_info); | 890 success_callback, error_callback, source_file_info); |
875 CopyFileLocal(source_file_path, device_file_path, | 891 CopyFileLocal(source_file_path, device_file_path, |
876 create_temporary_file_callback, | 892 create_temporary_file_callback, |
877 base::Bind(&FakeCopyFileProgressCallback), | 893 base::Bind(&FakeCopyFileProgressCallback), |
878 success_callback_wrapper, error_callback); | 894 success_callback_wrapper, error_callback); |
879 } | 895 } |
880 | |
881 PendingRequestDone(); | |
882 } | 896 } |
883 | 897 |
884 void MTPDeviceDelegateImplLinux::CopyFileFromLocalInternal( | 898 void MTPDeviceDelegateImplLinux::OnDidOpenFDToCopyFileFromLocal( |
885 const base::FilePath& device_file_path, | 899 const base::FilePath& device_file_path, |
886 const CopyFileFromLocalSuccessCallback& success_callback, | 900 const CopyFileFromLocalSuccessCallback& success_callback, |
887 const ErrorCallback& error_callback, | 901 const ErrorCallback& error_callback, |
888 const int source_file_descriptor) { | 902 const std::pair<int, base::File::Error>& open_fd_result) { |
889 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 903 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
890 | 904 |
891 if (source_file_descriptor < 0) { | 905 if (open_fd_result.second != base::File::FILE_OK) { |
892 error_callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); | 906 error_callback.Run(open_fd_result.second); |
893 PendingRequestDone(); | |
894 return; | 907 return; |
895 } | 908 } |
896 | 909 |
| 910 const int source_file_descriptor = open_fd_result.first; |
897 uint32 parent_id; | 911 uint32 parent_id; |
898 if (CachedPathToId(device_file_path.DirName(), &parent_id)) { | 912 if (CachedPathToId(device_file_path.DirName(), &parent_id)) { |
899 CopyFileFromLocalSuccessCallback success_callback_wrapper = | 913 CopyFileFromLocalSuccessCallback success_callback_wrapper = |
900 base::Bind(&MTPDeviceDelegateImplLinux::OnDidCopyFileFromLocal, | 914 base::Bind(&MTPDeviceDelegateImplLinux::OnDidCopyFileFromLocal, |
901 weak_ptr_factory_.GetWeakPtr(), success_callback, | 915 weak_ptr_factory_.GetWeakPtr(), success_callback, |
902 source_file_descriptor); | 916 source_file_descriptor); |
903 | 917 |
904 ErrorCallback error_callback_wrapper = base::Bind( | 918 ErrorCallback error_callback_wrapper = base::Bind( |
905 &MTPDeviceDelegateImplLinux::HandleCopyFileFromLocalError, | 919 &MTPDeviceDelegateImplLinux::HandleCopyFileFromLocalError, |
906 weak_ptr_factory_.GetWeakPtr(), error_callback, source_file_descriptor); | 920 weak_ptr_factory_.GetWeakPtr(), error_callback, source_file_descriptor); |
907 | 921 |
908 base::Closure closure = base::Bind(&CopyFileFromLocalOnUIThread, | 922 base::Closure closure = base::Bind(&CopyFileFromLocalOnUIThread, |
909 storage_name_, | 923 storage_name_, |
910 read_only_, | 924 read_only_, |
911 source_file_descriptor, | 925 source_file_descriptor, |
912 parent_id, | 926 parent_id, |
913 device_file_path.BaseName().value(), | 927 device_file_path.BaseName().value(), |
914 success_callback_wrapper, | 928 success_callback_wrapper, |
915 error_callback_wrapper); | 929 error_callback_wrapper); |
916 | 930 |
917 EnsureInitAndRunTask(PendingTaskInfo( | 931 EnsureInitAndRunTask(PendingTaskInfo( |
918 base::FilePath(), content::BrowserThread::UI, FROM_HERE, closure)); | 932 base::FilePath(), content::BrowserThread::UI, FROM_HERE, closure)); |
919 } else { | 933 } else { |
920 HandleCopyFileFromLocalError(error_callback, source_file_descriptor, | 934 HandleCopyFileFromLocalError(error_callback, source_file_descriptor, |
921 base::File::FILE_ERROR_INVALID_OPERATION); | 935 base::File::FILE_ERROR_NOT_FOUND); |
922 } | 936 } |
923 | |
924 PendingRequestDone(); | |
925 } | 937 } |
926 | 938 |
927 void MTPDeviceDelegateImplLinux::DeleteFileInternal( | 939 void MTPDeviceDelegateImplLinux::DeleteFileInternal( |
928 const base::FilePath& file_path, | 940 const base::FilePath& file_path, |
929 const DeleteFileSuccessCallback& success_callback, | 941 const DeleteFileSuccessCallback& success_callback, |
930 const ErrorCallback& error_callback, | 942 const ErrorCallback& error_callback, |
931 const base::File::Info& file_info) { | 943 const base::File::Info& file_info) { |
932 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 944 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
933 | 945 |
934 if (file_info.is_directory) { | 946 if (file_info.is_directory) { |
935 error_callback.Run(base::File::FILE_ERROR_NOT_A_FILE); | 947 error_callback.Run(base::File::FILE_ERROR_NOT_A_FILE); |
936 } else { | 948 } else { |
937 uint32 file_id; | 949 uint32 file_id; |
938 if (CachedPathToId(file_path, &file_id)) | 950 if (CachedPathToId(file_path, &file_id)) |
939 RunDeleteObjectOnUIThread(file_id, success_callback, error_callback); | 951 RunDeleteObjectOnUIThread(file_id, success_callback, error_callback); |
940 else | 952 else |
941 error_callback.Run(base::File::FILE_ERROR_NOT_FOUND); | 953 error_callback.Run(base::File::FILE_ERROR_NOT_FOUND); |
942 } | 954 } |
943 | |
944 PendingRequestDone(); | |
945 } | 955 } |
946 | 956 |
947 void MTPDeviceDelegateImplLinux::DeleteDirectoryInternal( | 957 void MTPDeviceDelegateImplLinux::DeleteDirectoryInternal( |
948 const base::FilePath& file_path, | 958 const base::FilePath& file_path, |
949 const DeleteDirectorySuccessCallback& success_callback, | 959 const DeleteDirectorySuccessCallback& success_callback, |
950 const ErrorCallback& error_callback, | 960 const ErrorCallback& error_callback, |
951 const base::File::Info& file_info) { | 961 const base::File::Info& file_info) { |
952 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 962 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
953 | 963 |
954 if (!file_info.is_directory) { | 964 if (!file_info.is_directory) { |
955 error_callback.Run(base::File::FILE_ERROR_NOT_A_DIRECTORY); | 965 error_callback.Run(base::File::FILE_ERROR_NOT_A_DIRECTORY); |
956 PendingRequestDone(); | |
957 return; | 966 return; |
958 } | 967 } |
959 | 968 |
960 uint32 directory_id; | 969 uint32 directory_id; |
961 if (!CachedPathToId(file_path, &directory_id)) { | 970 if (!CachedPathToId(file_path, &directory_id)) { |
962 error_callback.Run(base::File::FILE_ERROR_NOT_FOUND); | 971 error_callback.Run(base::File::FILE_ERROR_NOT_FOUND); |
963 PendingRequestDone(); | |
964 return; | 972 return; |
965 } | 973 } |
966 | 974 |
967 // Checks the cache first. If it has children in cache, the directory cannot | 975 // Checks the cache first. If it has children in cache, the directory cannot |
968 // be empty. | 976 // be empty. |
969 FileIdToMTPFileNodeMap::const_iterator it = | 977 FileIdToMTPFileNodeMap::const_iterator it = |
970 file_id_to_node_map_.find(directory_id); | 978 file_id_to_node_map_.find(directory_id); |
971 if (it != file_id_to_node_map_.end() && it->second->HasChildren()) { | 979 if (it != file_id_to_node_map_.end() && it->second->HasChildren()) { |
972 error_callback.Run(base::File::FILE_ERROR_NOT_EMPTY); | 980 error_callback.Run(base::File::FILE_ERROR_NOT_EMPTY); |
973 PendingRequestDone(); | |
974 return; | 981 return; |
975 } | 982 } |
976 | 983 |
977 // Since the directory can contain a file even if the cache returns it as | 984 // Since the directory can contain a file even if the cache returns it as |
978 // empty, read the directory and confirm the directory is actually empty. | 985 // empty, read the directory and confirm the directory is actually empty. |
979 const MTPDeviceTaskHelper::ReadDirectorySuccessCallback | 986 const MTPDeviceTaskHelper::ReadDirectorySuccessCallback |
980 success_callback_wrapper = base::Bind( | 987 success_callback_wrapper = base::Bind( |
981 &MTPDeviceDelegateImplLinux::OnDidReadDirectoryToDeleteDirectory, | 988 &MTPDeviceDelegateImplLinux::OnDidReadDirectoryToDeleteDirectory, |
982 weak_ptr_factory_.GetWeakPtr(), directory_id, success_callback, | 989 weak_ptr_factory_.GetWeakPtr(), directory_id, success_callback, |
983 error_callback); | 990 error_callback); |
984 const MTPDeviceTaskHelper::ErrorCallback error_callback_wrapper = | 991 const MTPDeviceTaskHelper::ErrorCallback error_callback_wrapper = |
985 base::Bind(&MTPDeviceDelegateImplLinux::HandleDeviceFileError, | 992 base::Bind(&MTPDeviceDelegateImplLinux::HandleDeviceFileError, |
986 weak_ptr_factory_.GetWeakPtr(), error_callback, directory_id); | 993 weak_ptr_factory_.GetWeakPtr(), error_callback, directory_id); |
987 const base::Closure closure = base::Bind( | 994 const base::Closure closure = base::Bind( |
988 &ReadDirectoryOnUIThread, storage_name_, read_only_, directory_id, | 995 &ReadDirectoryOnUIThread, storage_name_, read_only_, directory_id, |
989 1 /* max_size */, success_callback_wrapper, error_callback_wrapper); | 996 1 /* max_size */, success_callback_wrapper, error_callback_wrapper); |
990 EnsureInitAndRunTask(PendingTaskInfo( | 997 EnsureInitAndRunTask(PendingTaskInfo( |
991 base::FilePath(), content::BrowserThread::UI, FROM_HERE, closure)); | 998 base::FilePath(), content::BrowserThread::UI, FROM_HERE, closure)); |
992 PendingRequestDone(); | |
993 } | 999 } |
994 | 1000 |
995 void MTPDeviceDelegateImplLinux::OnDidReadDirectoryToDeleteDirectory( | 1001 void MTPDeviceDelegateImplLinux::OnDidReadDirectoryToDeleteDirectory( |
996 const uint32 directory_id, | 1002 const uint32 directory_id, |
997 const DeleteDirectorySuccessCallback& success_callback, | 1003 const DeleteDirectorySuccessCallback& success_callback, |
998 const ErrorCallback& error_callback, | 1004 const ErrorCallback& error_callback, |
999 const storage::AsyncFileUtil::EntryList& entries, | 1005 const storage::AsyncFileUtil::EntryList& entries, |
1000 const bool has_more) { | 1006 const bool has_more) { |
1001 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 1007 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
1002 DCHECK(!has_more); | 1008 DCHECK(!has_more); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 | 1192 |
1187 current_snapshot_request_info_.reset(snapshot_request_info.release()); | 1193 current_snapshot_request_info_.reset(snapshot_request_info.release()); |
1188 if (file_info.size == 0) { | 1194 if (file_info.size == 0) { |
1189 // Empty snapshot file. | 1195 // Empty snapshot file. |
1190 return OnDidWriteDataIntoSnapshotFile( | 1196 return OnDidWriteDataIntoSnapshotFile( |
1191 snapshot_file_info, current_snapshot_request_info_->snapshot_file_path); | 1197 snapshot_file_info, current_snapshot_request_info_->snapshot_file_path); |
1192 } | 1198 } |
1193 WriteDataIntoSnapshotFile(snapshot_file_info); | 1199 WriteDataIntoSnapshotFile(snapshot_file_info); |
1194 } | 1200 } |
1195 | 1201 |
| 1202 void MTPDeviceDelegateImplLinux::OnDidGetDestFileInfoToCopyFileFromLocal( |
| 1203 const ErrorCallback& error_callback, |
| 1204 const base::File::Info& file_info) { |
| 1205 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 1206 |
| 1207 if (file_info.is_directory) |
| 1208 error_callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); |
| 1209 else |
| 1210 error_callback.Run(base::File::FILE_ERROR_FAILED); |
| 1211 } |
| 1212 |
| 1213 void MTPDeviceDelegateImplLinux::OnGetDestFileInfoErrorToCopyFileFromLocal( |
| 1214 const base::FilePath& source_file_path, |
| 1215 const base::FilePath& device_file_path, |
| 1216 const CopyFileFromLocalSuccessCallback& success_callback, |
| 1217 const ErrorCallback& error_callback, |
| 1218 const base::File::Error error) { |
| 1219 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 1220 |
| 1221 if (error != base::File::FILE_ERROR_NOT_FOUND) { |
| 1222 error_callback.Run(error); |
| 1223 return; |
| 1224 } |
| 1225 |
| 1226 content::BrowserThread::PostTaskAndReplyWithResult( |
| 1227 content::BrowserThread::FILE, FROM_HERE, |
| 1228 base::Bind(&OpenFileDescriptor, source_file_path.value().c_str(), |
| 1229 O_RDONLY), |
| 1230 base::Bind(&MTPDeviceDelegateImplLinux::OnDidOpenFDToCopyFileFromLocal, |
| 1231 weak_ptr_factory_.GetWeakPtr(), device_file_path, |
| 1232 success_callback, error_callback)); |
| 1233 } |
| 1234 |
1196 void MTPDeviceDelegateImplLinux::OnDidReadDirectory( | 1235 void MTPDeviceDelegateImplLinux::OnDidReadDirectory( |
1197 uint32 dir_id, | 1236 uint32 dir_id, |
1198 const ReadDirectorySuccessCallback& success_callback, | 1237 const ReadDirectorySuccessCallback& success_callback, |
1199 const storage::AsyncFileUtil::EntryList& file_list, | 1238 const storage::AsyncFileUtil::EntryList& file_list, |
1200 bool has_more) { | 1239 bool has_more) { |
1201 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 1240 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
1202 | 1241 |
1203 FileIdToMTPFileNodeMap::iterator it = file_id_to_node_map_.find(dir_id); | 1242 FileIdToMTPFileNodeMap::iterator it = file_id_to_node_map_.find(dir_id); |
1204 DCHECK(it != file_id_to_node_map_.end()); | 1243 DCHECK(it != file_id_to_node_map_.end()); |
1205 MTPFileNode* dir_node = it->second; | 1244 MTPFileNode* dir_node = it->second; |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1517 } | 1556 } |
1518 } | 1557 } |
1519 | 1558 |
1520 void CreateMTPDeviceAsyncDelegate( | 1559 void CreateMTPDeviceAsyncDelegate( |
1521 const std::string& device_location, | 1560 const std::string& device_location, |
1522 const bool read_only, | 1561 const bool read_only, |
1523 const CreateMTPDeviceAsyncDelegateCallback& callback) { | 1562 const CreateMTPDeviceAsyncDelegateCallback& callback) { |
1524 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 1563 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
1525 callback.Run(new MTPDeviceDelegateImplLinux(device_location, read_only)); | 1564 callback.Run(new MTPDeviceDelegateImplLinux(device_location, read_only)); |
1526 } | 1565 } |
OLD | NEW |