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
3 // found in the LICENSE file.
5 #include "chrome/browser/extensions/api/serial/serial_port_enumerator.h"
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"
14 namespace extensions {
16 SerialPortEnumerator::StringSet
17 SerialPortEnumerator::GenerateValidSerialPortNames() {
20 base::win::RegistryValueIterator iter_key(HKEY_LOCAL_MACHINE,
21 L"HARDWARE\\DEVICEMAP\\SERIALCOMM\\");
23 for (; iter_key.Valid(); ++iter_key) {
24 base::string16 str(iter_key.Value());
25 std::string device_string(WideToASCII(str));
26 name_set.insert(device_string);
31 } // namespace extensions