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

Unified Diff: chrome/browser/system_monitor/portable_device_watcher_win.cc

Issue 11761006: [Win, MediaGallery] Check the portable device pnp device id to filter the mass storage class device… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 12 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/system_monitor/portable_device_watcher_win.cc
diff --git a/chrome/browser/system_monitor/portable_device_watcher_win.cc b/chrome/browser/system_monitor/portable_device_watcher_win.cc
index 70a9f7f229b2a6ec24e2718c6f3bf46c33d2a06d..60baedfdea4ba77d7782582acf4859852ad32870 100644
--- a/chrome/browser/system_monitor/portable_device_watcher_win.cc
+++ b/chrome/browser/system_monitor/portable_device_watcher_win.cc
@@ -294,9 +294,16 @@ bool GetRemovableStorageObjectIds(
return true;
}
-// Returns true if the portable device is mounted on a volume. |device_name|
-// specifies the name of the device.
-bool IsVolumeMountedPortableDevice(const string16& device_name) {
+// Returns true if the portable device belongs to a mass storage class.
+// |pnp_device_id| specifies the plug and play device id.
+// |device_name| specifies the name of the device.
+bool IsMassStoragePortableDevice(const string16& pnp_device_id,
+ const string16& device_name) {
+ // Based on testing, if the pnp device id starts with "\\?\wpdbusenumroot#",
+ // then the attached device belongs to a mass storage class.
+ if (StartsWith(pnp_device_id, L"\\\\?\\wpdbusenumroot#", false))
+ return true;
+
// If the device is a volume mounted device, |device_name| will be
// the volume name.
return ((device_name.length() >= 2) && (device_name[1] == L':') &&
@@ -366,7 +373,7 @@ bool GetDeviceInfoOnBlockingThread(
DCHECK(!pnp_device_id.empty());
device_details->name = GetDeviceNameOnBlockingThread(portable_device_manager,
pnp_device_id);
- if (IsVolumeMountedPortableDevice(device_details->name))
+ if (IsMassStoragePortableDevice(pnp_device_id, device_details->name))
return false;
device_details->location = pnp_device_id;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698