| 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 DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_ | 5 #ifndef DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_ |
| 6 #define DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_ | 6 #define DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // The second argument is true if there was an error. | 52 // The second argument is true if there was an error. |
| 53 typedef base::Callback<void(const std::string& data, | 53 typedef base::Callback<void(const std::string& data, |
| 54 bool error)> ReadFileCallback; | 54 bool error)> ReadFileCallback; |
| 55 | 55 |
| 56 // A callback to handle the result of GetFileInfo. | 56 // A callback to handle the result of GetFileInfo. |
| 57 // The first argument is a file entry. | 57 // The first argument is a file entry. |
| 58 // The second argument is true if there was an error. | 58 // The second argument is true if there was an error. |
| 59 typedef base::Callback<void(const MtpFileEntry& file_entry, | 59 typedef base::Callback<void(const MtpFileEntry& file_entry, |
| 60 bool error)> GetFileInfoCallback; | 60 bool error)> GetFileInfoCallback; |
| 61 | 61 |
| 62 // A callback to handle the result of RenameObject. |
| 63 // The first argument is true if there was an error. |
| 64 typedef base::Callback<void(bool error)> RenameObjectCallback; |
| 65 |
| 62 // A callback to handle the result of CopyFileFromLocal. | 66 // A callback to handle the result of CopyFileFromLocal. |
| 63 // The first argument is true if there was an error. | 67 // The first argument is true if there was an error. |
| 64 typedef base::Callback<void(bool error)> CopyFileFromLocalCallback; | 68 typedef base::Callback<void(bool error)> CopyFileFromLocalCallback; |
| 65 | 69 |
| 66 // A callback to handle the result of DeleteObject. | 70 // A callback to handle the result of DeleteObject. |
| 67 // The first argument is true if there was an error. | 71 // The first argument is true if there was an error. |
| 68 typedef base::Callback<void(bool error)> DeleteObjectCallback; | 72 typedef base::Callback<void(bool error)> DeleteObjectCallback; |
| 69 | 73 |
| 70 // Implement this interface to be notified about MTP storage | 74 // Implement this interface to be notified about MTP storage |
| 71 // attachment / detachment events. | 75 // attachment / detachment events. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 uint32 offset, | 121 uint32 offset, |
| 118 uint32 count, | 122 uint32 count, |
| 119 const ReadFileCallback& callback) = 0; | 123 const ReadFileCallback& callback) = 0; |
| 120 | 124 |
| 121 // Gets the file metadata for |file_id| on |storage_handle| and runs | 125 // Gets the file metadata for |file_id| on |storage_handle| and runs |
| 122 // |callback|. | 126 // |callback|. |
| 123 virtual void GetFileInfo(const std::string& storage_handle, | 127 virtual void GetFileInfo(const std::string& storage_handle, |
| 124 uint32 file_id, | 128 uint32 file_id, |
| 125 const GetFileInfoCallback& callback) = 0; | 129 const GetFileInfoCallback& callback) = 0; |
| 126 | 130 |
| 131 // Renames |object_id| to |new_name|. |
| 132 virtual void RenameObject(const std::string& storage_handle, |
| 133 const uint32 object_id, |
| 134 const std::string& new_name, |
| 135 const RenameObjectCallback& callback) = 0; |
| 136 |
| 127 // Copies the file from |source_file_descriptor| to |file_name| on | 137 // Copies the file from |source_file_descriptor| to |file_name| on |
| 128 // |parent_id|. | 138 // |parent_id|. |
| 129 virtual void CopyFileFromLocal(const std::string& storage_handle, | 139 virtual void CopyFileFromLocal(const std::string& storage_handle, |
| 130 const int source_file_descriptor, | 140 const int source_file_descriptor, |
| 131 const uint32 parent_id, | 141 const uint32 parent_id, |
| 132 const std::string& file_name, | 142 const std::string& file_name, |
| 133 const CopyFileFromLocalCallback& callback) = 0; | 143 const CopyFileFromLocalCallback& callback) = 0; |
| 134 | 144 |
| 135 // Deletes |object_id|. | 145 // Deletes |object_id|. |
| 136 virtual void DeleteObject(const std::string& storage_handle, | 146 virtual void DeleteObject(const std::string& storage_handle, |
| 137 const uint32 object_id, | 147 const uint32 object_id, |
| 138 const DeleteObjectCallback& callback) = 0; | 148 const DeleteObjectCallback& callback) = 0; |
| 139 | 149 |
| 140 // Creates and returns the global MediaTransferProtocolManager instance. | 150 // Creates and returns the global MediaTransferProtocolManager instance. |
| 141 // On Linux, |task_runner| specifies the task runner to process asynchronous | 151 // On Linux, |task_runner| specifies the task runner to process asynchronous |
| 142 // operations. | 152 // operations. |
| 143 // On ChromeOS, |task_runner| should just be set to NULL because ChromeOS | 153 // On ChromeOS, |task_runner| should just be set to NULL because ChromeOS |
| 144 // already has a dedicated message loop proxy. | 154 // already has a dedicated message loop proxy. |
| 145 static MediaTransferProtocolManager* Initialize( | 155 static MediaTransferProtocolManager* Initialize( |
| 146 scoped_refptr<base::SequencedTaskRunner> task_runner); | 156 scoped_refptr<base::SequencedTaskRunner> task_runner); |
| 147 }; | 157 }; |
| 148 | 158 |
| 149 } // namespace device | 159 } // namespace device |
| 150 | 160 |
| 151 #endif // DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_ | 161 #endif // DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_ |
| OLD | NEW |