| 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 <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 8 #include <string> | 11 #include <string> |
| 9 #include <vector> | 12 #include <vector> |
| 10 | 13 |
| 11 #include "base/callback.h" | 14 #include "base/callback.h" |
| 12 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 13 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 14 | 17 |
| 15 #if !defined(OS_LINUX) | 18 #if !defined(OS_LINUX) |
| 16 #error "Only used on Linux and ChromeOS" | 19 #error "Only used on Linux and ChromeOS" |
| 17 #endif | 20 #endif |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 virtual void OpenStorage(const std::string& storage_name, | 121 virtual void OpenStorage(const std::string& storage_name, |
| 119 const std::string& mode, | 122 const std::string& mode, |
| 120 const OpenStorageCallback& callback) = 0; | 123 const OpenStorageCallback& callback) = 0; |
| 121 | 124 |
| 122 // Close |storage_handle| and runs |callback|. | 125 // Close |storage_handle| and runs |callback|. |
| 123 virtual void CloseStorage(const std::string& storage_handle, | 126 virtual void CloseStorage(const std::string& storage_handle, |
| 124 const CloseStorageCallback& callback) = 0; | 127 const CloseStorageCallback& callback) = 0; |
| 125 | 128 |
| 126 // Creates |directory_name| in |parent_id|. | 129 // Creates |directory_name| in |parent_id|. |
| 127 virtual void CreateDirectory(const std::string& storage_handle, | 130 virtual void CreateDirectory(const std::string& storage_handle, |
| 128 const uint32 parent_id, | 131 const uint32_t parent_id, |
| 129 const std::string& directory_name, | 132 const std::string& directory_name, |
| 130 const CreateDirectoryCallback& callback) = 0; | 133 const CreateDirectoryCallback& callback) = 0; |
| 131 | 134 |
| 132 // Reads directory entries from |file_id| on |storage_handle| and runs | 135 // Reads directory entries from |file_id| on |storage_handle| and runs |
| 133 // |callback|. |max_size| is a maximum number of files to be read. | 136 // |callback|. |max_size| is a maximum number of files to be read. |
| 134 virtual void ReadDirectory(const std::string& storage_handle, | 137 virtual void ReadDirectory(const std::string& storage_handle, |
| 135 const uint32 file_id, | 138 const uint32_t file_id, |
| 136 const size_t max_size, | 139 const size_t max_size, |
| 137 const ReadDirectoryCallback& callback) = 0; | 140 const ReadDirectoryCallback& callback) = 0; |
| 138 | 141 |
| 139 // Reads file data from |file_id| on |storage_handle| and runs |callback|. | 142 // Reads file data from |file_id| on |storage_handle| and runs |callback|. |
| 140 // Reads |count| bytes of data starting at |offset|. | 143 // Reads |count| bytes of data starting at |offset|. |
| 141 virtual void ReadFileChunk(const std::string& storage_handle, | 144 virtual void ReadFileChunk(const std::string& storage_handle, |
| 142 uint32 file_id, | 145 uint32_t file_id, |
| 143 uint32 offset, | 146 uint32_t offset, |
| 144 uint32 count, | 147 uint32_t count, |
| 145 const ReadFileCallback& callback) = 0; | 148 const ReadFileCallback& callback) = 0; |
| 146 | 149 |
| 147 // Gets the file metadata for |file_id| on |storage_handle| and runs | 150 // Gets the file metadata for |file_id| on |storage_handle| and runs |
| 148 // |callback|. | 151 // |callback|. |
| 149 virtual void GetFileInfo(const std::string& storage_handle, | 152 virtual void GetFileInfo(const std::string& storage_handle, |
| 150 uint32 file_id, | 153 uint32_t file_id, |
| 151 const GetFileInfoCallback& callback) = 0; | 154 const GetFileInfoCallback& callback) = 0; |
| 152 | 155 |
| 153 // Renames |object_id| to |new_name|. | 156 // Renames |object_id| to |new_name|. |
| 154 virtual void RenameObject(const std::string& storage_handle, | 157 virtual void RenameObject(const std::string& storage_handle, |
| 155 const uint32 object_id, | 158 const uint32_t object_id, |
| 156 const std::string& new_name, | 159 const std::string& new_name, |
| 157 const RenameObjectCallback& callback) = 0; | 160 const RenameObjectCallback& callback) = 0; |
| 158 | 161 |
| 159 // Copies the file from |source_file_descriptor| to |file_name| on | 162 // Copies the file from |source_file_descriptor| to |file_name| on |
| 160 // |parent_id|. | 163 // |parent_id|. |
| 161 virtual void CopyFileFromLocal(const std::string& storage_handle, | 164 virtual void CopyFileFromLocal(const std::string& storage_handle, |
| 162 const int source_file_descriptor, | 165 const int source_file_descriptor, |
| 163 const uint32 parent_id, | 166 const uint32_t parent_id, |
| 164 const std::string& file_name, | 167 const std::string& file_name, |
| 165 const CopyFileFromLocalCallback& callback) = 0; | 168 const CopyFileFromLocalCallback& callback) = 0; |
| 166 | 169 |
| 167 // Deletes |object_id|. | 170 // Deletes |object_id|. |
| 168 virtual void DeleteObject(const std::string& storage_handle, | 171 virtual void DeleteObject(const std::string& storage_handle, |
| 169 const uint32 object_id, | 172 const uint32_t object_id, |
| 170 const DeleteObjectCallback& callback) = 0; | 173 const DeleteObjectCallback& callback) = 0; |
| 171 | 174 |
| 172 // Creates and returns the global MediaTransferProtocolManager instance. | 175 // Creates and returns the global MediaTransferProtocolManager instance. |
| 173 // On Linux, |task_runner| specifies the task runner to process asynchronous | 176 // On Linux, |task_runner| specifies the task runner to process asynchronous |
| 174 // operations. | 177 // operations. |
| 175 // On ChromeOS, |task_runner| should just be set to NULL because ChromeOS | 178 // On ChromeOS, |task_runner| should just be set to NULL because ChromeOS |
| 176 // already has a dedicated message loop proxy. | 179 // already has a dedicated message loop proxy. |
| 177 static MediaTransferProtocolManager* Initialize( | 180 static MediaTransferProtocolManager* Initialize( |
| 178 scoped_refptr<base::SequencedTaskRunner> task_runner); | 181 scoped_refptr<base::SequencedTaskRunner> task_runner); |
| 179 }; | 182 }; |
| 180 | 183 |
| 181 } // namespace device | 184 } // namespace device |
| 182 | 185 |
| 183 #endif // DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_ | 186 #endif // DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_ |
| OLD | NEW |