diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-09 22:43:17 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-09 22:43:17 +0000 |
commit | c157bbc29b11c3d995190eeb9bfe0f043ccd5e0e (patch) | |
tree | 3897454813fcc8b6a8f37c762f8959f58f0a68af /chromeos | |
parent | a7c6433995e9f2ebe99cd55e692d53044731c731 (diff) | |
download | chromium_src-c157bbc29b11c3d995190eeb9bfe0f043ccd5e0e.zip chromium_src-c157bbc29b11c3d995190eeb9bfe0f043ccd5e0e.tar.gz chromium_src-c157bbc29b11c3d995190eeb9bfe0f043ccd5e0e.tar.bz2 |
Remove OpenStorageMode from chromeos MTP code and other bits of cleanup.
Review URL: https://codereview.chromium.org/11068013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@160961 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
3 files changed, 17 insertions, 20 deletions
diff --git a/chromeos/dbus/media_transfer_protocol_daemon_client.cc b/chromeos/dbus/media_transfer_protocol_daemon_client.cc index 1d8e1e3..b5554e0 100644 --- a/chromeos/dbus/media_transfer_protocol_daemon_client.cc +++ b/chromeos/dbus/media_transfer_protocol_daemon_client.cc @@ -17,6 +17,8 @@ namespace chromeos { namespace { +const char kInvalidResponseMsg[] = "Invalid Response: "; + // The MediaTransferProtocolDaemonClient implementation. class MediaTransferProtocolDaemonClientImpl : public MediaTransferProtocolDaemonClient { @@ -58,13 +60,13 @@ class MediaTransferProtocolDaemonClientImpl // MediaTransferProtocolDaemonClient override. virtual void OpenStorage(const std::string& storage_name, - OpenStorageMode mode, + const std::string& mode, const OpenStorageCallback& callback, const ErrorCallback& error_callback) OVERRIDE { dbus::MethodCall method_call(mtpd::kMtpdInterface, mtpd::kOpenStorage); dbus::MessageWriter writer(&method_call); writer.AppendString(storage_name); - DCHECK_EQ(OPEN_STORAGE_MODE_READ_ONLY, mode); + DCHECK_EQ(mtpd::kReadOnlyMode, mode); writer.AppendString(mtpd::kReadOnlyMode); proxy_->CallMethod( &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, @@ -166,7 +168,8 @@ class MediaTransferProtocolDaemonClientImpl const std::string& path, const GetFileInfoCallback& callback, const ErrorCallback& error_callback) OVERRIDE { - dbus::MethodCall method_call(mtpd::kMtpdInterface, "GetFileInfoByPath"); + dbus::MethodCall method_call(mtpd::kMtpdInterface, + mtpd::kGetFileInfoByPath); dbus::MessageWriter writer(&method_call); writer.AppendString(handle); writer.AppendString(path); @@ -183,7 +186,7 @@ class MediaTransferProtocolDaemonClientImpl uint32 file_id, const GetFileInfoCallback& callback, const ErrorCallback& error_callback) OVERRIDE { - dbus::MethodCall method_call(mtpd::kMtpdInterface, "GetFileInfoById"); + dbus::MethodCall method_call(mtpd::kMtpdInterface, mtpd::kGetFileInfoById); dbus::MessageWriter writer(&method_call); writer.AppendString(handle); writer.AppendUint32(file_id); @@ -237,7 +240,7 @@ class MediaTransferProtocolDaemonClientImpl dbus::MessageReader reader(response); std::vector<std::string> storage_names; if (!reader.PopArrayOfStrings(&storage_names)) { - LOG(ERROR) << "Invalid response: " << response->ToString(); + LOG(ERROR) << kInvalidResponseMsg << response->ToString(); error_callback.Run(); return; } @@ -258,7 +261,7 @@ class MediaTransferProtocolDaemonClientImpl dbus::MessageReader reader(response); MtpStorageInfo protobuf; if (!reader.PopArrayOfBytesAsProto(&protobuf)) { - LOG(ERROR) << "Invalid response: " << response->ToString(); + LOG(ERROR) << kInvalidResponseMsg << response->ToString(); error_callback.Run(); return; } @@ -276,7 +279,7 @@ class MediaTransferProtocolDaemonClientImpl dbus::MessageReader reader(response); std::string handle; if (!reader.PopString(&handle)) { - LOG(ERROR) << "Invalid response: " << response->ToString(); + LOG(ERROR) << kInvalidResponseMsg << response->ToString(); error_callback.Run(); return; } @@ -309,7 +312,7 @@ class MediaTransferProtocolDaemonClientImpl dbus::MessageReader reader(response); MtpFileEntries entries_protobuf; if (!reader.PopArrayOfBytesAsProto(&entries_protobuf)) { - LOG(ERROR) << "Invalid response: " << response->ToString(); + LOG(ERROR) << kInvalidResponseMsg << response->ToString(); error_callback.Run(); return; } @@ -353,7 +356,7 @@ class MediaTransferProtocolDaemonClientImpl dbus::MessageReader reader(response); MtpFileEntry protobuf; if (!reader.PopArrayOfBytesAsProto(&protobuf)) { - LOG(ERROR) << "Invalid response: " << response->ToString(); + LOG(ERROR) << kInvalidResponseMsg << response->ToString(); error_callback.Run(); return; } @@ -407,7 +410,7 @@ class MediaTransferProtocolDaemonClientStubImpl const GetStorageInfoCallback& callback, const ErrorCallback& error_callback) OVERRIDE {} virtual void OpenStorage(const std::string& storage_name, - OpenStorageMode mode, + const std::string& mode, const OpenStorageCallback& callback, const ErrorCallback& error_callback) OVERRIDE {} virtual void CloseStorage(const std::string& handle, diff --git a/chromeos/dbus/media_transfer_protocol_daemon_client.h b/chromeos/dbus/media_transfer_protocol_daemon_client.h index 2417912..093252a 100644 --- a/chromeos/dbus/media_transfer_protocol_daemon_client.h +++ b/chromeos/dbus/media_transfer_protocol_daemon_client.h @@ -14,7 +14,6 @@ #include "base/basictypes.h" #include "base/callback.h" -#include "base/time.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client_implementation_type.h" @@ -27,11 +26,6 @@ class Bus; namespace chromeos { -// Mode to open a storage in. -enum OpenStorageMode { - OPEN_STORAGE_MODE_READ_ONLY, -}; - // A class to make the actual DBus calls for mtpd service. // This class only makes calls, result/error handling should be done // by callbacks. @@ -97,7 +91,7 @@ class CHROMEOS_EXPORT MediaTransferProtocolDaemonClient { // succeeds, otherwise, |error_callback| is called. // OpenStorage returns a handle in |callback|. virtual void OpenStorage(const std::string& storage_name, - OpenStorageMode mode, + const std::string& mode, const OpenStorageCallback& callback, const ErrorCallback& error_callback) = 0; @@ -160,8 +154,8 @@ class CHROMEOS_EXPORT MediaTransferProtocolDaemonClient { // Factory function, creates a new instance and returns ownership. // For normal usage, access the singleton via DBusThreadManager::Get(). - static MediaTransferProtocolDaemonClient* - Create(DBusClientImplementationType type, dbus::Bus* bus); + static MediaTransferProtocolDaemonClient* Create( + DBusClientImplementationType type, dbus::Bus* bus); protected: // Create() should be used instead. diff --git a/chromeos/dbus/mock_media_transfer_protocol_daemon_client.h b/chromeos/dbus/mock_media_transfer_protocol_daemon_client.h index 6a71842..8c0e967 100644 --- a/chromeos/dbus/mock_media_transfer_protocol_daemon_client.h +++ b/chromeos/dbus/mock_media_transfer_protocol_daemon_client.h @@ -24,7 +24,7 @@ class MockMediaTransferProtocolDaemonClient const GetStorageInfoCallback&, const ErrorCallback&)); MOCK_METHOD4(OpenStorage, void(const std::string&, - OpenStorageMode mode, + const std::string&, const OpenStorageCallback&, const ErrorCallback&)); MOCK_METHOD3(CloseStorage, void(const std::string&, |