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); |
Lei Zhang
2015/03/24 08:49:02
Before you open the file, you also need to make su
yawano
2015/03/25 05:01:32
Done. I added check for ENOTDIR of open().
Lei Zhang
2015/03/27 00:08:19
I don't think that does the same thing. Let's say
yawano
2015/03/27 01:53:00
Yes, ENOTDIR is not enough. Done. Thank you!
| |
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::OnDidGetFileInfoToCopyFileFromLocal, |
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::OnGetFileInfoErrorToCopyFileFromLocal, |
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 == EACCES) |
Lei Zhang
2015/03/24 08:49:02
I think you want ENOENT.
yawano
2015/03/25 05:01:32
Done.
| |
893 PendingRequestDone(); | 897 error_callback.Run(base::File::FILE_ERROR_NOT_FOUND); |
898 else | |
899 error_callback.Run(base::File::FILE_ERROR_FAILED); | |
900 | |
894 return; | 901 return; |
895 } | 902 } |
896 | 903 |
897 uint32 parent_id; | 904 uint32 parent_id; |
898 if (CachedPathToId(device_file_path.DirName(), &parent_id)) { | 905 if (CachedPathToId(device_file_path.DirName(), &parent_id)) { |
899 CopyFileFromLocalSuccessCallback success_callback_wrapper = | 906 CopyFileFromLocalSuccessCallback success_callback_wrapper = |
900 base::Bind(&MTPDeviceDelegateImplLinux::OnDidCopyFileFromLocal, | 907 base::Bind(&MTPDeviceDelegateImplLinux::OnDidCopyFileFromLocal, |
901 weak_ptr_factory_.GetWeakPtr(), success_callback, | 908 weak_ptr_factory_.GetWeakPtr(), success_callback, |
902 source_file_descriptor); | 909 source_file_descriptor); |
903 | 910 |
904 ErrorCallback error_callback_wrapper = base::Bind( | 911 ErrorCallback error_callback_wrapper = base::Bind( |
905 &MTPDeviceDelegateImplLinux::HandleCopyFileFromLocalError, | 912 &MTPDeviceDelegateImplLinux::HandleCopyFileFromLocalError, |
906 weak_ptr_factory_.GetWeakPtr(), error_callback, source_file_descriptor); | 913 weak_ptr_factory_.GetWeakPtr(), error_callback, source_file_descriptor); |
907 | 914 |
908 base::Closure closure = base::Bind(&CopyFileFromLocalOnUIThread, | 915 base::Closure closure = base::Bind(&CopyFileFromLocalOnUIThread, |
909 storage_name_, | 916 storage_name_, |
910 read_only_, | 917 read_only_, |
911 source_file_descriptor, | 918 source_file_descriptor, |
912 parent_id, | 919 parent_id, |
913 device_file_path.BaseName().value(), | 920 device_file_path.BaseName().value(), |
914 success_callback_wrapper, | 921 success_callback_wrapper, |
915 error_callback_wrapper); | 922 error_callback_wrapper); |
916 | 923 |
917 EnsureInitAndRunTask(PendingTaskInfo( | 924 EnsureInitAndRunTask(PendingTaskInfo( |
918 base::FilePath(), content::BrowserThread::UI, FROM_HERE, closure)); | 925 base::FilePath(), content::BrowserThread::UI, FROM_HERE, closure)); |
919 } else { | 926 } else { |
920 HandleCopyFileFromLocalError(error_callback, source_file_descriptor, | 927 HandleCopyFileFromLocalError(error_callback, source_file_descriptor, |
921 base::File::FILE_ERROR_INVALID_OPERATION); | 928 base::File::FILE_ERROR_NOT_FOUND); |
922 } | 929 } |
923 | |
924 PendingRequestDone(); | |
925 } | 930 } |
926 | 931 |
927 void MTPDeviceDelegateImplLinux::DeleteFileInternal( | 932 void MTPDeviceDelegateImplLinux::DeleteFileInternal( |
928 const base::FilePath& file_path, | 933 const base::FilePath& file_path, |
929 const DeleteFileSuccessCallback& success_callback, | 934 const DeleteFileSuccessCallback& success_callback, |
930 const ErrorCallback& error_callback, | 935 const ErrorCallback& error_callback, |
931 const base::File::Info& file_info) { | 936 const base::File::Info& file_info) { |
932 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 937 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
933 | 938 |
934 if (file_info.is_directory) { | 939 if (file_info.is_directory) { |
935 error_callback.Run(base::File::FILE_ERROR_NOT_A_FILE); | 940 error_callback.Run(base::File::FILE_ERROR_NOT_A_FILE); |
936 } else { | 941 } else { |
937 uint32 file_id; | 942 uint32 file_id; |
938 if (CachedPathToId(file_path, &file_id)) | 943 if (CachedPathToId(file_path, &file_id)) |
939 RunDeleteObjectOnUIThread(file_id, success_callback, error_callback); | 944 RunDeleteObjectOnUIThread(file_id, success_callback, error_callback); |
940 else | 945 else |
941 error_callback.Run(base::File::FILE_ERROR_NOT_FOUND); | 946 error_callback.Run(base::File::FILE_ERROR_NOT_FOUND); |
942 } | 947 } |
943 | |
944 PendingRequestDone(); | |
945 } | 948 } |
946 | 949 |
947 void MTPDeviceDelegateImplLinux::DeleteDirectoryInternal( | 950 void MTPDeviceDelegateImplLinux::DeleteDirectoryInternal( |
948 const base::FilePath& file_path, | 951 const base::FilePath& file_path, |
949 const DeleteDirectorySuccessCallback& success_callback, | 952 const DeleteDirectorySuccessCallback& success_callback, |
950 const ErrorCallback& error_callback, | 953 const ErrorCallback& error_callback, |
951 const base::File::Info& file_info) { | 954 const base::File::Info& file_info) { |
952 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 955 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
953 | 956 |
954 if (!file_info.is_directory) { | 957 if (!file_info.is_directory) { |
955 error_callback.Run(base::File::FILE_ERROR_NOT_A_DIRECTORY); | 958 error_callback.Run(base::File::FILE_ERROR_NOT_A_DIRECTORY); |
956 PendingRequestDone(); | |
957 return; | 959 return; |
958 } | 960 } |
959 | 961 |
960 uint32 directory_id; | 962 uint32 directory_id; |
961 if (!CachedPathToId(file_path, &directory_id)) { | 963 if (!CachedPathToId(file_path, &directory_id)) { |
962 error_callback.Run(base::File::FILE_ERROR_NOT_FOUND); | 964 error_callback.Run(base::File::FILE_ERROR_NOT_FOUND); |
963 PendingRequestDone(); | |
964 return; | 965 return; |
965 } | 966 } |
966 | 967 |
967 // Checks the cache first. If it has children in cache, the directory cannot | 968 // Checks the cache first. If it has children in cache, the directory cannot |
968 // be empty. | 969 // be empty. |
969 FileIdToMTPFileNodeMap::const_iterator it = | 970 FileIdToMTPFileNodeMap::const_iterator it = |
970 file_id_to_node_map_.find(directory_id); | 971 file_id_to_node_map_.find(directory_id); |
971 if (it != file_id_to_node_map_.end() && it->second->HasChildren()) { | 972 if (it != file_id_to_node_map_.end() && it->second->HasChildren()) { |
972 error_callback.Run(base::File::FILE_ERROR_NOT_EMPTY); | 973 error_callback.Run(base::File::FILE_ERROR_NOT_EMPTY); |
973 PendingRequestDone(); | |
974 return; | 974 return; |
975 } | 975 } |
976 | 976 |
977 // Since the directory can contain a file even if the cache returns it as | 977 // 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. | 978 // empty, read the directory and confirm the directory is actually empty. |
979 const MTPDeviceTaskHelper::ReadDirectorySuccessCallback | 979 const MTPDeviceTaskHelper::ReadDirectorySuccessCallback |
980 success_callback_wrapper = base::Bind( | 980 success_callback_wrapper = base::Bind( |
981 &MTPDeviceDelegateImplLinux::OnDidReadDirectoryToDeleteDirectory, | 981 &MTPDeviceDelegateImplLinux::OnDidReadDirectoryToDeleteDirectory, |
982 weak_ptr_factory_.GetWeakPtr(), directory_id, success_callback, | 982 weak_ptr_factory_.GetWeakPtr(), directory_id, success_callback, |
983 error_callback); | 983 error_callback); |
984 const MTPDeviceTaskHelper::ErrorCallback error_callback_wrapper = | 984 const MTPDeviceTaskHelper::ErrorCallback error_callback_wrapper = |
985 base::Bind(&MTPDeviceDelegateImplLinux::HandleDeviceFileError, | 985 base::Bind(&MTPDeviceDelegateImplLinux::HandleDeviceFileError, |
986 weak_ptr_factory_.GetWeakPtr(), error_callback, directory_id); | 986 weak_ptr_factory_.GetWeakPtr(), error_callback, directory_id); |
987 const base::Closure closure = base::Bind( | 987 const base::Closure closure = base::Bind( |
988 &ReadDirectoryOnUIThread, storage_name_, read_only_, directory_id, | 988 &ReadDirectoryOnUIThread, storage_name_, read_only_, directory_id, |
989 1 /* max_size */, success_callback_wrapper, error_callback_wrapper); | 989 1 /* max_size */, success_callback_wrapper, error_callback_wrapper); |
990 EnsureInitAndRunTask(PendingTaskInfo( | 990 EnsureInitAndRunTask(PendingTaskInfo( |
991 base::FilePath(), content::BrowserThread::UI, FROM_HERE, closure)); | 991 base::FilePath(), content::BrowserThread::UI, FROM_HERE, closure)); |
992 PendingRequestDone(); | |
993 } | 992 } |
994 | 993 |
995 void MTPDeviceDelegateImplLinux::OnDidReadDirectoryToDeleteDirectory( | 994 void MTPDeviceDelegateImplLinux::OnDidReadDirectoryToDeleteDirectory( |
996 const uint32 directory_id, | 995 const uint32 directory_id, |
997 const DeleteDirectorySuccessCallback& success_callback, | 996 const DeleteDirectorySuccessCallback& success_callback, |
998 const ErrorCallback& error_callback, | 997 const ErrorCallback& error_callback, |
999 const storage::AsyncFileUtil::EntryList& entries, | 998 const storage::AsyncFileUtil::EntryList& entries, |
1000 const bool has_more) { | 999 const bool has_more) { |
1001 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 1000 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
1002 DCHECK(!has_more); | 1001 DCHECK(!has_more); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1186 | 1185 |
1187 current_snapshot_request_info_.reset(snapshot_request_info.release()); | 1186 current_snapshot_request_info_.reset(snapshot_request_info.release()); |
1188 if (file_info.size == 0) { | 1187 if (file_info.size == 0) { |
1189 // Empty snapshot file. | 1188 // Empty snapshot file. |
1190 return OnDidWriteDataIntoSnapshotFile( | 1189 return OnDidWriteDataIntoSnapshotFile( |
1191 snapshot_file_info, current_snapshot_request_info_->snapshot_file_path); | 1190 snapshot_file_info, current_snapshot_request_info_->snapshot_file_path); |
1192 } | 1191 } |
1193 WriteDataIntoSnapshotFile(snapshot_file_info); | 1192 WriteDataIntoSnapshotFile(snapshot_file_info); |
1194 } | 1193 } |
1195 | 1194 |
1195 void MTPDeviceDelegateImplLinux::OnDidGetFileInfoToCopyFileFromLocal( | |
Lei Zhang
2015/03/24 08:49:02
OnDidGetDestFileInfoToCopyFileFromLocal
yawano
2015/03/25 05:01:32
Done.
| |
1196 const ErrorCallback& error_callback, | |
1197 const base::File::Info& file_info) { | |
1198 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | |
1199 | |
1200 if (file_info.is_directory) | |
1201 error_callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); | |
1202 else | |
1203 error_callback.Run(base::File::FILE_ERROR_FAILED); | |
Lei Zhang
2015/03/24 08:49:02
Are you sure this is an error case? If the destina
yawano
2015/03/25 05:01:32
I also checked the implementation for Drive, it al
| |
1204 } | |
1205 | |
1206 void MTPDeviceDelegateImplLinux::OnGetFileInfoErrorToCopyFileFromLocal( | |
1207 const base::FilePath& source_file_path, | |
1208 const base::FilePath& device_file_path, | |
1209 const CopyFileFromLocalSuccessCallback& success_callback, | |
1210 const ErrorCallback& error_callback, | |
1211 const base::File::Error error) { | |
1212 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | |
1213 | |
1214 if (error != base::File::FILE_ERROR_NOT_FOUND) { | |
1215 error_callback.Run(error); | |
Lei Zhang
2015/03/24 08:49:02
add a return and remove the else statement.
yawano
2015/03/25 05:01:32
Done.
| |
1216 } else { | |
1217 content::BrowserThread::PostTaskAndReplyWithResult( | |
1218 content::BrowserThread::FILE, FROM_HERE, | |
1219 base::Bind(&OpenFileDescriptor, source_file_path.value().c_str(), | |
1220 O_RDONLY), | |
1221 base::Bind(&MTPDeviceDelegateImplLinux::OnDidOpenFDToCopyFileFromLocal, | |
1222 weak_ptr_factory_.GetWeakPtr(), device_file_path, | |
1223 success_callback, error_callback)); | |
1224 } | |
1225 } | |
1226 | |
1196 void MTPDeviceDelegateImplLinux::OnDidReadDirectory( | 1227 void MTPDeviceDelegateImplLinux::OnDidReadDirectory( |
1197 uint32 dir_id, | 1228 uint32 dir_id, |
1198 const ReadDirectorySuccessCallback& success_callback, | 1229 const ReadDirectorySuccessCallback& success_callback, |
1199 const storage::AsyncFileUtil::EntryList& file_list, | 1230 const storage::AsyncFileUtil::EntryList& file_list, |
1200 bool has_more) { | 1231 bool has_more) { |
1201 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 1232 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
1202 | 1233 |
1203 FileIdToMTPFileNodeMap::iterator it = file_id_to_node_map_.find(dir_id); | 1234 FileIdToMTPFileNodeMap::iterator it = file_id_to_node_map_.find(dir_id); |
1204 DCHECK(it != file_id_to_node_map_.end()); | 1235 DCHECK(it != file_id_to_node_map_.end()); |
1205 MTPFileNode* dir_node = it->second; | 1236 MTPFileNode* dir_node = it->second; |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1517 } | 1548 } |
1518 } | 1549 } |
1519 | 1550 |
1520 void CreateMTPDeviceAsyncDelegate( | 1551 void CreateMTPDeviceAsyncDelegate( |
1521 const std::string& device_location, | 1552 const std::string& device_location, |
1522 const bool read_only, | 1553 const bool read_only, |
1523 const CreateMTPDeviceAsyncDelegateCallback& callback) { | 1554 const CreateMTPDeviceAsyncDelegateCallback& callback) { |
1524 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 1555 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
1525 callback.Run(new MTPDeviceDelegateImplLinux(device_location, read_only)); | 1556 callback.Run(new MTPDeviceDelegateImplLinux(device_location, read_only)); |
1526 } | 1557 } |
OLD | NEW |