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 "device/serial/serial_device_enumerator_mac.h" | 5 #include "device/serial/serial_device_enumerator_mac.h" |
6 | 6 |
7 #include <IOKit/serial/IOSerialKeys.h> | 7 #include <IOKit/serial/IOSerialKeys.h> |
8 #include <IOKit/usb/IOUSBLib.h> | 8 #include <IOKit/usb/IOUSBLib.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <algorithm> | 11 #include <algorithm> |
| 12 #include <memory> |
12 #include <utility> | 13 #include <utility> |
13 | 14 |
14 #include "base/files/file_enumerator.h" | 15 #include "base/files/file_enumerator.h" |
15 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
16 #include "base/files/file_util.h" | 17 #include "base/files/file_util.h" |
17 #include "base/mac/scoped_cftyperef.h" | 18 #include "base/mac/scoped_cftyperef.h" |
18 #include "base/mac/scoped_ioobject.h" | 19 #include "base/mac/scoped_ioobject.h" |
19 #include "base/memory/scoped_ptr.h" | |
20 #include "base/metrics/sparse_histogram.h" | 20 #include "base/metrics/sparse_histogram.h" |
21 #include "base/strings/pattern.h" | 21 #include "base/strings/pattern.h" |
22 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
23 #include "base/strings/sys_string_conversions.h" | 23 #include "base/strings/sys_string_conversions.h" |
24 | 24 |
25 namespace device { | 25 namespace device { |
26 | 26 |
27 namespace { | 27 namespace { |
28 | 28 |
29 // Searches a service and all ancestor services for a property with the | 29 // Searches a service and all ancestor services for a property with the |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 break; | 197 break; |
198 } | 198 } |
199 } | 199 } |
200 } while (true); | 200 } while (true); |
201 return devices; | 201 return devices; |
202 } | 202 } |
203 | 203 |
204 } // namespace | 204 } // namespace |
205 | 205 |
206 // static | 206 // static |
207 scoped_ptr<SerialDeviceEnumerator> SerialDeviceEnumerator::Create() { | 207 std::unique_ptr<SerialDeviceEnumerator> SerialDeviceEnumerator::Create() { |
208 return scoped_ptr<SerialDeviceEnumerator>(new SerialDeviceEnumeratorMac()); | 208 return std::unique_ptr<SerialDeviceEnumerator>( |
| 209 new SerialDeviceEnumeratorMac()); |
209 } | 210 } |
210 | 211 |
211 SerialDeviceEnumeratorMac::SerialDeviceEnumeratorMac() {} | 212 SerialDeviceEnumeratorMac::SerialDeviceEnumeratorMac() {} |
212 | 213 |
213 SerialDeviceEnumeratorMac::~SerialDeviceEnumeratorMac() {} | 214 SerialDeviceEnumeratorMac::~SerialDeviceEnumeratorMac() {} |
214 | 215 |
215 mojo::Array<serial::DeviceInfoPtr> SerialDeviceEnumeratorMac::GetDevices() { | 216 mojo::Array<serial::DeviceInfoPtr> SerialDeviceEnumeratorMac::GetDevices() { |
216 mojo::Array<serial::DeviceInfoPtr> newDevices = GetDevicesNew(); | 217 mojo::Array<serial::DeviceInfoPtr> newDevices = GetDevicesNew(); |
217 mojo::Array<serial::DeviceInfoPtr> oldDevices = GetDevicesOld(); | 218 mojo::Array<serial::DeviceInfoPtr> oldDevices = GetDevicesOld(); |
218 | 219 |
(...skipping 15 matching lines...) Expand all Loading... |
234 } | 235 } |
235 | 236 |
236 mojo::Array<mojo::String> paths; | 237 mojo::Array<mojo::String> paths; |
237 mojo::Array<serial::DeviceInfoPtr> devices; | 238 mojo::Array<serial::DeviceInfoPtr> devices; |
238 deviceMap.DecomposeMapTo(&paths, &devices); | 239 deviceMap.DecomposeMapTo(&paths, &devices); |
239 | 240 |
240 return devices; | 241 return devices; |
241 } | 242 } |
242 | 243 |
243 } // namespace device | 244 } // namespace device |
OLD | NEW |