OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "device/serial/serial_device_enumerator_win.h" |
| 6 |
| 7 #include <windows.h> |
| 8 |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/string_util.h" |
| 11 #include "base/strings/stringprintf.h" |
| 12 #include "base/win/registry.h" |
| 13 |
| 14 namespace device { |
| 15 |
| 16 // static |
| 17 scoped_ptr<SerialDeviceEnumerator> SerialDeviceEnumerator::Create() { |
| 18 return scoped_ptr<SerialDeviceEnumerator>(new SerialDeviceEnumeratorWin()); |
| 19 } |
| 20 |
| 21 SerialDeviceEnumeratorWin::SerialDeviceEnumeratorWin() {} |
| 22 |
| 23 SerialDeviceEnumeratorWin::~SerialDeviceEnumeratorWin() {} |
| 24 |
| 25 void SerialDeviceEnumeratorWin::GetDevices( |
| 26 std::vector<SerialDeviceInfo>* devices) { |
| 27 devices->clear(); |
| 28 |
| 29 base::win::RegistryValueIterator iter_key( |
| 30 HKEY_LOCAL_MACHINE, L"HARDWARE\\DEVICEMAP\\SERIALCOMM\\"); |
| 31 for (; iter_key.Valid(); ++iter_key) { |
| 32 base::string16 value(iter_key.Value()); |
| 33 SerialDeviceInfo info; |
| 34 info.path = WideToASCII(value); |
| 35 devices->push_back(info); |
| 36 } |
| 37 } |
| 38 |
| 39 } // namespace device |
OLD | NEW |