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/media_transfer_protocol_device_observer_lin
ux.h" | 5 #include "components/storage_monitor/media_transfer_protocol_device_observer_lin
ux.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 &device_id, &storage_label, &location, | 203 &device_id, &storage_label, &location, |
204 &vendor_name, &product_name); | 204 &vendor_name, &product_name); |
205 | 205 |
206 // Keep track of device id and device name to see how often we receive | 206 // Keep track of device id and device name to see how often we receive |
207 // empty values. | 207 // empty values. |
208 MediaStorageUtil::RecordDeviceInfoHistogram(false, device_id, | 208 MediaStorageUtil::RecordDeviceInfoHistogram(false, device_id, |
209 storage_label); | 209 storage_label); |
210 if (device_id.empty() || storage_label.empty()) | 210 if (device_id.empty() || storage_label.empty()) |
211 return; | 211 return; |
212 | 212 |
213 DCHECK(!ContainsKey(storage_map_, location)); | 213 DCHECK(!base::ContainsKey(storage_map_, location)); |
214 | 214 |
215 StorageInfo storage_info(device_id, location, storage_label, | 215 StorageInfo storage_info(device_id, location, storage_label, |
216 vendor_name, product_name, 0); | 216 vendor_name, product_name, 0); |
217 storage_map_[location] = storage_info; | 217 storage_map_[location] = storage_info; |
218 notifications_->ProcessAttach(storage_info); | 218 notifications_->ProcessAttach(storage_info); |
219 } else { | 219 } else { |
220 // Existing storage is detached. | 220 // Existing storage is detached. |
221 StorageLocationToInfoMap::iterator it = | 221 StorageLocationToInfoMap::iterator it = |
222 storage_map_.find(GetDeviceLocationFromStorageName(storage_name)); | 222 storage_map_.find(GetDeviceLocationFromStorageName(storage_name)); |
223 if (it == storage_map_.end()) | 223 if (it == storage_map_.end()) |
(...skipping 19 matching lines...) Expand all Loading... |
243 if (it->second.device_id() == device_id) { | 243 if (it->second.device_id() == device_id) { |
244 *location = it->first; | 244 *location = it->first; |
245 return true; | 245 return true; |
246 } | 246 } |
247 } | 247 } |
248 | 248 |
249 return false; | 249 return false; |
250 } | 250 } |
251 | 251 |
252 } // namespace storage_monitor | 252 } // namespace storage_monitor |
OLD | NEW |