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 // Any tasks that communicates with the portable device may take >100ms to | 5 // Any tasks that communicates with the portable device may take >100ms to |
6 // complete. Those tasks should be run on an blocking thread instead of the | 6 // complete. Those tasks should be run on an blocking thread instead of the |
7 // UI thread. | 7 // UI thread. |
8 | 8 |
9 #include "components/storage_monitor/portable_device_watcher_win.h" | 9 #include "components/storage_monitor/portable_device_watcher_win.h" |
10 | 10 |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 const std::string& storage_id = storage_iter->object_persistent_id; | 625 const std::string& storage_id = storage_iter->object_persistent_id; |
626 DCHECK(!ContainsKey(storage_map_, storage_id)); | 626 DCHECK(!ContainsKey(storage_map_, storage_id)); |
627 | 627 |
628 // Keep track of storage id and storage name to see how often we receive | 628 // Keep track of storage id and storage name to see how often we receive |
629 // empty values. | 629 // empty values. |
630 MediaStorageUtil::RecordDeviceInfoHistogram(false, storage_id, name); | 630 MediaStorageUtil::RecordDeviceInfoHistogram(false, storage_id, name); |
631 if (storage_id.empty() || name.empty()) | 631 if (storage_id.empty() || name.empty()) |
632 return; | 632 return; |
633 | 633 |
634 // Device can have several data partitions. Therefore, add the | 634 // Device can have several data partitions. Therefore, add the |
635 // partition identifier to the storage name. E.g.: "Nexus 7 (s10001)" | 635 // partition identifier to the model name. E.g.: "Nexus 7 (s10001)" |
636 base::string16 storage_name(name + L" (" + | 636 base::string16 model_name(name + L" (" + |
637 storage_iter->object_temporary_id + L')'); | 637 storage_iter->object_temporary_id + L')'); |
638 StorageInfo info(storage_id, storage_name, location, | 638 StorageInfo info(storage_id, location, base::string16(), base::string16(), |
639 storage_name, base::string16(), base::string16(), 0); | 639 model_name, 0); |
640 storage_map_[storage_id] = info; | 640 storage_map_[storage_id] = info; |
641 if (storage_notifications_) { | 641 if (storage_notifications_) { |
642 info.set_location(GetStoragePathFromStorageId(storage_id)); | 642 info.set_location(GetStoragePathFromStorageId(storage_id)); |
643 storage_notifications_->ProcessAttach(info); | 643 storage_notifications_->ProcessAttach(info); |
644 } | 644 } |
645 } | 645 } |
646 device_map_[location] = storage_objects; | 646 device_map_[location] = storage_objects; |
647 } | 647 } |
648 | 648 |
649 void PortableDeviceWatcherWin::HandleDeviceDetachEvent( | 649 void PortableDeviceWatcherWin::HandleDeviceDetachEvent( |
(...skipping 13 matching lines...) Expand all Loading... |
663 if (storage_notifications_) { | 663 if (storage_notifications_) { |
664 storage_notifications_->ProcessDetach( | 664 storage_notifications_->ProcessDetach( |
665 storage_map_iter->second.device_id()); | 665 storage_map_iter->second.device_id()); |
666 } | 666 } |
667 storage_map_.erase(storage_map_iter); | 667 storage_map_.erase(storage_map_iter); |
668 } | 668 } |
669 device_map_.erase(device_iter); | 669 device_map_.erase(device_iter); |
670 } | 670 } |
671 | 671 |
672 } // namespace storage_monitor | 672 } // namespace storage_monitor |
OLD | NEW |