Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: chrome/browser/media_galleries/linux/mtp_device_task_helper.cc

Issue 1007173003: Implement MoveFileLocal (with rename operation). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media_galleries/linux/mtp_device_task_helper.cc
diff --git a/chrome/browser/media_galleries/linux/mtp_device_task_helper.cc b/chrome/browser/media_galleries/linux/mtp_device_task_helper.cc
index c1f7a2b999ff6743e03a045e588aebf3c2c9833b..848e5e09f58c2bd2fbf3e394e17bf0fc54cb5fce 100644
--- a/chrome/browser/media_galleries/linux/mtp_device_task_helper.cc
+++ b/chrome/browser/media_galleries/linux/mtp_device_task_helper.cc
@@ -138,6 +138,20 @@ void MTPDeviceTaskHelper::ReadBytes(
weak_ptr_factory_.GetWeakPtr(), request));
}
+void MTPDeviceTaskHelper::RenameObject(
+ const uint32 object_id,
+ const std::string& new_name,
+ const RenameObjectSuccessCallback& success_callback,
+ const ErrorCallback& error_callback) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+
+ GetMediaTransferProtocolManager()->RenameObject(
+ device_handle_, object_id, new_name,
+ base::Bind(&MTPDeviceTaskHelper::OnRenameObject,
+ weak_ptr_factory_.GetWeakPtr(), success_callback,
+ error_callback));
+}
+
// TODO(yawano) storage_name is not used, delete it.
void MTPDeviceTaskHelper::CopyFileFromLocal(
const std::string& storage_name,
@@ -298,6 +312,22 @@ void MTPDeviceTaskHelper::OnDidReadBytes(
file_info, data.length()));
}
+void MTPDeviceTaskHelper::OnRenameObject(
+ const RenameObjectSuccessCallback& success_callback,
+ const ErrorCallback& error_callback,
+ const bool error) const {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ if (error) {
+ content::BrowserThread::PostTask(
+ content::BrowserThread::IO, FROM_HERE,
+ base::Bind(error_callback, base::File::FILE_ERROR_FAILED));
+ return;
+ }
+
+ content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE,
+ success_callback);
+}
+
void MTPDeviceTaskHelper::OnCopyFileFromLocal(
const CopyFileFromLocalSuccessCallback& success_callback,
const ErrorCallback& error_callback,
@@ -311,7 +341,7 @@ void MTPDeviceTaskHelper::OnCopyFileFromLocal(
}
content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE,
- base::Bind(success_callback));
+ success_callback);
}
void MTPDeviceTaskHelper::OnDeleteObject(

Powered by Google App Engine
This is Rietveld 408576698