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

Unified Diff: chrome/browser/storage_monitor/storage_monitor.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/storage_monitor.cc
diff --git a/chrome/browser/storage_monitor/storage_monitor.cc b/chrome/browser/storage_monitor/storage_monitor.cc
index db2d91a881d0e74d609785a646501d8ccbab3a85..0d6c6c1af3b958f286a110d6978fcae386034aba 100644
--- a/chrome/browser/storage_monitor/storage_monitor.cc
+++ b/chrome/browser/storage_monitor/storage_monitor.cc
@@ -49,11 +49,11 @@ StorageMonitor* StorageMonitor::GetInstance() {
return g_storage_monitor;
}
-std::vector<StorageInfo> StorageMonitor::GetAttachedStorage() const {
+std::vector<StorageInfo> StorageMonitor::GetAllAvailableStorages() const {
std::vector<StorageInfo> results;
base::AutoLock lock(storage_lock_);
- for (RemovableStorageMap::const_iterator it = storage_map_.begin();
+ for (StorageMap::const_iterator it = storage_map_.begin();
it != storage_map_.end();
++it) {
results.push_back(it->second);
@@ -158,15 +158,17 @@ void StorageMonitor::ProcessAttach(const StorageInfo& info) {
DVLOG(1) << "RemovableStorageAttached with name " << UTF16ToUTF8(info.name())
<< " and id " << info.device_id();
- observer_list_->Notify(
- &RemovableStorageObserver::OnRemovableStorageAttached, info);
+ if (StorageInfo::IsRemovableDevice(info.device_id())) {
+ observer_list_->Notify(
+ &RemovableStorageObserver::OnRemovableStorageAttached, info);
+ }
}
void StorageMonitor::ProcessDetach(const std::string& id) {
StorageInfo info;
{
base::AutoLock lock(storage_lock_);
- RemovableStorageMap::iterator it = storage_map_.find(id);
+ StorageMap::iterator it = storage_map_.find(id);
if (it == storage_map_.end())
return;
info = it->second;
@@ -174,8 +176,10 @@ void StorageMonitor::ProcessDetach(const std::string& id) {
}
DVLOG(1) << "RemovableStorageDetached for id " << id;
- observer_list_->Notify(
- &RemovableStorageObserver::OnRemovableStorageDetached, info);
+ if (StorageInfo::IsRemovableDevice(info.device_id())) {
+ observer_list_->Notify(
+ &RemovableStorageObserver::OnRemovableStorageDetached, info);
+ }
}
} // namespace chrome
« no previous file with comments | « chrome/browser/storage_monitor/storage_monitor.h ('k') | chrome/browser/storage_monitor/storage_monitor_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698