OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/extensions/api/serial/serial_port_enumerator.h" | 5 #include "chrome/browser/extensions/api/serial/serial_port_enumerator.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/win/registry.h" | 10 #include "base/win/registry.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
13 | 13 |
14 namespace extensions { | 14 namespace extensions { |
15 | 15 |
16 SerialPortEnumerator::StringSet | 16 SerialPortEnumerator::StringSet |
17 SerialPortEnumerator::GenerateValidSerialPortNames() { | 17 SerialPortEnumerator::GenerateValidSerialPortNames() { |
18 StringSet name_set; | 18 StringSet name_set; |
19 | 19 |
20 base::win::RegistryValueIterator iter_key(HKEY_LOCAL_MACHINE, | 20 base::win::RegistryValueIterator iter_key(HKEY_LOCAL_MACHINE, |
21 L"HARDWARE\\DEVICEMAP\\SERIALCOMM\\"); | 21 L"HARDWARE\\DEVICEMAP\\SERIALCOMM\\"); |
22 | 22 |
23 for (; iter_key.Valid(); ++iter_key) { | 23 for (; iter_key.Valid(); ++iter_key) { |
24 string16 str(iter_key.Value()); | 24 string16 str(iter_key.Value()); |
25 std::string device_string(WideToASCII(str)); | 25 std::string device_string(base::WideToASCII(str)); |
26 name_set.insert(device_string); | 26 name_set.insert(device_string); |
27 } | 27 } |
28 return name_set; | 28 return name_set; |
29 } | 29 } |
30 | 30 |
31 } // namespace extensions | 31 } // namespace extensions |
OLD | NEW |