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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 return (IsEqualGUID(dev_interface->dbcc_classguid, guidDevInterface) != 0); | 52 return (IsEqualGUID(dev_interface->dbcc_classguid, guidDevInterface) != 0); |
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(IsStringASCII(device_id)); | 62 DCHECK(base::IsStringASCII(device_id)); |
63 return StringToLowerASCII(device_id); | 63 return StringToLowerASCII(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); |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |