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