diff options
author | kmadhusu@chromium.org <kmadhusu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-12 22:54:20 +0000 |
---|---|---|
committer | kmadhusu@chromium.org <kmadhusu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-12 22:54:20 +0000 |
commit | 297b105fe467caf70593bf96d67b65c8220c44ce (patch) | |
tree | 5683b078ad20c73cebfc9b6a21b5bde84df3c3b5 /chrome/browser/system_monitor | |
parent | afeecab053a2d945d21d72434e970a1c290fc530 (diff) | |
download | chromium_src-297b105fe467caf70593bf96d67b65c8220c44ce.zip chromium_src-297b105fe467caf70593bf96d67b65c8220c44ce.tar.gz chromium_src-297b105fe467caf70593bf96d67b65c8220c44ce.tar.bz2 |
Modify MediaStorageUtil::FindDevicePathById function to handle MTP_OR_PTP device types.
BUG=144527
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10933048
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156405 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/system_monitor')
-rw-r--r-- | chrome/browser/system_monitor/media_storage_util.cc | 47 |
1 files changed, 19 insertions, 28 deletions
diff --git a/chrome/browser/system_monitor/media_storage_util.cc b/chrome/browser/system_monitor/media_storage_util.cc index 8a0d057..b01ea0d 100644 --- a/chrome/browser/system_monitor/media_storage_util.cc +++ b/chrome/browser/system_monitor/media_storage_util.cc @@ -130,23 +130,19 @@ void MediaStorageUtil::IsDeviceAttached(const std::string& device_id, return; } - switch (type) { - case MTP_OR_PTP: // Fall through. - case REMOVABLE_MASS_STORAGE_WITH_DCIM: // Fall through. - case REMOVABLE_MASS_STORAGE_NO_DCIM: - // We should be able to find removable storage in SystemMonitor. - callback.Run(!FindRemovableStorageLocationById(device_id).empty()); - break; - case FIXED_MASS_STORAGE: - // For this type, the unique_id is the path. - BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, - base::Bind(&ValidatePathOnFileThread, - FilePath::FromUTF8Unsafe(unique_id), - callback)); - break; + if (type == FIXED_MASS_STORAGE) { + // For this type, the unique_id is the path. + BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, + base::Bind(&ValidatePathOnFileThread, + FilePath::FromUTF8Unsafe(unique_id), + callback)); + } else { + DCHECK(type == MTP_OR_PTP || + type == REMOVABLE_MASS_STORAGE_WITH_DCIM || + type == REMOVABLE_MASS_STORAGE_NO_DCIM); + // We should be able to find removable storage in SystemMonitor. + callback.Run(!FindRemovableStorageLocationById(device_id).empty()); } - NOTREACHED(); - callback.Run(false); } // static @@ -169,20 +165,15 @@ FilePath MediaStorageUtil::FindDevicePathById(const std::string& device_id) { if (!CrackDeviceId(device_id, &type, &unique_id)) return FilePath(); - switch (type) { - case MTP_OR_PTP: - // TODO(kmadhusu) We may want to return the MTP device location here. - return FilePath(); - case REMOVABLE_MASS_STORAGE_WITH_DCIM: // Fall through. - case REMOVABLE_MASS_STORAGE_NO_DCIM: - return FilePath(FindRemovableStorageLocationById(device_id)); - case FIXED_MASS_STORAGE: - // For this type, the unique_id is the path. - return FilePath::FromUTF8Unsafe(unique_id); + if (type == FIXED_MASS_STORAGE) { + // For this type, the unique_id is the path. + return FilePath::FromUTF8Unsafe(unique_id); } - NOTREACHED(); - return FilePath(); + DCHECK(type == MTP_OR_PTP || + type == REMOVABLE_MASS_STORAGE_WITH_DCIM || + type == REMOVABLE_MASS_STORAGE_NO_DCIM); + return FilePath(FindRemovableStorageLocationById(device_id)); } // static |