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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 } | 53 } |
54 | 54 |
55 // Returns the portable device plug and play device ID string. | 55 // Returns the portable device plug and play device ID string. |
56 base::string16 GetPnpDeviceId(LPARAM data) { | 56 base::string16 GetPnpDeviceId(LPARAM data) { |
57 DEV_BROADCAST_DEVICEINTERFACE* dev_interface = | 57 DEV_BROADCAST_DEVICEINTERFACE* dev_interface = |
58 reinterpret_cast<DEV_BROADCAST_DEVICEINTERFACE*>(data); | 58 reinterpret_cast<DEV_BROADCAST_DEVICEINTERFACE*>(data); |
59 if (!dev_interface) | 59 if (!dev_interface) |
60 return base::string16(); | 60 return base::string16(); |
61 base::string16 device_id(dev_interface->dbcc_name); | 61 base::string16 device_id(dev_interface->dbcc_name); |
62 DCHECK(base::IsStringASCII(device_id)); | 62 DCHECK(base::IsStringASCII(device_id)); |
63 return base::StringToLowerASCII(device_id); | 63 return base::ToLowerASCII(device_id); |
64 } | 64 } |
65 | 65 |
66 // Gets the friendly name of the device specified by the |pnp_device_id|. On | 66 // Gets the friendly name of the device specified by the |pnp_device_id|. On |
67 // success, returns true and fills in |name|. | 67 // success, returns true and fills in |name|. |
68 bool GetFriendlyName(const base::string16& pnp_device_id, | 68 bool GetFriendlyName(const base::string16& pnp_device_id, |
69 IPortableDeviceManager* device_manager, | 69 IPortableDeviceManager* device_manager, |
70 base::string16* name) { | 70 base::string16* name) { |
71 DCHECK(device_manager); | 71 DCHECK(device_manager); |
72 DCHECK(name); | 72 DCHECK(name); |
73 DWORD name_len = 0; | 73 DWORD name_len = 0; |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 if (storage_notifications_) { | 667 if (storage_notifications_) { |
668 storage_notifications_->ProcessDetach( | 668 storage_notifications_->ProcessDetach( |
669 storage_map_iter->second.device_id()); | 669 storage_map_iter->second.device_id()); |
670 } | 670 } |
671 storage_map_.erase(storage_map_iter); | 671 storage_map_.erase(storage_map_iter); |
672 } | 672 } |
673 device_map_.erase(device_iter); | 673 device_map_.erase(device_iter); |
674 } | 674 } |
675 | 675 |
676 } // namespace storage_monitor | 676 } // namespace storage_monitor |
OLD | NEW |