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

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

Issue 10829384: SystemMonitor: Pull device type into the device id (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments 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 7a9b4d88a9a2c4e5c3028fe9692fce1d543a8062..1afb092b4a59af8bb085827e7c7fe855db475741 100644
--- a/chrome/browser/media_gallery/media_device_notifications_chromeos.cc
+++ b/chrome/browser/media_gallery/media_device_notifications_chromeos.cc
@@ -13,13 +13,14 @@
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/media_gallery/media_device_notifications_utils.h"
+#include "chrome/browser/media_gallery/media_storage_util.h"
#include "content/public/browser/browser_thread.h"
namespace chromeos {
namespace {
-bool GetDeviceInfo(const std::string& source_path, std::string* device_id,
+bool GetDeviceInfo(const std::string& source_path, std::string* unique_id,
string16* device_label) {
// Get the media device uuid and label if exists.
const disks::DiskMountManager::Disk* disk =
@@ -27,7 +28,7 @@ bool GetDeviceInfo(const std::string& source_path, std::string* device_id,
if (!disk)
return false;
- *device_id = disk->fs_uuid();
+ *unique_id = disk->fs_uuid();
// TODO(kmadhusu): If device label is empty, extract vendor and model details
// and use them as device_label.
@@ -139,23 +140,23 @@ void MediaDeviceNotifications::AddMountedPathOnUIThread(
}
// Get the media device uuid and label if exists.
- std::string device_id;
+ std::string unique_id;
string16 device_label;
- if (!GetDeviceInfo(mount_info.source_path, &device_id, &device_label))
+ if (!GetDeviceInfo(mount_info.source_path, &unique_id, &device_label))
return;
// Keep track of device uuid, to see how often we receive empty uuid values.
UMA_HISTOGRAM_BOOLEAN("MediaDeviceNotification.device_uuid_available",
- !device_id.empty());
- if (device_id.empty())
+ !unique_id.empty());
+ if (unique_id.empty())
return;
+ std::string device_id = chrome::MediaStorageUtil::MakeDeviceId(
+ chrome::MediaStorageUtil::USB_MASS_STORAGE_WITH_DCIM, unique_id);
mount_map_.insert(std::make_pair(mount_info.mount_path, device_id));
- base::SystemMonitor::Get()->ProcessMediaDeviceAttached(
- device_id,
- device_label,
- base::SystemMonitor::TYPE_PATH,
- mount_info.mount_path);
+ base::SystemMonitor::Get()->ProcessMediaDeviceAttached(device_id,
+ device_label,
+ mount_info.mount_path);
}
} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698