| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/storage_monitor/portable_device_watcher_win.h" | 9 #include "chrome/browser/storage_monitor/portable_device_watcher_win.h" |
| 10 | 10 |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 // Keep track of storage id and storage name to see how often we receive | 615 // Keep track of storage id and storage name to see how often we receive |
| 616 // empty values. | 616 // empty values. |
| 617 MediaStorageUtil::RecordDeviceInfoHistogram(false, storage_id, name); | 617 MediaStorageUtil::RecordDeviceInfoHistogram(false, storage_id, name); |
| 618 if (storage_id.empty() || name.empty()) | 618 if (storage_id.empty() || name.empty()) |
| 619 return; | 619 return; |
| 620 | 620 |
| 621 // Device can have several data partitions. Therefore, add the | 621 // Device can have several data partitions. Therefore, add the |
| 622 // partition identifier to the storage name. E.g.: "Nexus 7 (s10001)" | 622 // partition identifier to the storage name. E.g.: "Nexus 7 (s10001)" |
| 623 string16 storage_name(name + L" (" + storage_iter->object_temporary_id + | 623 string16 storage_name(name + L" (" + storage_iter->object_temporary_id + |
| 624 L')'); | 624 L')'); |
| 625 StorageInfo info(storage_id, storage_name, location, | 625 StorageInfo info(storage_id, location, storage_name, base::string16(), |
| 626 string16(), string16(), string16(), 0); | 626 base::string16(), 0); |
| 627 storage_map_[storage_id] = info; | 627 storage_map_[storage_id] = info; |
| 628 if (storage_notifications_) { | 628 if (storage_notifications_) { |
| 629 info.set_location(GetStoragePathFromStorageId(storage_id)); | 629 info.set_location(GetStoragePathFromStorageId(storage_id)); |
| 630 storage_notifications_->ProcessAttach(info); | 630 storage_notifications_->ProcessAttach(info); |
| 631 } | 631 } |
| 632 } | 632 } |
| 633 device_map_[location] = storage_objects; | 633 device_map_[location] = storage_objects; |
| 634 } | 634 } |
| 635 | 635 |
| 636 void PortableDeviceWatcherWin::HandleDeviceDetachEvent( | 636 void PortableDeviceWatcherWin::HandleDeviceDetachEvent( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 650 if (storage_notifications_) { | 650 if (storage_notifications_) { |
| 651 storage_notifications_->ProcessDetach( | 651 storage_notifications_->ProcessDetach( |
| 652 storage_map_iter->second.device_id()); | 652 storage_map_iter->second.device_id()); |
| 653 } | 653 } |
| 654 storage_map_.erase(storage_map_iter); | 654 storage_map_.erase(storage_map_iter); |
| 655 } | 655 } |
| 656 device_map_.erase(device_iter); | 656 device_map_.erase(device_iter); |
| 657 } | 657 } |
| 658 | 658 |
| 659 } // namespace chrome | 659 } // namespace chrome |
| OLD | NEW |