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

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: Update Created 7 years, 7 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 682264223c40b147f4446a65e51ef9b9b042da53..561fe0a70f1778d8363ee4aabae946b695bdc4d2 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 (AllAvailableStorageMap::const_iterator it = storage_map_.begin();
it != storage_map_.end();
++it) {
results.push_back(it->second);
@@ -152,15 +152,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(
+ &RemovableStorageObserver::OnRemovableStorageAttached, info);
}
void StorageMonitor::ProcessDetach(const std::string& id) {
StorageInfo info;
{
base::AutoLock lock(storage_lock_);
- RemovableStorageMap::iterator it = storage_map_.find(id);
+ AllAvailableStorageMap::iterator it = storage_map_.find(id);
if (it == storage_map_.end())
return;
info = it->second;

Powered by Google App Engine
This is Rietveld 408576698