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

Unified Diff: chromeos/dbus/media_transfer_protocol_daemon_client.cc

Issue 10868038: chromeos: Add GetFileInfo methods for MTPDClient. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 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: chromeos/dbus/media_transfer_protocol_daemon_client.cc
===================================================================
--- chromeos/dbus/media_transfer_protocol_daemon_client.cc (revision 153859)
+++ chromeos/dbus/media_transfer_protocol_daemon_client.cc (working copy)
@@ -204,6 +204,40 @@
}
// MediaTransferProtocolDaemonClient override.
+ virtual void GetFileInfoByPath(const std::string& handle,
+ const std::string& path,
+ const GetFileInfoCallback& callback,
+ const ErrorCallback& error_callback) {
+ dbus::MethodCall method_call(mtpd::kMtpdInterface, "GetFileInfoByPath");
+ dbus::MessageWriter writer(&method_call);
+ writer.AppendString(handle);
+ writer.AppendString(path);
+ proxy_->CallMethod(
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ base::Bind(&MediaTransferProtocolDaemonClientImpl::OnGetFileInfo,
+ weak_ptr_factory_.GetWeakPtr(),
+ callback,
+ error_callback));
+ }
+
+ // MediaTransferProtocolDaemonClient override.
+ virtual void GetFileInfoById(const std::string& handle,
+ uint32 file_id,
+ const GetFileInfoCallback& callback,
+ const ErrorCallback& error_callback) {
+ dbus::MethodCall method_call(mtpd::kMtpdInterface, "GetFileInfoById");
+ dbus::MessageWriter writer(&method_call);
+ writer.AppendString(handle);
+ writer.AppendUint32(file_id);
+ proxy_->CallMethod(
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ base::Bind(&MediaTransferProtocolDaemonClientImpl::OnGetFileInfo,
+ weak_ptr_factory_.GetWeakPtr(),
+ callback,
+ error_callback));
+ }
+
+ // MediaTransferProtocolDaemonClient override.
virtual void SetUpConnections(
const MTPStorageEventHandler& handler) OVERRIDE {
static const SignalEventTuple kSignalEventTuples[] = {
@@ -342,6 +376,20 @@
callback.Run(data);
}
+ // Handles the result of GetFileInfoByPath/Id and calls |callback| or
+ // |error_callback|.
+ void OnGetFileInfo(const GetFileInfoCallback& callback,
+ const ErrorCallback& error_callback,
+ dbus::Response* response) {
+ if (!response) {
+ error_callback.Run();
+ return;
+ }
+
+ FileEntry file_entry(response);
+ callback.Run(file_entry);
+ }
+
// Handles MTPStorageAttached/Dettached signals and calls |handler|.
void OnMTPStorageSignal(MTPStorageEventHandler handler,
bool is_attach,
@@ -410,6 +458,15 @@
uint32 file_id,
const ReadFileCallback& callback,
const ErrorCallback& error_callback) OVERRIDE {}
+ virtual void GetFileInfoByPath(
+ const std::string& handle,
+ const std::string& path,
+ const GetFileInfoCallback& callback,
+ const ErrorCallback& error_callback) OVERRIDE {}
+ virtual void GetFileInfoById(const std::string& handle,
+ uint32 file_id,
+ const GetFileInfoCallback& callback,
+ const ErrorCallback& error_callback) OVERRIDE {}
virtual void SetUpConnections(
const MTPStorageEventHandler& handler) OVERRIDE {}
« no previous file with comments | « chromeos/dbus/media_transfer_protocol_daemon_client.h ('k') | chromeos/dbus/mock_media_transfer_protocol_daemon_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698