OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/storage_monitor/storage_monitor.h" | 5 #include "components/storage_monitor/storage_monitor.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "components/storage_monitor/removable_storage_observer.h" | 9 #include "components/storage_monitor/removable_storage_observer.h" |
10 #include "components/storage_monitor/transient_device_ids.h" | 10 #include "components/storage_monitor/transient_device_ids.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 on_initialize_callbacks_.begin(); | 155 on_initialize_callbacks_.begin(); |
156 iter != on_initialize_callbacks_.end(); ++iter) { | 156 iter != on_initialize_callbacks_.end(); ++iter) { |
157 iter->Run(); | 157 iter->Run(); |
158 } | 158 } |
159 on_initialize_callbacks_.clear(); | 159 on_initialize_callbacks_.clear(); |
160 } | 160 } |
161 | 161 |
162 void StorageMonitor::ProcessAttach(const StorageInfo& info) { | 162 void StorageMonitor::ProcessAttach(const StorageInfo& info) { |
163 { | 163 { |
164 base::AutoLock lock(storage_lock_); | 164 base::AutoLock lock(storage_lock_); |
165 if (ContainsKey(storage_map_, info.device_id())) { | 165 if (base::ContainsKey(storage_map_, info.device_id())) { |
166 // This can happen if our unique id scheme fails. Ignore the incoming | 166 // This can happen if our unique id scheme fails. Ignore the incoming |
167 // non-unique attachment. | 167 // non-unique attachment. |
168 return; | 168 return; |
169 } | 169 } |
170 storage_map_.insert(std::make_pair(info.device_id(), info)); | 170 storage_map_.insert(std::make_pair(info.device_id(), info)); |
171 } | 171 } |
172 | 172 |
173 DVLOG(1) << "StorageAttached id " << info.device_id(); | 173 DVLOG(1) << "StorageAttached id " << info.device_id(); |
174 if (StorageInfo::IsRemovableDevice(info.device_id())) { | 174 if (StorageInfo::IsRemovableDevice(info.device_id())) { |
175 observer_list_->Notify( | 175 observer_list_->Notify( |
(...skipping 13 matching lines...) Expand all Loading... |
189 } | 189 } |
190 | 190 |
191 DVLOG(1) << "StorageDetached for id " << id; | 191 DVLOG(1) << "StorageDetached for id " << id; |
192 if (StorageInfo::IsRemovableDevice(info.device_id())) { | 192 if (StorageInfo::IsRemovableDevice(info.device_id())) { |
193 observer_list_->Notify( | 193 observer_list_->Notify( |
194 FROM_HERE, &RemovableStorageObserver::OnRemovableStorageDetached, info); | 194 FROM_HERE, &RemovableStorageObserver::OnRemovableStorageDetached, info); |
195 } | 195 } |
196 } | 196 } |
197 | 197 |
198 } // namespace storage_monitor | 198 } // namespace storage_monitor |
OLD | NEW |