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