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 <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 | 620 |
621 void MTPDeviceDelegateImplLinux::ReadBytes( | 621 void MTPDeviceDelegateImplLinux::ReadBytes( |
622 const base::FilePath& device_file_path, | 622 const base::FilePath& device_file_path, |
623 const scoped_refptr<net::IOBuffer>& buf, | 623 const scoped_refptr<net::IOBuffer>& buf, |
624 int64_t offset, | 624 int64_t offset, |
625 int buf_len, | 625 int buf_len, |
626 const ReadBytesSuccessCallback& success_callback, | 626 const ReadBytesSuccessCallback& success_callback, |
627 const ErrorCallback& error_callback) { | 627 const ErrorCallback& error_callback) { |
628 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 628 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
629 DCHECK(!device_file_path.empty()); | 629 DCHECK(!device_file_path.empty()); |
630 base::Closure closure = | 630 base::Closure closure = base::Bind( |
631 base::Bind(&MTPDeviceDelegateImplLinux::ReadBytesInternal, | 631 &MTPDeviceDelegateImplLinux::ReadBytesInternal, |
632 weak_ptr_factory_.GetWeakPtr(), | 632 weak_ptr_factory_.GetWeakPtr(), device_file_path, base::RetainedRef(buf), |
633 device_file_path, | 633 offset, buf_len, success_callback, error_callback); |
634 buf, | |
635 offset, | |
636 buf_len, | |
637 success_callback, | |
638 error_callback); | |
639 EnsureInitAndRunTask(PendingTaskInfo(device_file_path, | 634 EnsureInitAndRunTask(PendingTaskInfo(device_file_path, |
640 content::BrowserThread::IO, | 635 content::BrowserThread::IO, |
641 FROM_HERE, | 636 FROM_HERE, |
642 closure)); | 637 closure)); |
643 } | 638 } |
644 | 639 |
645 bool MTPDeviceDelegateImplLinux::IsReadOnly() const { | 640 bool MTPDeviceDelegateImplLinux::IsReadOnly() const { |
646 return read_only_; | 641 return read_only_; |
647 } | 642 } |
648 | 643 |
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1898 } | 1893 } |
1899 } | 1894 } |
1900 | 1895 |
1901 void CreateMTPDeviceAsyncDelegate( | 1896 void CreateMTPDeviceAsyncDelegate( |
1902 const std::string& device_location, | 1897 const std::string& device_location, |
1903 const bool read_only, | 1898 const bool read_only, |
1904 const CreateMTPDeviceAsyncDelegateCallback& callback) { | 1899 const CreateMTPDeviceAsyncDelegateCallback& callback) { |
1905 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 1900 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
1906 callback.Run(new MTPDeviceDelegateImplLinux(device_location, read_only)); | 1901 callback.Run(new MTPDeviceDelegateImplLinux(device_location, read_only)); |
1907 } | 1902 } |
OLD | NEW |