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

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: rebase 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..d7c98e5927e478860695993be7e71ea740adc3d8 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,16 @@ 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(
Lei Zhang 2013/06/06 10:15:09 nit:need {}s around this block
Haojian Wu 2013/06/06 11:24:02 Done.
+ &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 +175,9 @@ 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()))
Lei Zhang 2013/06/06 10:15:09 same style nit as above.
Haojian Wu 2013/06/06 11:24:02 Done.
+ observer_list_->Notify(
+ &RemovableStorageObserver::OnRemovableStorageDetached, info);
}
} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698