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

Unified Diff: components/storage_monitor/media_transfer_protocol_device_observer_linux.cc

Issue 287613002: Fill |model_name| and |vendor_name| fields of StorageInfo for MTP devices. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test for the newly filled members. Created 6 years, 7 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: components/storage_monitor/media_transfer_protocol_device_observer_linux.cc
diff --git a/components/storage_monitor/media_transfer_protocol_device_observer_linux.cc b/components/storage_monitor/media_transfer_protocol_device_observer_linux.cc
index 6c3e4b00696dcd8b89adf66940abd078979e0c8d..e44fe0919e3eb837e4e63800fc631abe7748f6ff 100644
--- a/components/storage_monitor/media_transfer_protocol_device_observer_linux.cc
+++ b/components/storage_monitor/media_transfer_protocol_device_observer_linux.cc
@@ -94,12 +94,15 @@ base::string16 GetDeviceLabelFromStorageInfo(
}
// Helper function to get the device storage details such as device id, label
-// and location. On success and fills in |id|, |label| and |location|.
+// and location. On success and fills in |id|, |label|, |location|,
+// |vendor_name|, and |product_name|.
void GetStorageInfo(const std::string& storage_name,
device::MediaTransferProtocolManager* mtp_manager,
std::string* id,
base::string16* label,
- std::string* location) {
+ std::string* location,
+ base::string16* vendor_name,
+ base::string16* product_name) {
DCHECK(!storage_name.empty());
const MtpStorageInfo* storage_info =
mtp_manager->GetStorageInfo(storage_name);
@@ -110,6 +113,8 @@ void GetStorageInfo(const std::string& storage_name,
*id = GetDeviceIdFromStorageInfo(*storage_info);
*label = GetDeviceLabelFromStorageInfo(*storage_info);
*location = GetDeviceLocationFromStorageName(storage_name);
+ *vendor_name = base::UTF8ToUTF16(storage_info->vendor());
+ *product_name = base::UTF8ToUTF16(storage_info->product());
}
} // namespace
@@ -192,8 +197,11 @@ void MediaTransferProtocolDeviceObserverLinux::StorageChanged(
std::string device_id;
base::string16 storage_label;
std::string location;
+ base::string16 vendor_name;
+ base::string16 product_name;
get_storage_info_func_(storage_name, mtp_manager_,
- &device_id, &storage_label, &location);
+ &device_id, &storage_label, &location,
+ &vendor_name, &product_name);
// Keep track of device id and device name to see how often we receive
// empty values.
@@ -205,7 +213,7 @@ void MediaTransferProtocolDeviceObserverLinux::StorageChanged(
DCHECK(!ContainsKey(storage_map_, location));
StorageInfo storage_info(device_id, location, storage_label,
- base::string16(), base::string16(), 0);
+ vendor_name, product_name, 0);
storage_map_[location] = storage_info;
notifications_->ProcessAttach(storage_info);
} else {

Powered by Google App Engine
This is Rietveld 408576698