| 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 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_ |
| 6 #define CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/platform_file.h" | 14 #include "base/platform_file.h" |
| 15 #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h" |
| 15 #include "device/media_transfer_protocol/mtp_file_entry.pb.h" | 16 #include "device/media_transfer_protocol/mtp_file_entry.pb.h" |
| 16 #include "webkit/fileapi/async_file_util.h" | 17 #include "webkit/fileapi/async_file_util.h" |
| 17 #include "webkit/fileapi/media/mtp_device_async_delegate.h" | |
| 18 | 18 |
| 19 namespace chrome { | 19 namespace chrome { |
| 20 | 20 |
| 21 class MTPReadFileWorker; | 21 class MTPReadFileWorker; |
| 22 struct SnapshotRequestInfo; | 22 struct SnapshotRequestInfo; |
| 23 | 23 |
| 24 // MTPDeviceTaskHelper dispatches the media transfer protocol (MTP) device | 24 // MTPDeviceTaskHelper dispatches the media transfer protocol (MTP) device |
| 25 // operation requests (such as GetFileInfo, ReadDirectory, CreateSnapshotFile, | 25 // operation requests (such as GetFileInfo, ReadDirectory, CreateSnapshotFile, |
| 26 // OpenStorage and CloseStorage) to the MediaTransferProtocolManager. | 26 // OpenStorage and CloseStorage) to the MediaTransferProtocolManager. |
| 27 // MTPDeviceTaskHelper lives on the UI thread. MTPDeviceTaskHelperMapService | 27 // MTPDeviceTaskHelper lives on the UI thread. MTPDeviceTaskHelperMapService |
| 28 // owns the MTPDeviceTaskHelper objects. MTPDeviceTaskHelper is instantiated per | 28 // owns the MTPDeviceTaskHelper objects. MTPDeviceTaskHelper is instantiated per |
| 29 // MTP device storage. | 29 // MTP device storage. |
| 30 class MTPDeviceTaskHelper { | 30 class MTPDeviceTaskHelper { |
| 31 public: | 31 public: |
| 32 typedef base::Callback<void(bool succeeded)> OpenStorageCallback; | 32 typedef base::Callback<void(bool succeeded)> OpenStorageCallback; |
| 33 | 33 |
| 34 typedef fileapi::MTPDeviceAsyncDelegate::GetFileInfoSuccessCallback | 34 typedef MTPDeviceAsyncDelegate::GetFileInfoSuccessCallback |
| 35 GetFileInfoSuccessCallback; | 35 GetFileInfoSuccessCallback; |
| 36 | 36 |
| 37 typedef base::Callback<void(const fileapi::AsyncFileUtil::EntryList&)> | 37 typedef base::Callback<void(const fileapi::AsyncFileUtil::EntryList&)> |
| 38 ReadDirectorySuccessCallback; | 38 ReadDirectorySuccessCallback; |
| 39 | 39 |
| 40 typedef fileapi::MTPDeviceAsyncDelegate::ErrorCallback ErrorCallback; | 40 typedef MTPDeviceAsyncDelegate::ErrorCallback ErrorCallback; |
| 41 | 41 |
| 42 MTPDeviceTaskHelper(); | 42 MTPDeviceTaskHelper(); |
| 43 ~MTPDeviceTaskHelper(); | 43 ~MTPDeviceTaskHelper(); |
| 44 | 44 |
| 45 // Dispatches the request to the MediaTransferProtocolManager to open the MTP | 45 // Dispatches the request to the MediaTransferProtocolManager to open the MTP |
| 46 // storage for communication. | 46 // storage for communication. |
| 47 // | 47 // |
| 48 // |storage_name| specifies the name of the storage device. | 48 // |storage_name| specifies the name of the storage device. |
| 49 // |callback| is called when the OpenStorage request completes. |callback| | 49 // |callback| is called when the OpenStorage request completes. |callback| |
| 50 // runs on the IO thread. | 50 // runs on the IO thread. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 147 |
| 148 // For callbacks that may run after destruction. | 148 // For callbacks that may run after destruction. |
| 149 base::WeakPtrFactory<MTPDeviceTaskHelper> weak_ptr_factory_; | 149 base::WeakPtrFactory<MTPDeviceTaskHelper> weak_ptr_factory_; |
| 150 | 150 |
| 151 DISALLOW_COPY_AND_ASSIGN(MTPDeviceTaskHelper); | 151 DISALLOW_COPY_AND_ASSIGN(MTPDeviceTaskHelper); |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 } // namespace chrome | 154 } // namespace chrome |
| 155 | 155 |
| 156 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_ | 156 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_ |
| OLD | NEW |