| 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 <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/location.h" | 11 #include "base/location.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" | |
| 15 #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h" | 14 #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h" |
| 16 #include "webkit/browser/fileapi/async_file_util.h" | 15 #include "webkit/browser/fileapi/async_file_util.h" |
| 17 | 16 |
| 18 namespace base { | 17 namespace base { |
| 19 class FilePath; | 18 class FilePath; |
| 20 } | 19 } |
| 21 | 20 |
| 22 struct SnapshotRequestInfo; | 21 struct SnapshotRequestInfo; |
| 23 | 22 |
| 24 // MTPDeviceDelegateImplLinux communicates with the media transfer protocol | 23 // MTPDeviceDelegateImplLinux communicates with the media transfer protocol |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 const base::File::Info& file_info); | 111 const base::File::Info& file_info); |
| 113 | 112 |
| 114 // Called when GetFileInfo() succeeds. GetFileInfo() is invoked to | 113 // Called when GetFileInfo() succeeds. GetFileInfo() is invoked to |
| 115 // get the |root| directory metadata details. |file_info| specifies the |root| | 114 // get the |root| directory metadata details. |file_info| specifies the |root| |
| 116 // directory details. | 115 // directory details. |
| 117 // | 116 // |
| 118 // If |root| is a directory, post a task on the UI thread to read the |root| | 117 // If |root| is a directory, post a task on the UI thread to read the |root| |
| 119 // directory file entries. | 118 // directory file entries. |
| 120 // | 119 // |
| 121 // If |root| is not a directory, |error_callback| is invoked to notify the | 120 // If |root| is not a directory, |error_callback| is invoked to notify the |
| 122 // caller about the platform file error and process the next pending request. | 121 // caller about the file error and process the next pending request. |
| 123 void OnDidGetFileInfoToReadDirectory( | 122 void OnDidGetFileInfoToReadDirectory( |
| 124 const std::string& root, | 123 const std::string& root, |
| 125 const ReadDirectorySuccessCallback& success_callback, | 124 const ReadDirectorySuccessCallback& success_callback, |
| 126 const ErrorCallback& error_callback, | 125 const ErrorCallback& error_callback, |
| 127 const base::File::Info& file_info); | 126 const base::File::Info& file_info); |
| 128 | 127 |
| 129 // Called when GetFileInfo() succeeds. GetFileInfo() is invoked to | 128 // Called when GetFileInfo() succeeds. GetFileInfo() is invoked to |
| 130 // create the snapshot file of |snapshot_request_info.device_file_path|. | 129 // create the snapshot file of |snapshot_request_info.device_file_path|. |
| 131 // |file_info| specifies the device file metadata details. | 130 // |file_info| specifies the device file metadata details. |
| 132 // | 131 // |
| (...skipping 16 matching lines...) Expand all Loading... |
| 149 // |snapshot_file_info| specifies the snapshot file metadata details. | 148 // |snapshot_file_info| specifies the snapshot file metadata details. |
| 150 // | 149 // |
| 151 // |current_snapshot_request_info_.success_callback| is invoked to notify the | 150 // |current_snapshot_request_info_.success_callback| is invoked to notify the |
| 152 // caller about |snapshot_file_info|. | 151 // caller about |snapshot_file_info|. |
| 153 void OnDidWriteDataIntoSnapshotFile( | 152 void OnDidWriteDataIntoSnapshotFile( |
| 154 const base::File::Info& snapshot_file_info, | 153 const base::File::Info& snapshot_file_info, |
| 155 const base::FilePath& snapshot_file_path); | 154 const base::FilePath& snapshot_file_path); |
| 156 | 155 |
| 157 // Called when WriteDataIntoSnapshotFile() fails. | 156 // Called when WriteDataIntoSnapshotFile() fails. |
| 158 // | 157 // |
| 159 // |error| specifies the platform file error code. | 158 // |error| specifies the file error code. |
| 160 // | 159 // |
| 161 // |current_snapshot_request_info_.error_callback| is invoked to notify the | 160 // |current_snapshot_request_info_.error_callback| is invoked to notify the |
| 162 // caller about |error|. | 161 // caller about |error|. |
| 163 void OnWriteDataIntoSnapshotFileError(base::File::Error error); | 162 void OnWriteDataIntoSnapshotFileError(base::File::Error error); |
| 164 | 163 |
| 165 // Called when ReadBytes() succeeds. | 164 // Called when ReadBytes() succeeds. |
| 166 // | 165 // |
| 167 // |success_callback| is invoked to notify the caller about the read bytes. | 166 // |success_callback| is invoked to notify the caller about the read bytes. |
| 168 // |bytes_read| is the number of bytes read. | 167 // |bytes_read| is the number of bytes read. |
| 169 void OnDidReadBytes(const ReadBytesSuccessCallback& success_callback, | 168 void OnDidReadBytes(const ReadBytesSuccessCallback& success_callback, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 198 // request at any time. | 197 // request at any time. |
| 199 scoped_ptr<SnapshotRequestInfo> current_snapshot_request_info_; | 198 scoped_ptr<SnapshotRequestInfo> current_snapshot_request_info_; |
| 200 | 199 |
| 201 // For callbacks that may run after destruction. | 200 // For callbacks that may run after destruction. |
| 202 base::WeakPtrFactory<MTPDeviceDelegateImplLinux> weak_ptr_factory_; | 201 base::WeakPtrFactory<MTPDeviceDelegateImplLinux> weak_ptr_factory_; |
| 203 | 202 |
| 204 DISALLOW_COPY_AND_ASSIGN(MTPDeviceDelegateImplLinux); | 203 DISALLOW_COPY_AND_ASSIGN(MTPDeviceDelegateImplLinux); |
| 205 }; | 204 }; |
| 206 | 205 |
| 207 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_DELEGATE_IMPL_LINUX_H
_ | 206 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_DELEGATE_IMPL_LINUX_H
_ |
| OLD | NEW |