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 <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 FROM_HERE, | 403 FROM_HERE, |
404 closure)); | 404 closure)); |
405 } | 405 } |
406 | 406 |
407 bool MTPDeviceDelegateImplLinux::IsStreaming() { | 407 bool MTPDeviceDelegateImplLinux::IsStreaming() { |
408 return true; | 408 return true; |
409 } | 409 } |
410 | 410 |
411 void MTPDeviceDelegateImplLinux::ReadBytes( | 411 void MTPDeviceDelegateImplLinux::ReadBytes( |
412 const base::FilePath& device_file_path, | 412 const base::FilePath& device_file_path, |
413 net::IOBuffer* buf, int64 offset, int buf_len, | 413 const scoped_refptr<net::IOBuffer>& buf, |
| 414 int64 offset, |
| 415 int buf_len, |
414 const ReadBytesSuccessCallback& success_callback, | 416 const ReadBytesSuccessCallback& success_callback, |
415 const ErrorCallback& error_callback) { | 417 const ErrorCallback& error_callback) { |
416 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 418 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
417 DCHECK(!device_file_path.empty()); | 419 DCHECK(!device_file_path.empty()); |
418 base::Closure closure = | 420 base::Closure closure = |
419 base::Bind(&MTPDeviceDelegateImplLinux::ReadBytesInternal, | 421 base::Bind(&MTPDeviceDelegateImplLinux::ReadBytesInternal, |
420 weak_ptr_factory_.GetWeakPtr(), | 422 weak_ptr_factory_.GetWeakPtr(), |
421 device_file_path, | 423 device_file_path, |
422 make_scoped_refptr(buf), | 424 buf, |
423 offset, | 425 offset, |
424 buf_len, | 426 buf_len, |
425 success_callback, | 427 success_callback, |
426 error_callback); | 428 error_callback); |
427 EnsureInitAndRunTask(PendingTaskInfo(device_file_path, | 429 EnsureInitAndRunTask(PendingTaskInfo(device_file_path, |
428 content::BrowserThread::IO, | 430 content::BrowserThread::IO, |
429 FROM_HERE, | 431 FROM_HERE, |
430 closure)); | 432 closure)); |
431 } | 433 } |
432 | 434 |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 *id = current_node->file_id(); | 940 *id = current_node->file_id(); |
939 return true; | 941 return true; |
940 } | 942 } |
941 | 943 |
942 void CreateMTPDeviceAsyncDelegate( | 944 void CreateMTPDeviceAsyncDelegate( |
943 const std::string& device_location, | 945 const std::string& device_location, |
944 const CreateMTPDeviceAsyncDelegateCallback& callback) { | 946 const CreateMTPDeviceAsyncDelegateCallback& callback) { |
945 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 947 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
946 callback.Run(new MTPDeviceDelegateImplLinux(device_location)); | 948 callback.Run(new MTPDeviceDelegateImplLinux(device_location)); |
947 } | 949 } |
OLD | NEW |