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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 content::BrowserThread::IO, | 202 content::BrowserThread::IO, |
203 FROM_HERE, | 203 FROM_HERE, |
204 base::Bind(success_callback, entries, has_more)); | 204 base::Bind(success_callback, entries, has_more)); |
205 } | 205 } |
206 | 206 |
207 void MTPDeviceTaskHelper::OnGetFileInfoToReadBytes( | 207 void MTPDeviceTaskHelper::OnGetFileInfoToReadBytes( |
208 const MTPDeviceAsyncDelegate::ReadBytesRequest& request, | 208 const MTPDeviceAsyncDelegate::ReadBytesRequest& request, |
209 const MtpFileEntry& file_entry, | 209 const MtpFileEntry& file_entry, |
210 bool error) { | 210 bool error) { |
211 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 211 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
212 DCHECK(request.buf); | 212 DCHECK(request.buf.get()); |
213 DCHECK_GE(request.buf_len, 0); | 213 DCHECK_GE(request.buf_len, 0); |
214 DCHECK_GE(request.offset, 0); | 214 DCHECK_GE(request.offset, 0); |
215 if (error) { | 215 if (error) { |
216 return HandleDeviceError(request.error_callback, | 216 return HandleDeviceError(request.error_callback, |
217 base::File::FILE_ERROR_FAILED); | 217 base::File::FILE_ERROR_FAILED); |
218 } | 218 } |
219 | 219 |
220 base::File::Info file_info = FileInfoFromMTPFileEntry(file_entry); | 220 base::File::Info file_info = FileInfoFromMTPFileEntry(file_entry); |
221 if (file_info.is_directory) { | 221 if (file_info.is_directory) { |
222 return HandleDeviceError(request.error_callback, | 222 return HandleDeviceError(request.error_callback, |
(...skipping 44 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 |