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

Unified Diff: chrome/browser/media_gallery/media_device_notifications_chromeos.cc

Issue 10829160: Created a helper function "FindDiskBySourcePath" in DiskMountManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix browser test 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: chrome/browser/media_gallery/media_device_notifications_chromeos.cc
diff --git a/chrome/browser/media_gallery/media_device_notifications_chromeos.cc b/chrome/browser/media_gallery/media_device_notifications_chromeos.cc
index 9d29a73d8343abda4e6e965d54c836670c6e9feb..7a9b4d88a9a2c4e5c3028fe9692fce1d543a8062 100644
--- a/chrome/browser/media_gallery/media_device_notifications_chromeos.cc
+++ b/chrome/browser/media_gallery/media_device_notifications_chromeos.cc
@@ -22,20 +22,18 @@ namespace {
bool GetDeviceInfo(const std::string& source_path, std::string* device_id,
string16* device_label) {
// Get the media device uuid and label if exists.
- const disks::DiskMountManager::DiskMap& disks =
- disks::DiskMountManager::GetInstance()->disks();
- disks::DiskMountManager::DiskMap::const_iterator it = disks.find(source_path);
- if (it == disks.end())
+ const disks::DiskMountManager::Disk* disk =
+ disks::DiskMountManager::GetInstance()->FindDiskBySourcePath(source_path);
+ if (!disk)
return false;
- const disks::DiskMountManager::Disk& disk = *(it->second);
- *device_id = disk.fs_uuid();
+ *device_id = disk->fs_uuid();
// TODO(kmadhusu): If device label is empty, extract vendor and model details
// and use them as device_label.
- *device_label = UTF8ToUTF16(disk.device_label().empty() ?
+ *device_label = UTF8ToUTF16(disk->device_label().empty() ?
FilePath(source_path).BaseName().value() :
- disk.device_label());
+ disk->device_label());
return true;
}

Powered by Google App Engine
This is Rietveld 408576698