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

Unified Diff: chrome/browser/storage_monitor/media_storage_util.cc

Issue 15988011: Refine StorageMonitor storage device getter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix SystemInfoStorageApiTest failures in browser_tests Created 7 years, 6 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/storage_monitor/media_storage_util.cc
diff --git a/chrome/browser/storage_monitor/media_storage_util.cc b/chrome/browser/storage_monitor/media_storage_util.cc
index 04c342fb9c5930ab43a9809c95ab9ae11e9228c6..929400edb34b9536aed6beb19590a523ca6802f2 100644
--- a/chrome/browser/storage_monitor/media_storage_util.cc
+++ b/chrome/browser/storage_monitor/media_storage_util.cc
@@ -50,10 +50,11 @@ void ValidatePathOnFileThread(
typedef std::vector<StorageInfo> StorageInfoList;
bool IsRemovableStorageAttached(const std::string& id) {
- StorageInfoList devices = StorageMonitor::GetInstance()->GetAttachedStorage();
+ StorageInfoList devices =
+ StorageMonitor::GetInstance()->GetAllAvailableStorages();
for (StorageInfoList::const_iterator it = devices.begin();
it != devices.end(); ++it) {
- if (it->device_id() == id)
+ if (StorageInfo::IsRemovableDevice(id) && it->device_id() == id)
return true;
}
return false;
@@ -61,10 +62,12 @@ bool IsRemovableStorageAttached(const std::string& id) {
base::FilePath::StringType FindRemovableStorageLocationById(
const std::string& device_id) {
- StorageInfoList devices = StorageMonitor::GetInstance()->GetAttachedStorage();
+ StorageInfoList devices =
+ StorageMonitor::GetInstance()->GetAllAvailableStorages();
for (StorageInfoList::const_iterator it = devices.begin();
it != devices.end(); ++it) {
- if (it->device_id() == device_id)
+ if (it->device_id() == device_id
+ && StorageInfo::IsRemovableDevice(device_id))
return it->location();
}
return base::FilePath::StringType();

Powered by Google App Engine
This is Rietveld 408576698