diff options
Diffstat (limited to 'device')
4 files changed, 42 insertions, 44 deletions
diff --git a/device/media_transfer_protocol/media_transfer_protocol_daemon_client.cc b/device/media_transfer_protocol/media_transfer_protocol_daemon_client.cc index f4e855c..5639169 100644 --- a/device/media_transfer_protocol/media_transfer_protocol_daemon_client.cc +++ b/device/media_transfer_protocol/media_transfer_protocol_daemon_client.cc @@ -151,15 +151,14 @@ class MediaTransferProtocolDaemonClientImpl } // MediaTransferProtocolDaemonClient override. - virtual void ReadFileChunkById(const std::string& handle, - uint32 file_id, - uint32 offset, - uint32 bytes_to_read, - const ReadFileCallback& callback, - const ErrorCallback& error_callback) OVERRIDE { + virtual void ReadFileChunk(const std::string& handle, + uint32 file_id, + uint32 offset, + uint32 bytes_to_read, + const ReadFileCallback& callback, + const ErrorCallback& error_callback) OVERRIDE { DCHECK_LE(bytes_to_read, kMaxChunkSize); - dbus::MethodCall method_call(mtpd::kMtpdInterface, - mtpd::kReadFileChunkById); + dbus::MethodCall method_call(mtpd::kMtpdInterface, mtpd::kReadFileChunk); dbus::MessageWriter writer(&method_call); writer.AppendString(handle); writer.AppendUint32(file_id); @@ -331,7 +330,7 @@ class MediaTransferProtocolDaemonClientImpl callback.Run(file_entries); } - // Handles the result of ReadFileChunkById and calls |callback| or + // Handles the result of ReadFileChunk and calls |callback| or // |error_callback|. void OnReadFile(const ReadFileCallback& callback, const ErrorCallback& error_callback, diff --git a/device/media_transfer_protocol/media_transfer_protocol_daemon_client.h b/device/media_transfer_protocol/media_transfer_protocol_daemon_client.h index 2ea92d8..b051e6c 100644 --- a/device/media_transfer_protocol/media_transfer_protocol_daemon_client.h +++ b/device/media_transfer_protocol/media_transfer_protocol_daemon_client.h @@ -125,17 +125,17 @@ class MediaTransferProtocolDaemonClient { const GetFileInfoCallback& callback, const ErrorCallback& error_callback) = 0; - // TODO(thestig): Rename to ReadFileChunk. - // Calls ReadFilePathById method. |callback| is called after the method call + // Calls ReadFileChunk method. |callback| is called after the method call // succeeds, otherwise, |error_callback| is called. // |file_id| is a MTP-device specific id for a file. + // |offset| is the offset into the file. // |bytes_to_read| cannot exceed 1 MiB. - virtual void ReadFileChunkById(const std::string& handle, - uint32 file_id, - uint32 offset, - uint32 bytes_to_read, - const ReadFileCallback& callback, - const ErrorCallback& error_callback) = 0; + virtual void ReadFileChunk(const std::string& handle, + uint32 file_id, + uint32 offset, + uint32 bytes_to_read, + const ReadFileCallback& callback, + const ErrorCallback& error_callback) = 0; // Registers given callback for events. Should only be called once. // |storage_event_handler| is called when a mtp storage attach or detach diff --git a/device/media_transfer_protocol/media_transfer_protocol_manager.cc b/device/media_transfer_protocol/media_transfer_protocol_manager.cc index 8bff2d8..e923975 100644 --- a/device/media_transfer_protocol/media_transfer_protocol_manager.cc +++ b/device/media_transfer_protocol/media_transfer_protocol_manager.cc @@ -160,10 +160,9 @@ class MediaTransferProtocolManagerImpl : public MediaTransferProtocolManager { } // MediaTransferProtocolManager override. - virtual void ReadDirectoryById( - const std::string& storage_handle, - uint32 file_id, - const ReadDirectoryCallback& callback) OVERRIDE { + virtual void ReadDirectory(const std::string& storage_handle, + uint32 file_id, + const ReadDirectoryCallback& callback) OVERRIDE { DCHECK(thread_checker_.CalledOnValidThread()); if (!ContainsKey(handles_, storage_handle) || !mtp_client_) { callback.Run(std::vector<MtpFileEntry>(), @@ -183,18 +182,18 @@ class MediaTransferProtocolManagerImpl : public MediaTransferProtocolManager { } // MediaTransferProtocolManager override. - virtual void ReadFileChunkById(const std::string& storage_handle, - uint32 file_id, - uint32 offset, - uint32 count, - const ReadFileCallback& callback) OVERRIDE { + virtual void ReadFileChunk(const std::string& storage_handle, + uint32 file_id, + uint32 offset, + uint32 count, + const ReadFileCallback& callback) OVERRIDE { DCHECK(thread_checker_.CalledOnValidThread()); if (!ContainsKey(handles_, storage_handle) || !mtp_client_) { callback.Run(std::string(), true); return; } read_file_callbacks_.push(callback); - mtp_client_->ReadFileChunkById( + mtp_client_->ReadFileChunk( storage_handle, file_id, offset, count, base::Bind(&MediaTransferProtocolManagerImpl::OnReadFile, weak_ptr_factory_.GetWeakPtr()), @@ -202,9 +201,9 @@ class MediaTransferProtocolManagerImpl : public MediaTransferProtocolManager { weak_ptr_factory_.GetWeakPtr())); } - virtual void GetFileInfoById(const std::string& storage_handle, - uint32 file_id, - const GetFileInfoCallback& callback) OVERRIDE { + virtual void GetFileInfo(const std::string& storage_handle, + uint32 file_id, + const GetFileInfoCallback& callback) OVERRIDE { DCHECK(thread_checker_.CalledOnValidThread()); if (!ContainsKey(handles_, storage_handle) || !mtp_client_) { callback.Run(MtpFileEntry(), true); diff --git a/device/media_transfer_protocol/media_transfer_protocol_manager.h b/device/media_transfer_protocol/media_transfer_protocol_manager.h index 92c3d3d..7ff89e9 100644 --- a/device/media_transfer_protocol/media_transfer_protocol_manager.h +++ b/device/media_transfer_protocol/media_transfer_protocol_manager.h @@ -39,7 +39,7 @@ class MediaTransferProtocolManager { // The argument is true if there was an error. typedef base::Callback<void(bool error)> CloseStorageCallback; - // A callback to handle the result of ReadDirectoryById. + // A callback to handle the result of ReadDirectory. // The first argument is a vector of file entries. // The second argument is true if there are more file entries. // The third argument is true if there was an error. @@ -47,13 +47,13 @@ class MediaTransferProtocolManager { bool has_more, bool error)> ReadDirectoryCallback; - // A callback to handle the result of ReadFileChunkById. + // A callback to handle the result of ReadFileChunk. // The first argument is a string containing the file data. // The second argument is true if there was an error. typedef base::Callback<void(const std::string& data, bool error)> ReadFileCallback; - // A callback to handle the result of GetFileInfoById. + // A callback to handle the result of GetFileInfo. // The first argument is a file entry. // The second argument is true if there was an error. typedef base::Callback<void(const MtpFileEntry& file_entry, @@ -97,23 +97,23 @@ class MediaTransferProtocolManager { // Reads directory entries from |file_id| on |storage_handle| and runs // |callback|. - virtual void ReadDirectoryById(const std::string& storage_handle, - uint32 file_id, - const ReadDirectoryCallback& callback) = 0; + virtual void ReadDirectory(const std::string& storage_handle, + uint32 file_id, + const ReadDirectoryCallback& callback) = 0; // Reads file data from |file_id| on |storage_handle| and runs |callback|. // Reads |count| bytes of data starting at |offset|. - virtual void ReadFileChunkById(const std::string& storage_handle, - uint32 file_id, - uint32 offset, - uint32 count, - const ReadFileCallback& callback) = 0; + virtual void ReadFileChunk(const std::string& storage_handle, + uint32 file_id, + uint32 offset, + uint32 count, + const ReadFileCallback& callback) = 0; // Gets the file metadata for |file_id| on |storage_handle| and runs // |callback|. - virtual void GetFileInfoById(const std::string& storage_handle, - uint32 file_id, - const GetFileInfoCallback& callback) = 0; + virtual void GetFileInfo(const std::string& storage_handle, + uint32 file_id, + const GetFileInfoCallback& callback) = 0; // Creates and returns the global MediaTransferProtocolManager instance. // On Linux, |task_runner| specifies the task runner to process asynchronous |