Chromium Code Reviews| Index: chrome/browser/system_monitor/media_transfer_protocol_device_observer_chromeos.cc |
| diff --git a/chrome/browser/system_monitor/media_transfer_protocol_device_observer_chromeos.cc b/chrome/browser/system_monitor/media_transfer_protocol_device_observer_chromeos.cc |
| index 4afddf94fdabc3dd73c3615fe300e56fdea2cc18..674f81e9f631cbe3780cd85d7990332449bc3fdb 100644 |
| --- a/chrome/browser/system_monitor/media_transfer_protocol_device_observer_chromeos.cc |
| +++ b/chrome/browser/system_monitor/media_transfer_protocol_device_observer_chromeos.cc |
| @@ -73,6 +73,14 @@ std::string GetDeviceIdFromStorageInfo(const MtpStorageInfo& storage_info) { |
| unique_id); |
| } |
| +// Returns the |data_store_id| string in the required format. |
| +// If the |data_store_id| is 65537, this function returns "(65537)". |
| +std::string GetFormattedIdString(const std::string& data_store_id) { |
| + return base::StringPrintf("%s%s%s", |
|
Lei Zhang
2012/09/19 19:03:32
Please format this function call correctly. http:/
kmadhusu
2012/09/19 19:06:05
Done.
|
| + chrome::kLeftParen, data_store_id.c_str(), |
| + chrome::kRightParen); |
| +} |
| + |
| // Helper function to get device label from storage information. |
| string16 GetDeviceLabelFromStorageInfo(const MtpStorageInfo& storage_info) { |
| std::string device_label; |
| @@ -90,15 +98,12 @@ string16 GetDeviceLabelFromStorageInfo(const MtpStorageInfo& storage_info) { |
| if (!device_label.empty()) { |
| const std::string& volume_id = storage_info.volume_identifier(); |
| if (!volume_id.empty()) { |
| - // TODO(kmadhusu): Use StringPrintf here and on line 98. |
| - device_label += chrome::kLeftParen + volume_id + chrome::kRightParen; |
| + device_label += GetFormattedIdString(volume_id); |
| } else { |
| const std::string data_store_id = |
| GetStorageIdFromStorageName(storage_info.storage_name()); |
| - if (!data_store_id.empty()) { |
| - device_label += chrome::kLeftParen + data_store_id + |
| - chrome::kRightParen; |
| - } |
| + if (!data_store_id.empty()) |
| + device_label += GetFormattedIdString(data_store_id); |
| } |
| } |
| return UTF8ToUTF16(device_label); |