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 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 const ReadDirectorySuccessCallback& success_callback, | 78 const ReadDirectorySuccessCallback& success_callback, |
79 const ErrorCallback& error_callback); | 79 const ErrorCallback& error_callback); |
80 | 80 |
81 // Forwards the WriteDataIntoSnapshotFile request to the MTPReadFileWorker | 81 // Forwards the WriteDataIntoSnapshotFile request to the MTPReadFileWorker |
82 // object. | 82 // object. |
83 // | 83 // |
84 // |request_info| specifies the snapshot file request params. | 84 // |request_info| specifies the snapshot file request params. |
85 // |snapshot_file_info| specifies the metadata of the snapshot file. | 85 // |snapshot_file_info| specifies the metadata of the snapshot file. |
86 void WriteDataIntoSnapshotFile( | 86 void WriteDataIntoSnapshotFile( |
87 const SnapshotRequestInfo& request_info, | 87 const SnapshotRequestInfo& request_info, |
88 const base::PlatformFileInfo& snapshot_file_info); | 88 const base::File::Info& snapshot_file_info); |
89 | 89 |
90 // Dispatches the read bytes request to the MediaTransferProtocolManager. | 90 // Dispatches the read bytes request to the MediaTransferProtocolManager. |
91 // | 91 // |
92 // |request| contains details about the byte request including the file path, | 92 // |request| contains details about the byte request including the file path, |
93 // byte range, and the callbacks. The callbacks specified within |request| are | 93 // byte range, and the callbacks. The callbacks specified within |request| are |
94 // called on the IO thread to notify the caller about success or failure. | 94 // called on the IO thread to notify the caller about success or failure. |
95 void ReadBytes(const MTPDeviceAsyncDelegate::ReadBytesRequest& request); | 95 void ReadBytes(const MTPDeviceAsyncDelegate::ReadBytesRequest& request); |
96 | 96 |
97 // Dispatches the CloseStorage request to the MediaTransferProtocolManager. | 97 // Dispatches the CloseStorage request to the MediaTransferProtocolManager. |
98 void CloseStorage() const; | 98 void CloseStorage() const; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 void OnDidReadBytes( | 149 void OnDidReadBytes( |
150 const MTPDeviceAsyncDelegate::ReadBytesRequest& request, | 150 const MTPDeviceAsyncDelegate::ReadBytesRequest& request, |
151 const std::string& data, | 151 const std::string& data, |
152 bool error) const; | 152 bool error) const; |
153 | 153 |
154 // Called when the device is uninitialized. | 154 // Called when the device is uninitialized. |
155 // | 155 // |
156 // Runs |error_callback| on the IO thread to notify the caller about the | 156 // Runs |error_callback| on the IO thread to notify the caller about the |
157 // device |error|. | 157 // device |error|. |
158 void HandleDeviceError(const ErrorCallback& error_callback, | 158 void HandleDeviceError(const ErrorCallback& error_callback, |
159 base::PlatformFileError error) const; | 159 base::File::Error error) const; |
160 | 160 |
161 // Handle to communicate with the MTP device. | 161 // Handle to communicate with the MTP device. |
162 std::string device_handle_; | 162 std::string device_handle_; |
163 | 163 |
164 // Used to handle WriteDataInfoSnapshotFile request. | 164 // Used to handle WriteDataInfoSnapshotFile request. |
165 scoped_ptr<MTPReadFileWorker> read_file_worker_; | 165 scoped_ptr<MTPReadFileWorker> read_file_worker_; |
166 | 166 |
167 // For callbacks that may run after destruction. | 167 // For callbacks that may run after destruction. |
168 base::WeakPtrFactory<MTPDeviceTaskHelper> weak_ptr_factory_; | 168 base::WeakPtrFactory<MTPDeviceTaskHelper> weak_ptr_factory_; |
169 | 169 |
170 DISALLOW_COPY_AND_ASSIGN(MTPDeviceTaskHelper); | 170 DISALLOW_COPY_AND_ASSIGN(MTPDeviceTaskHelper); |
171 }; | 171 }; |
172 | 172 |
173 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_ | 173 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_ |
OLD | NEW |