| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_task_helper.h" | 5 #include "chrome/browser/media_galleries/linux/mtp_device_task_helper.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 void MTPDeviceTaskHelper::OnDidReadDirectory( | 175 void MTPDeviceTaskHelper::OnDidReadDirectory( |
| 176 const ReadDirectorySuccessCallback& success_callback, | 176 const ReadDirectorySuccessCallback& success_callback, |
| 177 const ErrorCallback& error_callback, | 177 const ErrorCallback& error_callback, |
| 178 const std::vector<MtpFileEntry>& file_entries, | 178 const std::vector<MtpFileEntry>& file_entries, |
| 179 bool has_more, | 179 bool has_more, |
| 180 bool error) const { | 180 bool error) const { |
| 181 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 181 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 182 if (error) | 182 if (error) |
| 183 return HandleDeviceError(error_callback, base::File::FILE_ERROR_FAILED); | 183 return HandleDeviceError(error_callback, base::File::FILE_ERROR_FAILED); |
| 184 | 184 |
| 185 fileapi::AsyncFileUtil::EntryList entries; | 185 storage::AsyncFileUtil::EntryList entries; |
| 186 base::FilePath current; | 186 base::FilePath current; |
| 187 MTPDeviceObjectEnumerator file_enum(file_entries); | 187 MTPDeviceObjectEnumerator file_enum(file_entries); |
| 188 while (!(current = file_enum.Next()).empty()) { | 188 while (!(current = file_enum.Next()).empty()) { |
| 189 fileapi::DirectoryEntry entry; | 189 storage::DirectoryEntry entry; |
| 190 entry.name = fileapi::VirtualPath::BaseName(current).value(); | 190 entry.name = storage::VirtualPath::BaseName(current).value(); |
| 191 uint32 file_id = 0; | 191 uint32 file_id = 0; |
| 192 bool ret = file_enum.GetEntryId(&file_id); | 192 bool ret = file_enum.GetEntryId(&file_id); |
| 193 DCHECK(ret); | 193 DCHECK(ret); |
| 194 entry.name.push_back(','); | 194 entry.name.push_back(','); |
| 195 entry.name += base::UintToString(file_id); | 195 entry.name += base::UintToString(file_id); |
| 196 entry.is_directory = file_enum.IsDirectory(); | 196 entry.is_directory = file_enum.IsDirectory(); |
| 197 entry.size = file_enum.Size(); | 197 entry.size = file_enum.Size(); |
| 198 entry.last_modified_time = file_enum.LastModifiedTime(); | 198 entry.last_modified_time = file_enum.LastModifiedTime(); |
| 199 entries.push_back(entry); | 199 entries.push_back(entry); |
| 200 } | 200 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 } | 267 } |
| 268 | 268 |
| 269 void MTPDeviceTaskHelper::HandleDeviceError( | 269 void MTPDeviceTaskHelper::HandleDeviceError( |
| 270 const ErrorCallback& error_callback, | 270 const ErrorCallback& error_callback, |
| 271 base::File::Error error) const { | 271 base::File::Error error) const { |
| 272 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 272 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 273 content::BrowserThread::PostTask(content::BrowserThread::IO, | 273 content::BrowserThread::PostTask(content::BrowserThread::IO, |
| 274 FROM_HERE, | 274 FROM_HERE, |
| 275 base::Bind(error_callback, error)); | 275 base::Bind(error_callback, error)); |
| 276 } | 276 } |
| OLD | NEW |