| 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 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_MAC_MTP_DEVICE_DELEGATE_IMPL_MAC_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_MAC_MTP_DEVICE_DELEGATE_IMPL_MAC_H_ |
| 6 #define CHROME_BROWSER_MEDIA_GALLERIES_MAC_MTP_DEVICE_DELEGATE_IMPL_MAC_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_MAC_MTP_DEVICE_DELEGATE_IMPL_MAC_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // delegate interface can be invoked on any thread, as it simply forwards calls | 25 // delegate interface can be invoked on any thread, as it simply forwards calls |
| 26 // to the UI thread. | 26 // to the UI thread. |
| 27 class MTPDeviceDelegateImplMac : public MTPDeviceAsyncDelegate { | 27 class MTPDeviceDelegateImplMac : public MTPDeviceAsyncDelegate { |
| 28 public: | 28 public: |
| 29 MTPDeviceDelegateImplMac(const std::string& device_id, | 29 MTPDeviceDelegateImplMac(const std::string& device_id, |
| 30 const base::FilePath::StringType& synthetic_path); | 30 const base::FilePath::StringType& synthetic_path); |
| 31 | 31 |
| 32 // MTPDeviceAsyncDelegate implementation. These functions are called on the | 32 // MTPDeviceAsyncDelegate implementation. These functions are called on the |
| 33 // IO thread by the async filesystem file util. They forward to | 33 // IO thread by the async filesystem file util. They forward to |
| 34 // similarly-named methods on the UI thread. | 34 // similarly-named methods on the UI thread. |
| 35 virtual void GetFileInfo( | 35 void GetFileInfo(const base::FilePath& file_path, |
| 36 const base::FilePath& file_path, | 36 const GetFileInfoSuccessCallback& success_callback, |
| 37 const GetFileInfoSuccessCallback& success_callback, | 37 const ErrorCallback& error_callback) override; |
| 38 const ErrorCallback& error_callback) override; | |
| 39 | 38 |
| 40 // Note: passed absolute paths, but expects relative paths in reply. | 39 // Note: passed absolute paths, but expects relative paths in reply. |
| 41 virtual void ReadDirectory( | 40 void ReadDirectory(const base::FilePath& root, |
| 42 const base::FilePath& root, | 41 const ReadDirectorySuccessCallback& success_callback, |
| 43 const ReadDirectorySuccessCallback& success_callback, | 42 const ErrorCallback& error_callback) override; |
| 44 const ErrorCallback& error_callback) override; | |
| 45 | 43 |
| 46 // Note: passed absolute paths. | 44 // Note: passed absolute paths. |
| 47 virtual void CreateSnapshotFile( | 45 void CreateSnapshotFile( |
| 48 const base::FilePath& device_file_path, | 46 const base::FilePath& device_file_path, |
| 49 const base::FilePath& local_path, | 47 const base::FilePath& local_path, |
| 50 const CreateSnapshotFileSuccessCallback& success_callback, | 48 const CreateSnapshotFileSuccessCallback& success_callback, |
| 51 const ErrorCallback& error_callback) override; | 49 const ErrorCallback& error_callback) override; |
| 52 virtual bool IsStreaming() override; | 50 bool IsStreaming() override; |
| 53 virtual void ReadBytes(const base::FilePath& device_file_path, | 51 void ReadBytes(const base::FilePath& device_file_path, |
| 54 const scoped_refptr<net::IOBuffer>& buf, | 52 const scoped_refptr<net::IOBuffer>& buf, |
| 55 int64 offset, | 53 int64 offset, |
| 56 int buf_len, | 54 int buf_len, |
| 57 const ReadBytesSuccessCallback& success_callback, | 55 const ReadBytesSuccessCallback& success_callback, |
| 58 const ErrorCallback& error_callback) override; | 56 const ErrorCallback& error_callback) override; |
| 59 virtual void CancelPendingTasksAndDeleteDelegate() override; | 57 void CancelPendingTasksAndDeleteDelegate() override; |
| 60 | 58 |
| 61 // Forward delegates for ImageCaptureDeviceListener. These are | 59 // Forward delegates for ImageCaptureDeviceListener. These are |
| 62 // invoked in callbacks of the ImageCapture library on the UI thread. | 60 // invoked in callbacks of the ImageCapture library on the UI thread. |
| 63 virtual void ItemAdded(const std::string& name, | 61 virtual void ItemAdded(const std::string& name, |
| 64 const base::File::Info& info); | 62 const base::File::Info& info); |
| 65 virtual void NoMoreItems(); | 63 virtual void NoMoreItems(); |
| 66 virtual void DownloadedFile(const std::string& name, | 64 virtual void DownloadedFile(const std::string& name, |
| 67 base::File::Error error); | 65 base::File::Error error); |
| 68 | 66 |
| 69 // Scheduled when early directory reads are requested. The | 67 // Scheduled when early directory reads are requested. The |
| 70 // timeout will signal an ABORT error to the caller if the | 68 // timeout will signal an ABORT error to the caller if the |
| 71 // device metadata cannot be read. | 69 // device metadata cannot be read. |
| 72 void ReadDirectoryTimeout(const base::FilePath& root); | 70 void ReadDirectoryTimeout(const base::FilePath& root); |
| 73 | 71 |
| 74 private: | 72 private: |
| 75 class DeviceListener; | 73 class DeviceListener; |
| 76 | 74 |
| 77 virtual ~MTPDeviceDelegateImplMac(); | 75 ~MTPDeviceDelegateImplMac() override; |
| 78 | 76 |
| 79 // Delegate for GetFileInfo, called on the UI thread. | 77 // Delegate for GetFileInfo, called on the UI thread. |
| 80 void GetFileInfoImpl(const base::FilePath& file_path, | 78 void GetFileInfoImpl(const base::FilePath& file_path, |
| 81 base::File::Info* file_info, | 79 base::File::Info* file_info, |
| 82 base::File::Error* error); | 80 base::File::Error* error); |
| 83 | 81 |
| 84 // Delegate for ReadDirectory, called on the UI thread. | 82 // Delegate for ReadDirectory, called on the UI thread. |
| 85 void ReadDirectoryImpl( | 83 void ReadDirectoryImpl( |
| 86 const base::FilePath& root, | 84 const base::FilePath& root, |
| 87 const ReadDirectorySuccessCallback& success_callback, | 85 const ReadDirectorySuccessCallback& success_callback, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 150 |
| 153 ReadFileTransactionList read_file_transactions_; | 151 ReadFileTransactionList read_file_transactions_; |
| 154 ReadDirTransactionList read_dir_transactions_; | 152 ReadDirTransactionList read_dir_transactions_; |
| 155 | 153 |
| 156 base::WeakPtrFactory<MTPDeviceDelegateImplMac> weak_factory_; | 154 base::WeakPtrFactory<MTPDeviceDelegateImplMac> weak_factory_; |
| 157 | 155 |
| 158 DISALLOW_COPY_AND_ASSIGN(MTPDeviceDelegateImplMac); | 156 DISALLOW_COPY_AND_ASSIGN(MTPDeviceDelegateImplMac); |
| 159 }; | 157 }; |
| 160 | 158 |
| 161 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MAC_MTP_DEVICE_DELEGATE_IMPL_MAC_H_ | 159 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MAC_MTP_DEVICE_DELEGATE_IMPL_MAC_H_ |
| OLD | NEW |