Chromium Code Reviews| 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 "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h" | 14 #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h" |
| 15 #include "device/media_transfer_protocol/mtp_file_entry.pb.h" | 15 #include "device/media_transfer_protocol/mtp_file_entry.pb.h" |
| 16 #include "storage/browser/fileapi/async_file_util.h" | 16 #include "storage/browser/fileapi/async_file_util.h" |
| 17 | 17 |
| 18 class MTPReadFileWorker; | 18 class MTPReadFileWorker; |
| 19 struct SnapshotRequestInfo; | 19 struct SnapshotRequestInfo; |
| 20 | 20 |
| 21 // MTPDeviceTaskHelper dispatches the media transfer protocol (MTP) device | 21 // MTPDeviceTaskHelper dispatches the media transfer protocol (MTP) device |
| 22 // operation requests (such as GetFileInfo, ReadDirectory, CreateSnapshotFile, | 22 // operation requests (such as GetFileInfo, ReadDirectory, CreateSnapshotFile, |
| 23 // OpenStorage and CloseStorage) to the MediaTransferProtocolManager. | 23 // OpenStorage and CloseStorage) to the MediaTransferProtocolManager. |
| 24 // MTPDeviceTaskHelper lives on the UI thread. MTPDeviceTaskHelperMapService | 24 // MTPDeviceTaskHelper lives on the UI thread. MTPDeviceTaskHelperMapService |
| 25 // owns the MTPDeviceTaskHelper objects. MTPDeviceTaskHelper is instantiated per | 25 // owns the MTPDeviceTaskHelper objects. MTPDeviceTaskHelper is instantiated per |
| 26 // MTP device storage. | 26 // MTP device storage. |
| 27 class MTPDeviceTaskHelper { | 27 class MTPDeviceTaskHelper { |
| 28 public: | 28 public: |
| 29 struct MTPEntry { | |
| 30 MTPEntry(); | |
|
Lei Zhang
2015/11/12 07:25:17
blank line after
mtomasz
2015/11/12 07:48:24
Done.
| |
| 31 uint32 file_id; | |
|
Lei Zhang
2015/11/12 07:25:17
uint32_t in new code.
mtomasz
2015/11/12 07:48:24
Oops. Done.
| |
| 32 std::string name; | |
| 33 base::File::Info file_info; | |
| 34 }; | |
| 35 | |
| 36 typedef std::vector<MTPEntry> MTPEntries; | |
|
Lei Zhang
2015/11/12 07:25:17
Can we use "using foo = bar" in new code?
mtomasz
2015/11/12 07:48:24
I think we can, but it would be very inconsistent
Lei Zhang
2015/11/12 07:56:48
Ok, no worries.
| |
| 37 | |
| 29 typedef base::Callback<void(bool succeeded)> OpenStorageCallback; | 38 typedef base::Callback<void(bool succeeded)> OpenStorageCallback; |
| 30 | 39 |
| 31 typedef MTPDeviceAsyncDelegate::GetFileInfoSuccessCallback | 40 typedef MTPDeviceAsyncDelegate::GetFileInfoSuccessCallback |
| 32 GetFileInfoSuccessCallback; | 41 GetFileInfoSuccessCallback; |
| 33 | 42 |
| 34 typedef base::Closure CreateDirectorySuccessCallback; | 43 typedef base::Closure CreateDirectorySuccessCallback; |
| 35 | 44 |
| 36 // NOTE: The file names in the entry list have their file id appended at the | 45 typedef base::Callback<void(const MTPEntries& entries, bool has_more)> |
| 37 // end. e.g. foo.jpg with file id 45 becomes foo.jpg,45. | 46 ReadDirectorySuccessCallback; |
| 38 typedef base::Callback<void(const storage::AsyncFileUtil::EntryList& entries, | |
| 39 bool has_more)> ReadDirectorySuccessCallback; | |
| 40 | 47 |
| 41 typedef base::Closure RenameObjectSuccessCallback; | 48 typedef base::Closure RenameObjectSuccessCallback; |
| 42 | 49 |
| 43 typedef base::Closure CopyFileFromLocalSuccessCallback; | 50 typedef base::Closure CopyFileFromLocalSuccessCallback; |
| 44 | 51 |
| 45 typedef base::Closure DeleteObjectSuccessCallback; | 52 typedef base::Closure DeleteObjectSuccessCallback; |
| 46 | 53 |
| 47 typedef MTPDeviceAsyncDelegate::ErrorCallback ErrorCallback; | 54 typedef MTPDeviceAsyncDelegate::ErrorCallback ErrorCallback; |
| 48 | 55 |
| 49 MTPDeviceTaskHelper(); | 56 MTPDeviceTaskHelper(); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 // Used to handle WriteDataInfoSnapshotFile request. | 236 // Used to handle WriteDataInfoSnapshotFile request. |
| 230 scoped_ptr<MTPReadFileWorker> read_file_worker_; | 237 scoped_ptr<MTPReadFileWorker> read_file_worker_; |
| 231 | 238 |
| 232 // For callbacks that may run after destruction. | 239 // For callbacks that may run after destruction. |
| 233 base::WeakPtrFactory<MTPDeviceTaskHelper> weak_ptr_factory_; | 240 base::WeakPtrFactory<MTPDeviceTaskHelper> weak_ptr_factory_; |
| 234 | 241 |
| 235 DISALLOW_COPY_AND_ASSIGN(MTPDeviceTaskHelper); | 242 DISALLOW_COPY_AND_ASSIGN(MTPDeviceTaskHelper); |
| 236 }; | 243 }; |
| 237 | 244 |
| 238 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_ | 245 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_ |
| OLD | NEW |