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_LINUX_MTP_DEVICE_DELEGATE_IMPL_LINUX_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_DELEGATE_IMPL_LINUX_H_ |
6 #define CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_DELEGATE_IMPL_LINUX_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_DELEGATE_IMPL_LINUX_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 const tracked_objects::Location location; | 54 const tracked_objects::Location location; |
55 const base::Closure task; | 55 const base::Closure task; |
56 }; | 56 }; |
57 | 57 |
58 class MTPFileNode; | 58 class MTPFileNode; |
59 | 59 |
60 // Maps file ids to file nodes. | 60 // Maps file ids to file nodes. |
61 typedef std::map<uint32, MTPFileNode*> FileIdToMTPFileNodeMap; | 61 typedef std::map<uint32, MTPFileNode*> FileIdToMTPFileNodeMap; |
62 | 62 |
63 // Maps file paths to file info. | 63 // Maps file paths to file info. |
64 typedef std::map<base::FilePath, fileapi::DirectoryEntry> FileInfoCache; | 64 typedef std::map<base::FilePath, storage::DirectoryEntry> FileInfoCache; |
65 | 65 |
66 // Should only be called by CreateMTPDeviceAsyncDelegate() factory call. | 66 // Should only be called by CreateMTPDeviceAsyncDelegate() factory call. |
67 // Defer the device initializations until the first file operation request. | 67 // Defer the device initializations until the first file operation request. |
68 // Do all the initializations in EnsureInitAndRunTask() function. | 68 // Do all the initializations in EnsureInitAndRunTask() function. |
69 explicit MTPDeviceDelegateImplLinux(const std::string& device_location); | 69 explicit MTPDeviceDelegateImplLinux(const std::string& device_location); |
70 | 70 |
71 // Destructed via CancelPendingTasksAndDeleteDelegate(). | 71 // Destructed via CancelPendingTasksAndDeleteDelegate(). |
72 virtual ~MTPDeviceDelegateImplLinux(); | 72 virtual ~MTPDeviceDelegateImplLinux(); |
73 | 73 |
74 // MTPDeviceAsyncDelegate: | 74 // MTPDeviceAsyncDelegate: |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 179 |
180 // Called when ReadDirectory() succeeds. | 180 // Called when ReadDirectory() succeeds. |
181 // | 181 // |
182 // |dir_id| is the directory read. | 182 // |dir_id| is the directory read. |
183 // |success_callback| is invoked to notify the caller about the directory | 183 // |success_callback| is invoked to notify the caller about the directory |
184 // file entries. | 184 // file entries. |
185 // |file_list| contains the directory file entries with their file ids. | 185 // |file_list| contains the directory file entries with their file ids. |
186 // |has_more| is true if there are more file entries to read. | 186 // |has_more| is true if there are more file entries to read. |
187 void OnDidReadDirectory(uint32 dir_id, | 187 void OnDidReadDirectory(uint32 dir_id, |
188 const ReadDirectorySuccessCallback& success_callback, | 188 const ReadDirectorySuccessCallback& success_callback, |
189 const fileapi::AsyncFileUtil::EntryList& file_list, | 189 const storage::AsyncFileUtil::EntryList& file_list, |
190 bool has_more); | 190 bool has_more); |
191 | 191 |
192 // Called when WriteDataIntoSnapshotFile() succeeds. | 192 // Called when WriteDataIntoSnapshotFile() succeeds. |
193 // | 193 // |
194 // |snapshot_file_info| specifies the snapshot file metadata details. | 194 // |snapshot_file_info| specifies the snapshot file metadata details. |
195 // | 195 // |
196 // |current_snapshot_request_info_.success_callback| is invoked to notify the | 196 // |current_snapshot_request_info_.success_callback| is invoked to notify the |
197 // caller about |snapshot_file_info|. | 197 // caller about |snapshot_file_info|. |
198 void OnDidWriteDataIntoSnapshotFile( | 198 void OnDidWriteDataIntoSnapshotFile( |
199 const base::File::Info& snapshot_file_info, | 199 const base::File::Info& snapshot_file_info, |
200 const base::FilePath& snapshot_file_path); | 200 const base::FilePath& snapshot_file_path); |
201 | 201 |
202 // Called when WriteDataIntoSnapshotFile() fails. | 202 // Called when WriteDataIntoSnapshotFile() fails. |
203 // | 203 // |
204 // |error| specifies the file error code. | 204 // |error| specifies the file error code. |
205 // | 205 // |
206 // |current_snapshot_request_info_.error_callback| is invoked to notify the | 206 // |current_snapshot_request_info_.error_callback| is invoked to notify the |
207 // caller about |error|. | 207 // caller about |error|. |
208 void OnWriteDataIntoSnapshotFileError(base::File::Error error); | 208 void OnWriteDataIntoSnapshotFileError(base::File::Error error); |
209 | 209 |
210 // Called when ReadBytes() succeeds. | 210 // Called when ReadBytes() succeeds. |
211 // | 211 // |
212 // |success_callback| is invoked to notify the caller about the read bytes. | 212 // |success_callback| is invoked to notify the caller about the read bytes. |
213 // |bytes_read| is the number of bytes read. | 213 // |bytes_read| is the number of bytes read. |
214 void OnDidReadBytes(const ReadBytesSuccessCallback& success_callback, | 214 void OnDidReadBytes(const ReadBytesSuccessCallback& success_callback, |
215 const base::File::Info& file_info, int bytes_read); | 215 const base::File::Info& file_info, int bytes_read); |
216 | 216 |
217 // Called when FillFileCache() succeeds. | 217 // Called when FillFileCache() succeeds. |
218 void OnDidFillFileCache(const base::FilePath& path, | 218 void OnDidFillFileCache(const base::FilePath& path, |
219 const fileapi::AsyncFileUtil::EntryList& file_list, | 219 const storage::AsyncFileUtil::EntryList& file_list, |
220 bool has_more); | 220 bool has_more); |
221 | 221 |
222 // Called when FillFileCache() fails. | 222 // Called when FillFileCache() fails. |
223 void OnFillFileCacheFailed(base::File::Error error); | 223 void OnFillFileCacheFailed(base::File::Error error); |
224 | 224 |
225 // Handles the device file |error| while operating on |file_id|. | 225 // Handles the device file |error| while operating on |file_id|. |
226 // |error_callback| is invoked to notify the caller about the file error. | 226 // |error_callback| is invoked to notify the caller about the file error. |
227 void HandleDeviceFileError(const ErrorCallback& error_callback, | 227 void HandleDeviceFileError(const ErrorCallback& error_callback, |
228 uint32 file_id, | 228 uint32 file_id, |
229 base::File::Error error); | 229 base::File::Error error); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 // the ReadDirectory operation. | 286 // the ReadDirectory operation. |
287 FileInfoCache file_info_cache_; | 287 FileInfoCache file_info_cache_; |
288 | 288 |
289 // For callbacks that may run after destruction. | 289 // For callbacks that may run after destruction. |
290 base::WeakPtrFactory<MTPDeviceDelegateImplLinux> weak_ptr_factory_; | 290 base::WeakPtrFactory<MTPDeviceDelegateImplLinux> weak_ptr_factory_; |
291 | 291 |
292 DISALLOW_COPY_AND_ASSIGN(MTPDeviceDelegateImplLinux); | 292 DISALLOW_COPY_AND_ASSIGN(MTPDeviceDelegateImplLinux); |
293 }; | 293 }; |
294 | 294 |
295 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_DELEGATE_IMPL_LINUX_H
_ | 295 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_DELEGATE_IMPL_LINUX_H
_ |
OLD | NEW |